This plugin for Sylius allows you to manage sales representatives.
Supports Doctrine ORM driver only.
Sales Representatives:
Customer:
Open a command console, enter your project directory and execute the following command to download the latest stable version of this plugin:
$ composer require tavy315/sylius-sales-representatives-plugin
This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.
Then, enable the plugin by adding it to the list of registered plugins/bundles in config/bundles.php
file of your project:
<?php
$bundles = [
Tavy315\SyliusSalesRepresentativesPlugin\Tavy315SyliusSalesRepresentativesPlugin::class => ['all' => true],
];
# config/packages/tavy315_sylius_sales_representatives.yaml
imports:
- { resource: "@Tavy315SyliusSalesRepresentativesPlugin/Resources/config/app/config.yaml" }
Read more about Sylius models customization here.
Add a Tavy315\SyliusSalesRepresentativesPlugin\Model\Customer\SalesRepresentativeTrait
trait to your App\Entity\Customer\Customer
class.
-
If you use
annotations
mapping:<?php // src/Entity/Customer/Customer.php namespace App\Entity\Customer; use Doctrine\ORM\Mapping as ORM; use Sylius\Component\Core\Model\Customer as BaseCustomer; use Tavy315\SyliusSalesRepresentativesPlugin\Model\Customer\SalesRepresentativeAwareInterface; use Tavy315\SyliusSalesRepresentativesPlugin\Model\Customer\SalesRepresentativeTrait; /** * @ORM\Entity * @ORM\Table(name="sylius_customer") */ class Customer extends BaseCustomer implements SalesRepresentativeAwareInterface { use SalesRepresentativeTrait; }
$ php bin/console doctrine:migrations:diff
$ php bin/console doctrine:migrations:migrate
From now, you can attach a sales representative to any customer; our use case is to send a copy of the order confirmation email when customer makes an order.