3brs/sylius-zasilkovna-plugin
最新稳定版本:v3.3.0
Composer 安装命令:
composer require 3brs/sylius-zasilkovna-plugin
包简介
Zasilkovna plugin for Sylius
README 文档
README
Zásilkovna Plugin
Features
- Enables sending shipments via [cz] [pl] [sk] [hu] [ro] to Zasilkovna branch or to the customer's address via Zasilkovna service.
- The user can choose the Zásilkovna branch from the map during checkout in the Shipment step.
- See Zásilkovna branch in final checkout step and also in the admin panel.
- Export CSV with the Zásilkovna shipments (both to Zasilkovna branch or customer's address) and import it easily into Zásilkovna's system.
Installation
-
Run
$ composer require 3brs/sylius-zasilkovna-plugin. -
Add plugin classes to your
config/bundles.php:return [ ... ThreeBRS\ShipmentExportPlugin\ThreeBRSSyliusShipmentExportPlugin::class => ['all' => true], ThreeBRS\SyliusZasilkovnaPlugin\ThreeBRSSyliusZasilkovnaPlugin::class => ['all' => true], ];
-
Add resource to
config/packeges/_sylius.yamlimports: ... ... - { resource: "@ThreeBRSSyliusZasilkovnaPlugin/Resources/config/resources.yml" }
-
Add routing to
config/_routes.yamlthreebrs_sylius_shipment_export_plugin: resource: '@ThreeBRSSyliusShipmentExportPlugin/Resources/config/routing.yml' prefix: /admin
-
Your Entity
Shipmenthas to implement\ThreeBRS\SyliusZasilkovnaPlugin\Model\ZasilkovnaShipmentInterface. You can use the trait\ThreeBRS\SyliusZasilkovnaPlugin\Model\ZasilkovnaShipmentTrait.<?php declare(strict_types=1); namespace App\Entity\Shipping; use Doctrine\ORM\Mapping as ORM; use ThreeBRS\SyliusZasilkovnaPlugin\Model\ZasilkovnaShipmentInterface; use ThreeBRS\SyliusZasilkovnaPlugin\Model\ZasilkovnaShipmentTrait; use Sylius\Component\Core\Model\Shipment as BaseShipment; /** * @ORM\Entity * @ORM\Table(name="sylius_shipment") */ class Shipment extends BaseShipment implements ZasilkovnaShipmentInterface { use ZasilkovnaShipmentTrait; }
-
Your Entity
ShippingMethodhas to implement\ThreeBRS\SyliusZasilkovnaPlugin\Model\ZasilkovnaShipmentInterface. You can use the trait\ThreeBRS\SyliusZasilkovnaPlugin\Model\ZasilkovnaShipmentTrait.<?php declare(strict_types=1); namespace App\Entity\Shipping; use Doctrine\ORM\Mapping as ORM; use ThreeBRS\SyliusZasilkovnaPlugin\Model\ZasilkovnaShippingMethodInterface; use ThreeBRS\SyliusZasilkovnaPlugin\Model\ZasilkovnaShippingMethodTrait; use Sylius\Component\Core\Model\ShippingMethod as BaseShippingMethod; /** * @ORM\Entity * @ORM\Table(name="sylius_shipping_method") */ class ShippingMethod extends BaseShippingMethod implements ZasilkovnaShippingMethodInterface { use ZasilkovnaShippingMethodTrait; }
-
Include
@ThreeBRSSyliusZasilkovnaPlugin/Admin/ShippingMethod/:zasilkovnaForm.html.twiginto@SyliusAdmin/ShippingMethod/_form.html.twig.... {{ include('@ThreeBRSSyliusZasilkovnaPlugin/Admin/ShippingMethod/_zasilkovnaForm.html.twig') }} -
Include
@ThreeBRSSyliusZasilkovnaPlugin/Shop/Checkout/SelectShipping/_zasilkovnaChoice.html.twiginto@SyliusShop/Checkout/SelectShipping/_choice.html.twig.... {{ include('@ThreeBRSSyliusZasilkovnaPlugin/Shop/Checkout/SelectShipping/_zasilkovnaChoice.html.twig') }} -
Replace
{% include '@SyliusShop/Common/_address.html.twig' with {'address': order.shippingAddress} %}with{{ include('@ThreeBRSSyliusZasilkovnaPlugin/Shop/Common/Order/_addresses.html.twig') }}in@SyliusShop/Common/Order/_addresses.html.twig -
Replace
{% include '@SyliusAdmin/Common/_address.html.twig' with {'address': order.shippingAddress} %}with{{ include('@ThreeBRSSyliusZasilkovnaPlugin/Admin/Common/Order/_addresses.html.twig') }}in@SyliusAdmin/Order/Show/_addresses.html.twig -
Override the template in
@ThreeBRSSyliusShipmentExportPlugin/_row.html.twig{% extends '@!ThreeBRSSyliusShipmentExportPlugin/_row.html.twig' %} {% block address %} {% if row.zasilkovna %} {{ include('@ThreeBRSSyliusZasilkovnaPlugin/_exporterRow.html.twig') }} {% else %} {{ parent() }} {% endif %} {% endblock %} -
Create and run doctrine database migrations.
For the guide how to use your own entity see Sylius docs - Customizing Models
Usage
- For delivery to the Zasilkovna branch, create new shipping method in the admin panel, set
Zásilkovna api keyand leaveCarrier IDempty. - For delivery to customer's address, create new shipping method in the admin panel, set the
Carrier IDand leave theZasilkovna API keyempty. - If you need to filter the points in the map by country, use the
Show only pickup points from specific country in the map. If you leave this blank, all points in all supported countries will be shown. - Zásilkovna CSV export will be generated for shipping method which has the code 'zasilkovna', you can change this in parameters, it is an array (therefore can contain more codes, e.g. if you need to have different prices for different countries, you will need more shipping methods; it is okay to use always the same API key)
parameters: shippingMethodsCodes: ['zasilkovna']
You should add to this array both methods for shipping to Zasilkovna branch and also to customer's address via Zasilkovna service. - Packeta API documentation: https://docs.packetery.com/03-creating-packets/01-csv-import.html
- You can expand the list of countries by the parameter
parameters: threebrs_sylius_zasilkovna_plugin_payment_methods: ['cz', 'pl', 'sk', 'hu', 'ro']
Development
Usage
- Develop your plugin in
/src - See
bin/for useful commands
Testing
After your changes you must ensure that the tests are still passing.
$ composer install
$ bin/console doctrine:schema:create -e test
$ bin/behat
$ bin/phpstan.sh
$ bin/ecs.sh
License
This library is under the MIT license.
Credits
3brs/sylius-zasilkovna-plugin 适用场景与选型建议
3brs/sylius-zasilkovna-plugin 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 745 次下载、GitHub Stars 达 2, 最近一次更新时间为 2021 年 07 月 23 日, 在 PHP 生态内属于活跃度较高的组件。
它主要适用于以下技术方向: 「sylius」 「sylius-plugin」 「Zasilkovna」 「packeta」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。
我们在过去多个企业项目中使用过 3brs/sylius-zasilkovna-plugin 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。
基于 3brs/sylius-zasilkovna-plugin 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。
线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。
承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。
与 3brs/sylius-zasilkovna-plugin 相关的其它包
同方向 / 同关键字的高下载量 PHP Composer 包推荐,方便对比选型:
Zasilkovna SOAP and REST client in PHP
Implementation of the Omnibus Directive for Sylius application.
Bulk export of sylius resources
Sylius plugin that integrates Addwish
Setono example plugin for Sylius.
Will translate fragments of text automatically
统计信息
- 总下载量: 745
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 2
- 点击次数: 13
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2021-07-23




