https://github.com/cleverage/cleveragesyliusdpdplugin
https://github.com/cleverage/cleveragesyliusdpdplugin
Last synced: 11 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/cleverage/cleveragesyliusdpdplugin
- Owner: cleverage
- Created: 2022-12-27T15:06:34.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2023-11-23T08:55:30.000Z (over 2 years ago)
- Last Synced: 2024-07-12T18:17:57.645Z (over 1 year ago)
- Language: PHP
- Size: 72.3 KB
- Stars: 1
- Watchers: 4
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# CleverAge/SyliusDpdPlugin
[![Latest Version][ico-version]](https://packagist.org/packages/cleverage/sylius-dpd-plugin)
[![Software License][ico-license]](LICENSE)
## Introduction
This sylius plugin allows you to manage parcel shipments with DPD.
You can define `DPD pickup points` delivery method.
For pickup point deliveries, an interactive map with the list of pickup points is generated according to the delivery
address entered the tunnel by the user.
## Usage
TODO add screenshots
## Installation
### Step 1: Install and enable plugin
Open a command console, enter your project directory and execute the following command to download the latest stable
version of this plugin:
```bash
$ composer require cleverage/sylius-dpd-plugin
```
This command requires you to have Composer installed globally, as explained in
the [installation chapter](https://getcomposer.org/doc/00-intro.md) of the Composer documentation.
Add bundle to your `config/bundles.php`:
```php
['all' => true],
// ...
];
```
### Step 2: Import routing and configs
#### Import routing
````yaml
# config/routes/clerverage_sylius_dpd.yaml
clever_age_sylius_dpd_shop:
resource: "@CleverAgeSyliusDpdPlugin/Resources/config/shop_routing.yml"
````
#### Import application config
````yaml
# config/packages/_sylius.yaml
imports:
- { resource: "@CleverAgeSyliusDpdPlugin/Resources/config/config.yaml" }
````
### Step 3: Update templates
#### Admin section
Add the following to the admin template `SyliusAdminBundle/Order/Show/_shipment.html.twig`
after shipment header:
```twig
{% include "CleverAgeSyliusDpdPlugin/Shipment/Label/pickupPoint.html.twig" %}
```
See an example [here](tests/Application/templates/bundles/SyliusAdminBundle/Order/Show/_shipment.html.twig).
#### Shop section
Add the following to the shop template `SyliusShopBundle/Checkout/SelectShipping/_choice.html.twig`
```twig
// ...
{% if method.isDpdPickup %}
{% include '@CleverAgeSyliusDpdPlugin/Shipment/selectedPickupPoint.html.twig' %}
{% endif %}
// ...
{% if method.isDpdPickup %}
{% include '@CleverAgeSyliusDpdPlugin/Shipment/map.html.twig' with {
'pickupPoints': [myPickupPoints]
} %}
{% endif %}
```
See an example [here](tests/Application/templates/bundles/SyliusShopBundle/Checkout/SelectShipping/_choice.html.twig).
Next add the following to the shop template `SyliusShopBundle/Common/Order/_shipments.html.twig`
after shipment method header:
```twig
{% include "@CleverAgeSyliusDpdPlugin/Shipment/Label/pickupPoint.html.twig" %}
```
See an example [here](tests/Application/templates/bundles/SyliusShopBundle/Common/Order/_shipments.html.twig).
## Step 4 : Update styles, scripts and install assets
Add the following to the shop template `SyliusShopBundle/_styles.html.twig`
```twig
{% include '@SyliusUi/_stylesheets.html.twig' with { 'path': 'bundles/cleveragesyliusdpdplugin/css/dpd-map.css' } %}
{% include '@SyliusUi/_stylesheets.html.twig' with { 'path': 'bundles/cleveragesyliusdpdplugin/css/dpd-popup.css' } %}
{# Important for the map ! #}
```
See an example [here](tests/Application/templates/bundles/SyliusShopBundle/_styles.html.twig).
Next the following to the shop template `SyliusShopBundle/_scripts.html.twig`
```twig
{% include '@SyliusUi/_javascripts.html.twig' with { 'path': 'bundles/cleveragesyliusdpdplugin/js/dpd-select-shipping.js' } %}
{% include '@SyliusUi/_javascripts.html.twig' with { 'path': 'bundles/cleveragesyliusdpdplugin/js/dpd-select-pickup-point.js' } %}
{% include '@SyliusUi/_javascripts.html.twig' with { 'path': 'bundles/cleveragesyliusdpdplugin/js/dpd-change-pickup-point.js' } %}
```
See an example [here](tests/Application/templates/bundles/SyliusShopBundle/_scripts.html.twig).
### Install assets
```bash
bin/console assets:install --symlink
```
# Step 5 : Customize resources
**Shipping method resource**
If you haven't extended the shipping method resource yet, here is what it should look like :
```php