An open API service indexing awesome lists of open source software.

https://github.com/cleverage/cleveragesyliusdpdplugin


https://github.com/cleverage/cleveragesyliusdpdplugin

Last synced: 11 months ago
JSON representation

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