{"id":25278232,"url":"https://github.com/asdoria/asdoriasyliusfacetfilterplugin","last_synced_at":"2025-10-27T15:30:24.967Z","repository":{"id":37776952,"uuid":"498635182","full_name":"asdoria/AsdoriaSyliusFacetFilterPlugin","owner":"asdoria","description":"This plugin allows to to link facets to specific resources in your Sylius Shop","archived":false,"fork":false,"pushed_at":"2023-01-03T14:11:44.000Z","size":11931,"stargazers_count":11,"open_issues_count":2,"forks_count":10,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-02-12T11:07:23.998Z","etag":null,"topics":["ecommerce","faceted-search","php","sylius","sylius-plugin"],"latest_commit_sha":null,"homepage":null,"language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/asdoria.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-06-01T07:31:18.000Z","updated_at":"2024-11-29T13:32:47.000Z","dependencies_parsed_at":"2023-02-01T06:31:18.485Z","dependency_job_id":null,"html_url":"https://github.com/asdoria/AsdoriaSyliusFacetFilterPlugin","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asdoria%2FAsdoriaSyliusFacetFilterPlugin","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asdoria%2FAsdoriaSyliusFacetFilterPlugin/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asdoria%2FAsdoriaSyliusFacetFilterPlugin/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/asdoria%2FAsdoriaSyliusFacetFilterPlugin/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/asdoria","download_url":"https://codeload.github.com/asdoria/AsdoriaSyliusFacetFilterPlugin/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":238514896,"owners_count":19485111,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ecommerce","faceted-search","php","sylius","sylius-plugin"],"created_at":"2025-02-12T17:23:08.840Z","updated_at":"2025-10-27T15:30:23.271Z","avatar_url":"https://github.com/asdoria.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n\u003c/p\u003e\n\n![Asdoria Lgoo](doc/asdoria.jpg)\n\n\u003ch1 align=\"center\"\u003eAsdoria Facet Filter Bundle\u003c/h1\u003e\n\n\u003cp align=\"center\"\u003e\nThis plugin allows to to link facets to specific resources in your Sylius Shop\n\nSylius 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).\nThis may be a problem when/if you wish to let the user filter your catalog by using these facets.\nOur 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\n\n[//]: # (Sylius a une notion d'attributs de produits, d'options de produits et autres.)\n\n[//]: # (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.)\n\n[//]: # (Cela peut être un problème si/quand vous voulez permettre aux visiteurs de filtrer le catalogue de produits en utilisant ces facettes. )\n\n[//]: # (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.)\n\u003c/p\u003e\n\n## Features\n\n+ Create groups of facets\n+ Create customizable facet filters tied to specific products' characteristics\n+ Easily create facet collections\n+ Attach the facet filters to your taxons or other resources\n\n\u003cdiv style=\"max-width: 75%; height: auto; margin: auto\"\u003e\n\n![Example of a product's facets customization](doc/plugin_demo.gif)\n\n\u003c/div\u003e\n\n## Installation\n\n---\n1. run `composer require asdoria/sylius-facet-filter-plugin`\n\n\n2. Add the bundle in `config/bundles.php`. You must put it ABOVE `SyliusGridBundle`\n\n```php\nAsdoria\\SyliusFacetFilterPlugin\\AsdoriaSyliusFacetFilterPlugin::class =\u003e ['all' =\u003e true],\n[...]\nSylius\\Bundle\\GridBundle\\SyliusGridBundle::class =\u003e ['all' =\u003e true],\n```\n\n3. Import routes in `config/routes.yaml`\n\n```yaml\nasdoria_facet_filter:\n    resource: \"@AsdoriaSyliusFacetFilterPlugin/Resources/config/routing.yaml\"\n    prefix: /admin\n```\n\n\n4. 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\n```yaml\nsylius_grid:\n    grids:\n        sylius_shop_product:\n            filters:\n                facets_filters:\n                    type: facets_filters\n                    label: false\n                    options:\n                        owner: taxon\n #                      filterBy: owner | funnel\n # this option \"filterBy\" is optional but if you specify funnel, the different filters will be filled with the rest of the filtered products.\n # this option \"filterBy\" is optional but if you specify owner, the different filters will be filled with the list of attributes of the category.\n # This option \"filterBy\" is optional but if you don't specify it, the different filters will be filled with the list of attributes of all shops.\n```\n\n5. Import the plugin's config and add new config for `sylius.shop.product.index.search` event in `config/packages/_sylius.yaml`\n```yaml\nimports:\n    - { resource: \"@AsdoriaSyliusFacetFilterPlugin/Resources/config/config.yaml\"}\n...\nsylius_ui:\n    events:\n        sylius.shop.product.index.search:\n            blocks:\n                search:\n                    template: \"@SyliusUi/Block/_legacySonataEvent.html.twig\"\n                    priority: 30\n                    context:\n                        event: sylius.shop.product.index.disabled_search\n```\n\n6. Implement the Facet Interface and Trait in your Taxon Entity `App/Entity/Taxonomy/Taxon.php`.\n\n```php\n// ...\n\nuse Asdoria\\SyliusFacetFilterPlugin\\Model\\Aware\\FacetFilterCodeAwareInterface;\nuse Asdoria\\SyliusFacetFilterPlugin\\Traits\\FacetFilterCodeTrait;\nuse Doctrine\\ORM\\Mapping as ORM;\nuse Sylius\\Component\\Core\\Model\\Taxon as BaseTaxon;\nuse Sylius\\Component\\Taxonomy\\Model\\TaxonTranslationInterface;\n\n/**\n * @ORM\\Entity\n * @ORM\\Table(name=\"sylius_taxon\")\n */\nclass Taxon extends BaseTaxon implements FacetFilterCodeAwareInterface\n{\n    use FacetFilterCodeTrait;\n\n    protected function createTranslation(): TaxonTranslationInterface\n    {\n        return new TaxonTranslation();\n    }\n}\n```\n7. Override or create if not already existing the Taxon Form template in `templates/bundles/SyliusAdminBundle/Taxon/_form.html.twig`.\n\n```twig\n\n{% from '@SyliusAdmin/Macro/translationForm.html.twig' import translationFormWithSlug %}\n\n\u003cdiv class=\"ui segment\"\u003e\n    {{ form_errors(form) }}\n    \u003cdiv class=\"three fields\"\u003e\n        {{ form_row(form.code) }}\n        {{ form_row(form.parent) }}\n        {{ form_row(form.facetFilterCode) }}\n    \u003c/div\u003e\n    \u003cdiv class=\"fields\"\u003e\n        {{ form_row(form.enabled) }}\n    \u003c/div\u003e\n\u003c/div\u003e\n{{ translationFormWithSlug(form.translations, '@SyliusAdmin/Taxon/_slugField.html.twig', taxon) }}\n\n{% include '@SyliusAdmin/Taxon/_media.html.twig' %}\n\n```\n8. Override or create if not already existing the Product Index template in `templates/bundles/SyliusShopBundle/Product/index.html.twig`\n```twig\n{% extends '@SyliusShop/layout.html.twig' %}\n\n{% block content %}\n{% include '@SyliusShop/Product/Index/_header.html.twig' %}\n\u003cdiv class=\"ui stackable grid\"\u003e\n    \u003cdiv class=\"four wide column\"\u003e\n        {% include '@SyliusShop/Product/Index/_sidebar.html.twig' %}\n        \u003cdiv class=\"ui fluid vertical menu\"\u003e\u003c/div\u003e\n        \u003cdiv class=\"ui fluid vertical menu\"\u003e\u003c/div\u003e\n        {% include '@SyliusShop/Product/Index/_search.html.twig' %}\n    \u003c/div\u003e\n    \u003cdiv class=\"twelve wide column\"\u003e\n        {% include '@SyliusShop/Product/Index/_main.html.twig' %}\n    \u003c/div\u003e\n\u003c/div\u003e\n{% endblock %}\n```\n\n9. run `php bin/console do:mi:mi` to update the database schema\n\n10. Finally, add translations to `config/packages/translation.yaml` :\n```\nframework:\n    default_locale: '%locale%'\n    translator:\n        paths:\n            - '%kernel.project_dir%/translations'\n        fallbacks:\n            - '%locale%'\n            - 'en'\n```\n\n## Demo\n\nYou can see the result for the user here with caps: [here](https://demo-sylius.asdoria.fr/en_US/taxons/category/caps). \u003cbr\u003e\nIf you want to try to create filters, go on [the admin authentication page](https://demo-sylius.asdoria.fr/admin/) and connect with:\n\u003e **Login:** asdoria \u003cbr\u003e\n\u003e **Password:** asdoria\n\nThen go on [facet filters page in back office](https://demo-sylius.asdoria.fr/admin/facet-filters/).\n\nNote that we have developed several other open source plugins for Sylius, whose demos and documentation are listed on the [following page](https://asdoria.github.io/).\n\n## Usage\n\n1. In the back office, inside the `Configuration` section, go to `Facet Filters`.\n\n2. Click on `Edit Groups` and `Create` 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.\n\n3. 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.\n\n4. Return to the `Facet Filter` page, and click `Create` 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.\n\n5. The interesting part begin here. Go on `Facet Filters` page, and click on `Edit facets` associated to your new filter. Several choices are available, let select `Create an attribute facet`. \n\n\u003cdiv style=\"max-width: 75%; height: auto; margin: auto\"\u003e\n\n![Edit facts](doc/editfacets.png)\n\n\u003c/div\u003e\n\nYou can now fill the form with some cool things such as:\n+ attribute to filter\n+ segment, which represent the filter's group.\nObviously, you can change the facet's name for each language to adapt your content by country.\n\n6. 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.\n\n\u003cdiv style=\"max-width: 75%; height: auto; margin: auto\"\u003e\n\n![Taxon interface](doc/taxon.png)\n\n\u003c/div\u003e\n\nYou can choose the facet filter to be used on your products.\n\n\u003cdiv style=\"max-width: 75%; height: auto; margin: auto\"\u003e\n\n![Taxon interface](doc/facetfiltertaxon.png)\n\n\u003c/div\u003e\n\n7. Finally, see the results on the user side of your shop!\n\u003cdiv style=\"max-width: 75%; height: auto; margin: auto\"\u003e\n\n![Facet filter on taxon page](doc/shop_facet_filter_results.png)\n\n\u003c/div\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasdoria%2Fasdoriasyliusfacetfilterplugin","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fasdoria%2Fasdoriasyliusfacetfilterplugin","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fasdoria%2Fasdoriasyliusfacetfilterplugin/lists"}