tavy315 / sylius-sales-representatives-plugin
Sylius 销售代表管理插件。
v0.2.3
2022-02-03 23:26 UTC
Requires
- php: >=7.4
- sylius/sylius: ^1.8
README
此插件用于 Sylius,可帮助您管理销售代表。
仅支持 Doctrine ORM 驱动。
屏幕截图
销售代表
客户
安装
步骤 1:安装插件
打开命令行,进入您的项目目录,并执行以下命令以下载此插件的最新稳定版本
$ composer require tavy315/sylius-sales-representatives-plugin
此命令需要您全局安装 Composer,如 Composer 文档中的 安装章节 所述。
步骤 2:启用插件
然后,通过将其添加到项目 config/bundles.php
文件中注册的插件/包列表中来启用插件。
<?php $bundles = [ Tavy315\SyliusSalesRepresentativesPlugin\Tavy315SyliusSalesRepresentativesPlugin::class => ['all' => true], ];
步骤 3:配置插件
# config/packages/tavy315_sylius_sales_representatives.yaml imports: - { resource: "@Tavy315SyliusSalesRepresentativesPlugin/Resources/config/app/config.yaml" }
步骤 4:自定义模型
有关 Sylius 模型自定义的更多信息,请参阅 此处。
自定义您的客户模型
将 Tavy315\SyliusSalesRepresentativesPlugin\Model\Customer\SalesRepresentativeTrait
特性添加到您的 App\Entity\Customer\Customer
类中。
-
如果使用
annotations
映射<?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; }
步骤 5:更新您的数据库模式
$ php bin/console doctrine:migrations:diff $ php bin/console doctrine:migrations:migrate
用法
从现在起,您可以将销售代表附加到任何客户;我们的用例是在客户下单时发送订单确认邮件的副本。