Skip to content

Latest commit

 

History

History
executable file
·
136 lines (98 loc) · 4.53 KB

README.md

File metadata and controls

executable file
·
136 lines (98 loc) · 4.53 KB

Odiseo
Odiseo Sylius Banner Plugin

Description

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.

Banners admin

Demo

You can see this plugin in action in our Sylius Demo application.

Installation

  1. Run composer require odiseoteam/sylius-banner-plugin

  2. Enable the plugin in bundles.php

<?php

return [
    // ...
    Vich\UploaderBundle\VichUploaderBundle::class => ['all' => true],
    Odiseo\SyliusBannerPlugin\OdiseoSyliusBannerPlugin::class => ['all' => true],
    // ...
];
  1. Import the plugin configurations
imports:
    - { resource: "@OdiseoSyliusBannerPlugin/Resources/config/config.yml" }
  1. 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})?$
  1. Create banner folder: run mkdir public/media/banner-image -p and insert a .gitkeep file in that folder

  2. Finish the installation updating the database schema and installing assets

php bin/console doctrine:schema:update --force
php bin/console sylius:theme:assets:install

Usage

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'} %}

Partial routes

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'})) }}

Fixtures

This plugin comes with fixtures:

Banners

Simply add this configuration on your fixture suite:

banner:
    options:
        banners_per_channel: 12

Test the plugin

You can follow the instructions to test this plugins in the proper documentation page: Test the plugin.

Credits

This plugin is maintained by Odiseo. Want us to help you with this plugin or any Sylius project? Contact us on [email protected].