mangoweb-sylius / sylius-ceska-posta-balikomaty-plugin
Česká pošta balíkomaty plugin for Sylius
Installs: 1
Dependents: 0
Suggesters: 0
Security: 0
Stars: 1
Watchers: 3
Forks: 0
Open Issues: 0
Type:sylius-plugin
Requires
- php: ^7.3
- ext-json: *
- mangoweb-sylius/sylius-shipment-export-plugin: ^0.4.0
- sylius/sylius: ^1.7.0
Requires (Dev)
- behat/behat: ^3.4
- behat/mink: ^1.7@dev
- behat/mink-browserkit-driver: ^1.3
- behat/mink-extension: ^2.2
- behat/mink-selenium2-driver: ^1.3
- friends-of-behat/page-object-extension: ^0.3
- friends-of-behat/suite-settings-extension: ^1.0
- friends-of-behat/symfony-extension: ^2.0
- friends-of-behat/variadic-extension: ^1.1
- lakion/mink-debug-extension: ^1.2.3
- phpspec/phpspec: ^6.0
- phpstan/phpstan: ^0.12.0
- phpstan/phpstan-doctrine: ^0.12.0
- phpstan/phpstan-strict-rules: ^0.12.0
- phpstan/phpstan-symfony: ^0.12.4
- phpstan/phpstan-webmozart-assert: ^0.12.0
- phpunit/phpunit: ^8.0
- sensiolabs/security-checker: ^6.0
- sylius-labs/coding-standard: ^3.1
- symfony/browser-kit: ^4.4
- symfony/debug-bundle: ^4.4
- symfony/dotenv: ^4.4
- symfony/intl: ^4.4
- symfony/web-profiler-bundle: ^4.4
- symfony/web-server-bundle: ^4.4
Conflicts
- symfony/browser-kit: 4.1.8
- symfony/dependency-injection: 4.1.8
- symfony/dom-crawler: 4.1.8
- symfony/routing: 4.1.8
- symfony/symfony: 4.1.8
This package is auto-updated.
Last update: 2024-10-07 16:01:01 UTC
README
Česká Pošta Balíkomaty Plugin
Features
- Adds shipment type Česká Pošta Balíkomat branch which allows sending ordered products to selected Česká Pošta Balíkomat branch.
- The user can choose the Česká Pošta Balíkomat branch during checkout in the Shipment step.
- See Česká Pošta Balíkomat branch in final checkout step and also in the admin panel.
- Export CSV with the Česká Pošta Balíkomat shipments and import it easily into Česká Pošta Balíkomaty's system.
Installation
-
Run
$ composer require mangoweb-sylius/sylius-ceska-posta-balikomaty-plugin
. -
Add plugin classes to your
config/bundles.php
:return [ ... MangoSylius\ShipmentExportPlugin\MangoSyliusShipmentExportPlugin::class => ['all' => true], MangoSylius\SyliusCeskaPostaBalikomatyPlugin\MangoSyliusCeskaPostaBalikomatyPlugin::class => ['all' => true], ];
-
Add resource to
config/packeges/_sylius.yaml
imports: ... - { resource: "@MangoSyliusCeskaPostaBalikomatyPlugin/Resources/config/resources.yml" }
-
Add routing to
config/_routes.yaml
mango_sylius_ceska_posta_balikomaty_plugin: resource: '@MangoSyliusCeskaPostaBalikomatyPlugin/Resources/config/routing.yml' prefix: /admin mango_sylius_shipment_export_plugin: resource: '@MangoSyliusShipmentExportPlugin/Resources/config/routing.yml' prefix: /admin
-
Your Entity
Shipment
has to implement\MangoSylius\SyliusCeskaPostaBalikomatyPlugin\Model\CeskaPostaBalikomatyShipmentInterface
. You can use the trait\MangoSylius\SyliusCeskaPostaBalikomatyPlugin\Model\CeskaPostaBalikomatyShipmentTrait
.<?php declare(strict_types=1); namespace App\Entity\Shipping; use Doctrine\ORM\Mapping as ORM; use MangoSylius\SyliusCeskaPostaBalikomatyPlugin\Model\CeskaPostaBalikomatyShipmentInterface; use MangoSylius\SyliusCeskaPostaBalikomatyPlugin\Model\CeskaPostaBalikomatyShipmentTrait; use Sylius\Component\Core\Model\Shipment as BaseShipment; /** * @ORM\Entity * @ORM\Table(name="sylius_shipment") */ class Shipment extends BaseShipment implements CeskaPostaBalikomatyShipmentInterface { use CeskaPostaBalikomatyShipmentTrait; }
-
Your Entity
ShippingMethod
has to implement\MangoSylius\SyliusCeskaPostaBalikomatyPlugin\Model\CeskaPostaBalikomatyShippingMethodInterface
. You can use the trait\MangoSylius\SyliusCeskaPostaBalikomatyPlugin\Model\CeskaPostaBalikomatyShippingMethodTrait
.<?php declare(strict_types=1); namespace App\Entity\Shipping; use Doctrine\ORM\Mapping as ORM; use MangoSylius\SyliusCeskaPostaBalikomatyPlugin\Model\CeskaPostaBalikomatyShippingMethodInterface; use MangoSylius\SyliusCeskaPostaBalikomatyPlugin\Model\CeskaPostaBalikomatyShippingMethodTrait; use Sylius\Component\Core\Model\ShippingMethod as BaseShippingMethod; /** * @ORM\Entity * @ORM\Table(name="sylius_shipping_method") */ class ShippingMethod extends BaseShippingMethod implements CeskaPostaBalikomatyShippingMethodInterface { use CeskaPostaBalikomatyShippingMethodTrait; }
-
Include
@MangoSyliusCeskaPostaBalikomatyPlugin/Admin/ShippingMethod/_ceskaPostaBalikomatyForm.html.twig
into@SyliusAdmin/ShippingMethod/_form.html.twig
.... {{ include('@MangoSyliusCeskaPostaBalikomatyPlugin/Admin/ShippingMethod/_ceskaPostaBalikomatyForm.html.twig') }} ...
-
Include
@MangoSyliusCeskaPostaBalikomatyPlugin/Shop/Checkout/SelectShipping/_ceskaPostaBalikomatyChoice.html.twig
into@SyliusShop/Checkout/SelectShipping/_choice.html.twig
.... {{ include('@MangoSyliusCeskaPostaBalikomatyPlugin/Shop/Checkout/SelectShipping/_ceskaPostaBalikomatyChoice.html.twig') }}
-
Replace
{% include '@SyliusShop/Common/_address.html.twig' with {'address': order.shippingAddress} %}
with{{ include('@MangoSyliusCeskaPostaBalikomatyPlugin/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('@MangoSyliusCeskaPostaBalikomatyPlugin/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.ceskaPostaBalikomat %} {{ include('@MangoSyliusCeskaPostaBalikomatyPlugin/_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
-
Create new shipping method in the admin panel and enable Česká Pošta Balíkomat, save it and click
Sync Česká Pošta Balíkomaty branches
button to load the list of branches into the current database. -
Česká Pošta Balíkomaty CSV export will be generated for shipping method which has the code 'ceska_posta_balikomat', you can change this in parameters, it is an array.
parameters: shippingMethodsCodes: ['ceska_posta_balikomat']
-
Česká Pošta Balíkomaty branches are updated on their servers. Just call this command (via
cron
) once a day, ideally during the night.mango:ceska-posta-balikomaty:sync
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
Developed by manGoweb.