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.
$ composer require tomsgu/sylius-gift-pluginThis command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.
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],
// ...
];# config/packages/_sylius.yaml
imports:
# ...
- { resource: '@TomsguSyliusGiftPlugin/Resources/config/app/config.yaml' }
# ...# config/routes/tomsgu_sylius_gift.yaml
tomsgu_sylius_gift_admin:
resource: "@TomsguSyliusGiftPlugin/Resources/config/routes/admin.yaml"
prefix: /admin$ php bin/console doctrine:migrations:diff
$ php bin/console doctrine:migrations:migrateOverride 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 %}
- 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.