PHP code example of sylius / search-bundle

1. Go to this page and download the library: Download sylius/search-bundle library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

sylius / search-bundle example snippets


{% render controller('SyliusSearchBundle:Search:form', {'request':app.request}) %}

{% 

$finder = $this->get('sylius_search.finder')
            ->setTargetIndex('product') // target index searches in a specific type, if it's not set it searches in all types
            ->setFacetGroup('search_set') // configuration based, uses the relevant facet set, if not set it does not show facets
            ->find(new SearchStringQuery(...));

$finder = $this->get('sylius_search.finder')
            ->setFacetGroup('categories_set')
            ->find(new TaxonQuery(...));