vaachar/sylius-featured-products-plugin

Plugin to configure products that should be featured in a channel.


README

Sylius Featured Products Plugin

Plugin to configure products that should be featured in a channel.

Quickstart Installation

  1. Require plugin via Composer
composer require vaachar/sylius-featured-products-plugin
  1. Inlcude config.yaml in _sylius.yaml
- { resource: "@SyliusFeaturedProductsPlugin/Resources/config/config.yaml" }
  1. Use trait and add interface to src/Entity/Product/Product.php
class Product extends BaseProduct implements HasFeaturedProductInterface
{
    use FeaturedProductTrait;

    ...
}
  1. Execute migrations
bin/console doctrine:migrations:migrate
  1. Use twig macro to add featured products to a page
{{ sylius_render_featured_products() }}

Example:

<h2 class="ui huge horizontal section divider inverted header">{{ 'sylius_featured_products_plugin.ui.featured_products'|trans }}</h2>

<div {{ sylius_test_html_attribute('featured-products') }}>
    {{ sylius_render_featured_products() }}
</div>
<div class="ui hidden divider"></div>