tavy315 / sylius-sales-representatives-plugin
Sylius plugin for managing sales representatives.
Installs: 1 704
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 4
Forks: 3
Open Issues: 0
Type:sylius-plugin
Requires
- php: >=7.4
- sylius/sylius: ^1.8
README
This plugin for Sylius allows you to manage sales representatives.
Supports Doctrine ORM driver only.
Screenshots
Sales Representatives:
Customer:
Installation
Step 1: Install the plugin
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.
Step 2: Enable the plugin
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], ];
Step 3: Configure the plugin
# config/packages/tavy315_sylius_sales_representatives.yaml imports: - { resource: "@Tavy315SyliusSalesRepresentativesPlugin/Resources/config/app/config.yaml" }
Step 4: Customize models
Read more about Sylius models customization here.
Customize your Customer model
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; }
Step 5: Update your database schema
$ php bin/console doctrine:migrations:diff $ php bin/console doctrine:migrations:migrate
Usage
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.