tomsgu / sylius-gift-plugin
Sylius plugin to mark orders as gifts when ordering products.
Installs: 2
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:sylius-plugin
Requires
- php: >=8.0
- php-http/message-factory: ^1.1
- sylius/sylius: ^1.11 || ^1.12
Requires (Dev)
- api-platform/core: ^2.6
- behat/behat: ^3.10
- behat/mink-selenium2-driver: ^1.5
- dmore/behat-chrome-extension: ^1.3
- dmore/chrome-mink-driver: ^2.8
- friends-of-behat/mink: ^1.10
- friends-of-behat/mink-browserkit-driver: ^1.6
- friends-of-behat/mink-debug-extension: ^2.1.0
- friends-of-behat/mink-extension: ^2.6
- friends-of-behat/page-object-extension: ^0.3
- friends-of-behat/suite-settings-extension: ^1.1
- friends-of-behat/symfony-extension: ^2.3
- friends-of-behat/variadic-extension: ^1.4
- friendsofsymfony/oauth-server-bundle: ^1.6 || >2.0.0-alpha.0 ^2.0@dev
- phpspec/phpspec: ^7.1
- phpstan/extension-installer: ^1.1
- phpstan/phpstan: ^1.4
- phpstan/phpstan-doctrine: ^1.2
- phpstan/phpstan-strict-rules: ^1.1
- phpstan/phpstan-webmozart-assert: ^1.0
- phpunit/phpunit: ^9.5
- polishsymfonycommunity/symfony-mocker-container: ^1.0
- sensiolabs/security-checker: ^6.0
- sylius-labs/coding-standard: ^4.2
- symfony/browser-kit: ^5.2 || ^6.0
- symfony/debug-bundle: ^5.2 || ^6.0
- symfony/dotenv: ^5.2 || ^6.0
- symfony/intl: ^5.2 || ^6.0
- symfony/web-profiler-bundle: ^5.2 || ^6.0
- symfony/webpack-encore-bundle: ^1.15
- symplify/easy-coding-standard: ^10.0
- vimeo/psalm: ^5.18
This package is auto-updated.
Last update: 2024-11-29 14:11:02 UTC
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.twig
template yet, copysrc/Resources/views/bundles/SyliusShopBundle/Checkout/Complete/_form.html.twig
file 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.