monsieurbiz / sylius-advanced-option-plugin
This plugins improves the Product Options.
Installs: 6 209
Dependents: 0
Suggesters: 0
Security: 0
Stars: 4
Watchers: 7
Forks: 5
Open Issues: 1
Type:sylius-plugin
Requires
- php: ~7.4
- sylius/sylius: ~1.8.0 || ~1.9.0
Requires (Dev)
- behat/behat: ^3.7
- behat/mink-selenium2-driver: ^1.4
- dmore/behat-chrome-extension: ^1.3
- dmore/chrome-mink-driver: ^2.7
- friends-of-behat/mink: ^1.8
- friends-of-behat/mink-browserkit-driver: ^1.4
- friends-of-behat/mink-debug-extension: ^2.0
- friends-of-behat/mink-extension: ^2.4
- friends-of-behat/page-object-extension: ^0.3
- friends-of-behat/suite-settings-extension: ^1.0
- friends-of-behat/symfony-extension: ^2.1
- friends-of-behat/variadic-extension: ^1.3
- friendsofsymfony/oauth-server-bundle: >2.0.0-alpha.0 ^2.0@dev
- lchrusciel/api-test-case: ^5.0
- phpmd/phpmd: @stable
- phpspec/phpspec: ^7.0
- phpstan/extension-installer: ^1.0
- phpstan/phpstan: 0.12.93
- phpstan/phpstan-doctrine: 0.12.41
- phpstan/phpstan-webmozart-assert: 0.12.15
- phpunit/phpunit: ^8.5
- stripe/stripe-php: ^6.43
- sylius-labs/coding-standard: ^3.2
- symfony/browser-kit: ^4.4 || ^5.2
- symfony/debug-bundle: ^4.4 || ^5.2
- symfony/dotenv: ^4.4 || ^5.2
- symfony/flex: ^1.11
- symfony/intl: ^4.4 || ^5.2
- symfony/web-profiler-bundle: ^4.4 || ^5.2
- symplify/easy-coding-standard: ^8.3
This package is auto-updated.
Last update: 2024-03-30 00:26:13 UTC
README
Advanced Option
This plugins improves the Options in Sylius. It adds the possibility to select a renderer and to add images to the option's values.
Installation
composer require monsieurbiz/sylius-advanced-option-plugin
Change your config/bundles.php
file to add this line for the plugin declaration:
<?php return [ //.. MonsieurBiz\SyliusAdvancedOptionPlugin\MonsieurBizSyliusAdvancedOptionPlugin::class => ['all' => true], ];
Then create the config file in config/packages/monsieurbiz_sylius_advanced_option_plugin.yaml
:
imports: - { resource: "@MonsieurBizSyliusAdvancedOptionPlugin/Resources/config/config.yaml" }
And create the route file in config/routes/monsieurbiz_sylius_advanced_option_plugin.yaml
:
monsieurbiz_advanced_option_admin: resource: "@MonsieurBizSyliusAdvancedOptionPlugin/Resources/config/routing/admin.yaml" prefix: /%sylius_admin.path_name%
Copy the templates we override:
cp -Rv vendor/monsieurbiz/sylius-advanced-option-plugin/src/Resources/templates/* templates/
Your ProductOption entity needs to implement the RenderedOptionInterface
interface and use the MonsieurBiz\SyliusAdvancedOptionPlugin\Entity\ProductOption\RenderedOptionTrait
trait. As in our test application: ProductOption.
Your ProductOptionValue entity needs to implement the RenderedOptionValueInterface
interface and use the MonsieurBiz\SyliusAdvancedOptionPlugin\Entity\ProductOption\RenderedOptionValueTrait
trait. As in our test application: ProductOption.
Migrations
Migrations are taken care of by Doctrine 3.
You should just run them:
bin/console doctrine:migrations:migrate
Template override
If you have already replaced the templates/bundles/SyliusShopBundle/Product/Show/_options.html.twig
template in your theme, modify the content to use the twig functions:
- monsieurbiz_advancedoption_has_renderer
- monsieurbiz_advancedoption_form_row
Read the default override to get inspiration from its content: _options.html.twig.
Sponsors
- EasyMonneret
Contributing
You can open an issue or a Pull Request if you want! 😘
Thank you!