This plugin add banners to the Sylius content. The banners are fully customizable by the admin.
Now supporting Sylius 1.4 with Symfony 4 + Flex structure.
You can see this plugin in action in our Sylius Demo application.
- Frontend: sylius-demo.odiseo.com.ar.
- Administration: sylius-demo.odiseo.com.ar/admin with
odiseo: odiseo
credentials.
-
Run
composer require odiseoteam/sylius-banner-plugin
-
Enable the plugin in bundles.php
<?php
return [
// ...
Vich\UploaderBundle\VichUploaderBundle::class => ['all' => true],
Odiseo\SyliusBannerPlugin\OdiseoSyliusBannerPlugin::class => ['all' => true],
// ...
];
- Import the plugin configurations
imports:
- { resource: "@OdiseoSyliusBannerPlugin/Resources/config/config.yml" }
- Add the shop and admin routes
odiseo_sylius_banner_admin:
resource: "@OdiseoSyliusBannerPlugin/Resources/config/routing/admin.yml"
prefix: /admin
odiseo_sylius_banner_shop:
resource: "@OdiseoSyliusBannerPlugin/Resources/config/routing/shop.yml"
prefix: /{_locale}/banner
requirements:
_locale: ^[a-z]{2}(?:_[A-Z]{2})?$
-
Create banner folder: run
mkdir public/media/banner-image -p
and insert a .gitkeep file in that folder -
Finish the installation updating the database schema and installing assets
php bin/console doctrine:schema:update --force
php bin/console sylius:theme:assets:install
For the administration you will have the Banner menu. And for the frontend you can go to the /{locale}/banner to see the banner images. Feel free to modify the plugin templates like you want.
You need to include in your layout:
{% include '@SyliusUi/_stylesheets.html.twig' with {'path': 'bundles/odiseosyliusbannerplugin/css/slider-pro.min.css'} %}
{% include '@SyliusUi/_javascripts.html.twig' with {'path': 'bundles/odiseosyliusbannerplugin/js/jquery.sliderPro.min.js'} %}
{% include '@SyliusUi/_javascripts.html.twig' with {'path': 'bundles/odiseosyliusbannerplugin/js/app.js'} %}
To render banner images you can do something like this:
{{ render(url('odiseo_sylius_banner_shop_partial_banner_index', {'template': '@OdiseoSyliusBannerPlugin/Shop/Banner/index.html.twig'})) }}
And to render banner images by taxon:
{{ render(url('odiseo_sylius_banner_shop_partial_banner_index_by_taxon', {'taxon': taxon.slug, 'template': '@OdiseoSyliusBannerPlugin/Shop/Banner/index.html.twig'})) }}
This plugin comes with fixtures:
Simply add this configuration on your fixture suite:
banner:
options:
banners_per_channel: 12
You can follow the instructions to test this plugins in the proper documentation page: Test the plugin.
This plugin is maintained by Odiseo. Want us to help you with this plugin or any Sylius project? Contact us on [email protected].