waaz/sylius-tnt-plugin

此TNT插件使您能够轻松打印运货标签,并显示可供客户选择的可用取货地点。

安装: 44

依赖项: 0

建议者: 0

安全: 0

星标: 3

关注者: 2

分支: 0

开放问题: 0

类型:sylius-plugin


README

Logo

GitHub Workflow Status Scrutinizer Code Quality

WaazSyliusTntPlugin

此插件允许您为TNT承运人生成运货标签。

特性

  • 运货标签导出
  • 检查邮政编码和城市是否匹配TNT:对于此功能,如果选择的国家是'FR',则城市字段变为从tnt webservice获取的城市建议的select框

安装(标签导出部分

前提条件:您必须首先配置/安装 bitbag/shipping-export-plugin

使用composer安装插件

composer require waaz/sylius-tnt-plugin

将插件依赖项添加到您的 config/bundles.php 文件

return [
    ...

    Waaz\SyliusTntPlugin\WaazSyliusTntPlugin::class => ['all' => true],
];

在您的 config/routes/sylius_shop.yaml 文件中添加路由

...
waaz_tnt_shop:
    resource: "@WaazSyliusTntPlugin/Resources/config/routing/shop_tnt.yaml"

在您的 config/services.yaml 文件中添加参数验证组

parameters:
    ...
    sylius.form.type.checkout_address.validation_groups: ['sylius', 'tnt_address']

运行资产安装命令: bin/console assets:install

templates/bundles/SyliusShopBundle/_scripts.html.twig 文件中添加插件资产

{% include '@SyliusUi/_javascripts.html.twig' with {'path': 'assets/shop/js/app.js'} %}
{% include '@SyliusUi/_javascripts.html.twig' with {'path': 'bundles/waazsyliustntplugin/js/tnt-city.js'} %}

配置

您可以通过创建一个文件 config/packages/waaz_sylius_tnt_plugin 来配置此插件

# Defaults values
waaz_sylius_tnt:
    username: 'login' # Enter your tnt username here. You should use an environment variable like `%env(TNT_PASSWORD)%`
    password: 'password' # Same for password
    sandbox: true  # Sandbox mode
    weight_unit: 'g' # 'g' or 'kg'. Weight unit you use in your shop
    city_select_classes: 'ui dropdown' # Classes you want for city select field

安装(取货点部分

前提条件:您必须首先配置/安装 setono/sylius-pickup-point-plugin

运行测试

  • PHPSpec
vendor/bin/phpspec run
  • Behat(非JS场景)
vendor/bin/behat --strict --tags="~@javascript"
  • Behat(JS场景)

    1. 安装Symfony CLI命令.

    2. 启动无头Chrome

    google-chrome-stable --enable-automation --disable-background-networking --no-default-browser-check --no-first-run --disable-popup-blocking --disable-default-apps --allow-insecure-localhost --disable-translate --disable-extensions --no-sandbox --enable-features=Metal --headless --remote-debugging-port=9222 --window-size=2880,1800 --proxy-server='direct://' --proxy-bypass-list='*' http://127.0.0.1
    1. 安装SSL证书(只需一次)并在 127.0.0.1:8080 上运行测试应用程序的web服务器
    symfony server:ca:install
    APP_ENV=test symfony server:start --port=8080 --dir=tests/Application/public --daemon
    1. 运行Behat
    vendor/bin/behat --strict --tags="@javascript"
  • Psalm

    vendor/bin/psalm
  • PHPStan

vendor/bin/phpstan analyse -c phpstan.neon -l max src/  
  • 编码规范
vendor/bin/ecs check src

作者

许可证

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