Download the PHP package asdoria/sylius-facet-filter-plugin without Composer
On this page you can find all versions of the php package asdoria/sylius-facet-filter-plugin. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download asdoria/sylius-facet-filter-plugin
More information about asdoria/sylius-facet-filter-plugin
Files in asdoria/sylius-facet-filter-plugin
Package sylius-facet-filter-plugin
Short Description A Simply Facet filter plugin for Sylius
License MIT
Informations about the package sylius-facet-filter-plugin
Asdoria Facet Filter Bundle
This plugin allows to to link facets to specific resources in your Sylius Shop Sylius offers a system of products' attribute, options and some more. However, there's no native way to only use them on product from specific taxons(categories). This may be a problem when/if you wish to let the user filter your catalog by using these facets. Our plugin allows you to link specific attributes, options and other facets to specific taxons. This way, you can easily decide which filters to display and where [//]: # (Sylius a une notion d'attributs de produits, d'options de produits et autres.) [//]: # (Cependant, il n'y a pas de moyen intégré pour rendre ces attributs, options, taxons uniquement pertinents pour les produits dans des catégories spécifiques.) [//]: # (Cela peut être un problème si/quand vous voulez permettre aux visiteurs de filtrer le catalogue de produits en utilisant ces facettes. ) [//]: # (Ce plugin permet de lier des attributs spécifiques, des options et d'autres facettes à des taxons u autre ressoures, ce qui vous permet de décider plus facilement quels filtres afficher à quel endroit.)
Features
- Create groups of facets
- Create customizable facet filters tied to specific products' characteristics
- Easily create facet collections
- Attach the facet filters to your taxons or other resources
Installation
-
run
composer require asdoria/sylius-facet-filter-plugin
-
Add the bundle in
config/bundles.php
. You must put it ABOVESyliusGridBundle
-
Import routes in
config/routes.yaml
-
add the facets_filters filter into you grid config exemple for in
config/packages/grids/sylius_shop_product.yaml
but is already configure into the bundle for this grid -
Import the plugin's config and add new config for
sylius.shop.product.index.search
event inconfig/packages/_sylius.yaml
-
Implement the Facet Interface and Trait in your Taxon Entity
App/Entity/Taxonomy/Taxon.php
. -
Override or create if not already existing the Taxon Form template in
templates/bundles/SyliusAdminBundle/Taxon/_form.html.twig
. -
Override or create if not already existing the Product Index template in
templates/bundles/SyliusShopBundle/Product/index.html.twig
-
run
php bin/console do:mi:mi
to update the database schema - Finally, add translations to
config/packages/translation.yaml
:
Demo
You can see the result for the user here with caps: here.
If you want to try to create filters, go on the admin authentication page and connect with:
Login: asdoria
Password: asdoria
Then go on facet filters page in back office.
Note that we have developed several other open source plugins for Sylius, whose demos and documentation are listed on the following page.
Usage
-
In the back office, inside the
Configuration
section, go toFacet Filters
. -
Click on
Edit Groups
andCreate
buttons and create a new one. Fill the fields with a code that will identify your facet group. Of course, this will not be the name on the user side: you can specify a name in each language below in the form. Groups will help you organize your filters and group them when displaying on your site. -
Once back on the previous page, click on
Configure children
linked to your new facet group. Fill the form in the same way as previously. -
Return to the
Facet Filter
page, and clickCreate
to initialize Filters targetting a specific Taxon. Inside the Code input, enter the code of a taxon you wish to create a filter for. This code can be found in the taxon's edit page at{your-domain}/admin/taxons/{id}/edit
under Slug. - The interesting part begin here. Go on
Facet Filters
page, and click onEdit facets
associated to your new filter. Several choices are available, let selectCreate an attribute facet
.
You can now fill the form with some cool things such as:
- attribute to filter
- segment, which represent the filter's group. Obviously, you can change the facet's name for each language to adapt your content by country.
- Go on the "Taxons" admin page and click on the three grey dots next to each other linked to the category of products you want to filter. Then, click on "Edit" button.
You can choose the facet filter to be used on your products.
- Finally, see the results on the user side of your shop!