tomsgu/sylius-gift-plugin
最新稳定版本:3.0.0
Composer 安装命令:
composer require tomsgu/sylius-gift-plugin
包简介
Sylius plugin to mark orders as gifts when ordering products.
README 文档
README
This plugin adds an option to a customer to mark their orders as gifts to another person. This information is passed to an order through its notes field.
Installation
Step 1: Download the plugin
$ composer require tomsgu/sylius-gift-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
Enable the plugin by adding it to the list of registered bundles:
<?php # config/bundles.php return [ // ... Tomsgu\SyliusGiftPlugin\TomsguSyliusGiftPlugin::class => ['all' => true], // It is important to add plugin before the grid bundle Sylius\Bundle\GridBundle\SyliusGridBundle::class => ['all' => true], // ... ];
Step 3: Import config
# config/packages/_sylius.yaml imports: # ... - { resource: '@TomsguSyliusGiftPlugin/Resources/config/app/config.yaml' } # ...
Step 4: Import routing
# config/routes/tomsgu_sylius_gift.yaml tomsgu_sylius_gift_admin: resource: "@TomsguSyliusGiftPlugin/Resources/config/routes/admin.yaml" prefix: /admin
Step 5: Update a database schema
$ php bin/console doctrine:migrations:diff $ php bin/console doctrine:migrations:migrate
Step 6: Override checkout complete form
Override the Sylius Form:
-
If you haven't override the
templates/bundles/SyliusShopBundle/Checkout/Complete/_form.html.twigtemplate yet, copysrc/Resources/views/bundles/SyliusShopBundle/Checkout/Complete/_form.html.twigfile to:templates/bundles/SyliusShopBundle/Checkout/Complete/_form.html.twig$ cp vendor/tomsgu/sylius-gift-plugin/src/Resources/views/bundles/SyliusShopBundle/Checkout/Complete/_form.html.twig \ templates/bundles/SyliusShopBundle/Checkout/Complete/_form.html.twig
-
If you've already override it, add a following snippet to that template:
{# templates/bundles/SyliusShopBundle/Checkout/Complete/_form.html.twig #} {% if form.gift_option is defined %} {{ form_row(form.gift_option) }} {% endif %}
Troubleshooting
- If you get
You have requested a non-existent parameter "tomsgu_sylius_gift.model.gift_option.class"exception, you must instantiate the plugin before the grid bundle. See Step 3: Import config section.
统计信息
- 总下载量: 3
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 0
- 点击次数: 3
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2022-02-02