- Enables sending shipments via PPL to PPL parcelshops.
- The user can choose the PPL parcelshops from the map during checkout in the Shipment step.
- See PPL parcelshop in final checkout step and also in the admin panel.
- Export CSV with the PPL parcelshops shipments and import it easily into PPL's system.
-
Run
$ composer require mangoweb-sylius/sylius-ppl-parcelshops-plugin
. -
Add plugin classes to your
config/bundles.php
:return [ ... MangoSylius\ShipmentExportPlugin\MangoSyliusShipmentExportPlugin::class => ['all' => true], MangoSylius\SyliusPplParcelshopsPlugin\MangoSyliusPplParcelshopsPlugin::class => ['all' => true], ];
-
Add routing to
config/_routes.yaml
sylius_ppl_parcelshops_plugin: resource: '@MangoSyliusPplParcelshopsPlugin/Resources/config/routing.yml' mango_sylius_shipment_export_plugin: resource: '@MangoSyliusShipmentExportPlugin/Resources/config/routing.yml' prefix: /admin
-
Your Entity
Shipment
has to implement\MangoSylius\SyliusPplParcelshopsPlugin\Model\PplShipmentInterface
. You can use the trait\MangoSylius\SyliusPplParcelshopsPlugin\Model\PplShipmentTrait
.<?php declare(strict_types=1); namespace App\Entity\Shipping; use Doctrine\ORM\Mapping as ORM; use MangoSylius\SyliusPplParcelshopsPlugin\Model\PplShipmentInterface; use MangoSylius\SyliusPplParcelshopsPlugin\Model\PplShipmentTrait; use Sylius\Component\Core\Model\Shipment as BaseShipment; /** * @ORM\Entity * @ORM\Table(name="sylius_shipment") */ class Shipment extends BaseShipment implements PplShipmentInterface { use PplShipmentTrait; }
-
Your Entity
ShippingMethod
has to implement\MangoSylius\SyliusPplParcelshopsPlugin\Model\PplShippingMethodInterface
. You can use the trait\MangoSylius\SyliusPplParcelshopsPlugin\Model\PplShippingMethodTrait
.<?php declare(strict_types=1); namespace App\Entity\Shipping; use Doctrine\ORM\Mapping as ORM; use MangoSylius\SyliusPplParcelshopsPlugin\Model\PplShippingMethodInterface; use MangoSylius\SyliusPplParcelshopsPlugin\Model\PplShippingMethodTrait; use Sylius\Component\Core\Model\ShippingMethod as BaseShippingMethod; /** * @ORM\Entity * @ORM\Table(name="sylius_shipping_method") */ class ShippingMethod extends BaseShippingMethod implements PplShippingMethodInterface { use PplShippingMethodTrait; }
-
Include
@MangoSyliusPplParcelshopsPlugin/Admin/ShippingMethod/_pplForm.html.twig
into@SyliusAdmin/ShippingMethod/_form.html.twig
.... {{ include('@MangoSyliusPplParcelshopsPlugin/Admin/ShippingMethod/_pplForm.html.twig') }}
-
Include
@MangoSyliusPplParcelshopsPlugin/Shop/Checkout/SelectShipping/_pplChoice.html.twig
into@SyliusShop/Checkout/SelectShipping/_choice.html.twig
.... {{ include('@MangoSyliusPplParcelshopsPlugin/Shop/Checkout/SelectShipping/_pplChoice.html.twig') }}
-
Replace
{% include '@SyliusShop/Common/_address.html.twig' with {'address': order.shippingAddress} %}
with{{ include('@MangoSyliusPplParcelshopsPlugin/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('@MangoSyliusPplParcelshopsPlugin/Admin/Common/Order/_addresses.html.twig') }}
in@SyliusAdmin/Order/Show/_addresses.html.twig
-
Override the template in
@MangoSyliusShipmentExportPlugin/_row.html.twig
{% extends '@MangoSyliusShipmentExportPlugin/_row.html.twig' %} {% block address %} {% if row.pplKTMID %} {{ include('@MangoSyliusPplParcelshopsPlugin/_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
- For delivery to the PPL parcelshop, create new shipping method in the admin panel, check
To PPL ParcelShop enabled
. - PPL CSV export will be generated for shipping method which has the code 'ppl_parcel_shop', you can change this in parameters, it is an array.
parameters: pplShippingMethodsCodes: ['ppl_parcel_shop']
- Develop your plugin in
/src
- See
bin/
for useful commands
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
This library is under the MIT license.
Developed by manGoweb.