vaachar/sylius-featured-products-plugin

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


README

68747470733a2f2f64656d6f2e73796c6975732e636f6d2f6173736574732f73686f702f696d672f6c6f676f2e706e67

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>