sherlockode/sylius-mondial-relay-plugin

Sylius Mondial Relay 插件。

v1.1.2 2024-08-05 08:05 UTC

This package is auto-updated.

Last update: 2024-09-05 08:18:27 UTC


README

Support

目录

概述

此插件可以在您的 Sylius 网站上启用 Mondial Relay 配送方式。

image

安装

使用 composer 安装插件

$ composer require sherlockode/sylius-mondial-relay-plugin

完成配置

# config/packages/sherlockode_sylius_mondial_relay.yaml

sherlockode_sylius_mondial_relay:
    wsdl: The mondial relay WSDL
    merchant_id: Your merchant ID
    private_key: Your private key

导入路由

# config/routes.yaml

sherlockode_sylius_mondial_relay_plugin:
    resource: "@SherlockodeSyliusMondialRelayPlugin/Resources/config/routing.xml"

在您的 Shipment 实体中,导入 PickupPointTrait

<?php

// App/Entity/Shipping/Shipment.php

namespace App\Entity\Shipping;

use Doctrine\ORM\Mapping as ORM;
use Sherlockode\SyliusMondialRelayPlugin\Model\PickupPointTrait;
use Sylius\Component\Core\Model\Shipment as BaseShipment;

/**
 * @ORM\Entity
 * @ORM\Table(name="sylius_shipment")
 */
class Shipment extends BaseShipment
{
    use PickupPointTrait;
}

不要忘记之后进行迁移或 d:s:u 操作

更新 webpack 配置,以在商店配置和后台配置中添加条目

// Shop config
Encore
  // ...
  .addEntry('sherlockode-mondial-relay', './vendor/sherlockode/sylius-mondial-relay-plugin/src/Resources/public/js/entry.js')

// Admin config
Encore
  // ...
  .addEntry('sherlockode-mondial-relay', './vendor/sherlockode/sylius-mondial-relay-plugin/src/Resources/public/js/admin.js')

用法

配送方式配置

现在您只需创建一个新的配送方式。对于配送费用选项,选择 "Mondial Relay"。

image

Google API 集成

为了显示 Google 地图以选择取货点,您需要为您的令牌启用 Google 地图 API。您可以在 Google Cloud Console 中进行此操作。然后,更新插件配置

# config/packages/sherlockode_sylius_mondial_relay.yaml

sherlockode_sylius_mondial_relay:
    # ...
    map_provider: google
    google_api_key: '%env(GOOGLE_API_KEY)%'

此外,您可能还想启用 Google Place API,以便在搜索取货点时显示地点建议。

Open Street Map 集成

此插件还支持 Open Street Map。要启用它,您只需更新插件配置中的 map_provider 设置

# config/packages/sherlockode_sylius_mondial_relay.yaml

sherlockode_sylius_mondial_relay:
    # ...
    map_provider: open_street_map

打印快递单据

当订单通过 Mondial Relay 下单时,您可以从 Sylius 管理后台打印快递单据。转到订单详情页面并使用 "打印单据" 按钮。

image

此功能可以从包配置中禁用

sherlockode_sylius_mondial_relay:
    # ...
    enable_ticket_printing: false

演示 Sylius 商店

我们创建了一个演示应用,其中包含一些有用的插件用例!访问 sylius-demo.sherlockode.fr 查看它。管理员可以在 sylius-demo.sherlockode.fr/admin/login 链接下访问。我们在演示中使用的插件

开发者额外资源

要了解有关我们的贡献工作流程等更多信息,我们鼓励您使用以下资源

许可证

此插件的源代码完全免费,并按照 MIT 许可证条款发布。

联系信息

如果您想联系我们,最佳方式是在我们的网站上填写表格 here 或发送电子邮件到 contact@sherlockode.fr,附上您的问题(s)。我们保证尽快回答!