monsieurbiz / sylius-advanced-option-plugin
This plugins improves the Product Options.
Installs: 7 274
Dependents: 0
Suggesters: 0
Security: 0
Stars: 5
Watchers: 7
Forks: 5
Open Issues: 4
Type:sylius-plugin
Requires
- php: ^8.0
- sylius/sylius: >=1.11 <1.14
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.16
- phpmd/phpmd: ^2.15
- phpspec/phpspec: ^7.0
- phpstan/phpstan: ^1.8.4
- phpstan/phpstan-doctrine: ^1.3.2
- phpstan/phpstan-webmozart-assert: ^1.1
- phpunit/phpunit: ^10.5
This package is auto-updated.
Last update: 2025-01-04 07:43:30 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.
Compatibility
Installation
If you want to use our recipes, you can configure your composer.json by running:
composer config --no-plugins --json extra.symfony.endpoint '["https://api.github.com/repos/monsieurbiz/symfony-recipes/contents/index.json?ref=flex/master","flex://defaults"]'
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!