sherlockode/sylius-mondial-relay-plugin

Sylius plugin for Mondial Relay.

v1.1.2 2024-08-05 08:05 UTC

This package is auto-updated.

Last update: 2024-12-05 09:04:01 UTC


README

Support

Table of Content

Overview

This plugin enables Mondial Relay shipping method on your Sylius website.

image

Installation

Install the plugin with composer:

$ composer require sherlockode/sylius-mondial-relay-plugin

Complete the configuration:

# config/packages/sherlockode_sylius_mondial_relay.yaml

sherlockode_sylius_mondial_relay:
    wsdl: The mondial relay WSDL
    merchant_id: Your merchant ID
    private_key: Your private key

Import routing:

# config/routes.yaml

sherlockode_sylius_mondial_relay_plugin:
    resource: "@SherlockodeSyliusMondialRelayPlugin/Resources/config/routing.xml"

In your Shipment entity, import the PickupPointTrait:

<?php

// App/Entity/Shipping/Shipment.php

namespace App\Entity\Shipping;

use Doctrine\ORM\Mapping as ORM;
use Sherlockode\SyliusMondialRelayPlugin\Model\PickupPointTrait;
use Sylius\Component\Core\Model\Shipment as BaseShipment;

/**
 * @ORM\Entity
 * @ORM\Table(name="sylius_shipment")
 */
class Shipment extends BaseShipment
{
    use PickupPointTrait;
}

Don't forget to make a migration or a d:s:u after that

Update your webpack configuration to add entries both in shop config and admin config:

// Shop config
Encore
  // ...
  .addEntry('sherlockode-mondial-relay', './vendor/sherlockode/sylius-mondial-relay-plugin/src/Resources/public/js/entry.js')

// Admin config
Encore
  // ...
  .addEntry('sherlockode-mondial-relay', './vendor/sherlockode/sylius-mondial-relay-plugin/src/Resources/public/js/admin.js')

Usage

Shipping method configuration

Now you only have to create a new shipping method. For the Shipping charges option, select "Mondial Relay"

image

Google API integration

In order to show a Google map to select pickup points, you need to enable Google Map API for your token. You can do it in the Google Cloud Console. Then, update the plugin configuration:

# config/packages/sherlockode_sylius_mondial_relay.yaml

sherlockode_sylius_mondial_relay:
    # ...
    map_provider: google
    google_api_key: '%env(GOOGLE_API_KEY)%'

Additionally, you may want to enable Google Place API to show places suggestions when searching pickup points.

Open Street Map integration

This plugin also supports Open Street Map. To enable it, you just have to update the map_provider setting in your plugin configuration:

# config/packages/sherlockode_sylius_mondial_relay.yaml

sherlockode_sylius_mondial_relay:
    # ...
    map_provider: open_street_map

Print expedition tickets

When an order has been placed with Mondial Relay, you can print the expedition ticket from the Sylius admin. Go on the order details page and use the "Print ticket" button.

image

This feature can be disabled from the bundle configuration:

sherlockode_sylius_mondial_relay:
    # ...
    enable_ticket_printing: false

Demo Sylius Shop

We created a demo app with some useful use-cases of plugins! Visit sylius-demo.sherlockode.fr to take a look at it. The admin can be accessed under sylius-demo.sherlockode.fr/admin/login link. Plugins that we have used in the demo:

Additional resources for developers

To learn more about our contribution workflow and more, we encourage you to use the following resources:

License

This plugin's source code is completely free and released under the terms of the MIT license.

Contact

If you want to contact us, the best way is to fill the form on our website or send us an e-mail to contact@sherlockode.fr with your question(s). We guarantee that we answer as soon as we can!