A Sylius plugin to enable the association of brands to your products
Switch branches/tags
Nothing to show
Clone or download
loevgaard Merge pull request #18 from nicoplh/patch-1
Update AdminMenuListener.php
Latest commit 37ef2b1 Nov 22, 2018


Sylius Brand Plugin

Latest Version on Packagist Software License Build Status Quality Score

If you want to add a brand to your products this is the plugin to use. Use cases:

  • Add brand logo to your product pages
  • Filter by brand in the frontend or backend, i.e. product lists


Step 1: Download the plugin

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

$ composer require loevgaard/sylius-brand-plugin

This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.

Step 2: Enable the plugin

Then, enable the plugin by adding it to the list of registered plugins/bundles in config/bundles.php file of your project:


return [
    // ...
    Loevgaard\SyliusBrandPlugin\LoevgaardSyliusBrandPlugin::class => ['all' => true],
    // ...

Step 3: Configure the plugin

# config/services.yml

    # ...
    - { resource: "@LoevgaardSyliusBrandPlugin/Resources/config/config.yml" }
# config/routing.yml

    resource: "@LoevgaardSyliusBrandPlugin/Resources/config/routing.yml"
# config/doctrine/Product.orm.yml

    type: entity
    table: sylius_product
            targetEntity: Loevgaard\SyliusBrandPlugin\Entity\Brand
                name: brand_id
                referencedColumnName: id

Step 4: Import product trait

// src/Entity/Product.php


namespace AppBundle\Entity;

use Loevgaard\SyliusBrandPlugin\Entity\BrandAwareInterface;
use Loevgaard\SyliusBrandPlugin\Entity\ProductTrait;
use Sylius\Component\Core\Model\Product as BaseProduct;

class Product extends BaseProduct implements BrandAwareInterface
    use ProductTrait;
    // ...

NOTE: If you haven't extended the Product entity yet, follow the customization instructions first because you need to add a bit more configuration.

Step 5: Update your database schema

$ php bin/console doctrine:schema:update --force

or use Doctrine Migrations.

Step 6: Add form widget to twig template

You need to override the template displaying the product form and add a form_row statement with the brand. In the example below I have added it below the channels widget.

{# app/Resources/SyliusAdminBundle/views/Product/Tab/_details.html.twig #}

{# ... #}

<div class="column">
    {{ form_row(form.channels) }}

    {{ form_row(form.brand) }} {# This is the part you should add #}

{# ... #}

If you haven't overridden the template yet, you can just copy the template from vendor/loevgaard/sylius-brand-plugin/src/Resources/views/SyliusAdminBundle to app/Resources/SyliusAdminBundle/views/

Installation and usage for plugin development

Find more information here

Contribute by translating

We use the same service as Sylius for translating, namely Crowdin. You can help out by translating this project into your mother tongue ;)