forked from Smile-SA/elasticsuite
-
Notifications
You must be signed in to change notification settings - Fork 0
AutocompleteExtension
Romain Ruaud edited this page Jun 6, 2016
·
2 revisions
Smile ElasticSuite expose a fully extensible framework to add content into the Autocomplete results box.
You can use the standard Magento's Autocomplete DataProvider to add your own data provider.
This can be done by adding an item to the Magento\Search\Model\Autocomplete arguments via DI, like this :
<type name="Magento\Search\Model\Autocomplete">
<arguments>
<argument name="dataProviders" xsi:type="array">
<item name="20" xsi:type="object">Smile\ElasticsuiteCatalog\Model\Autocomplete\Product\DataProvider</item>
</argument>
</arguments>
</type>
This item should implement the Magento\Search\Model\Autocomplete\DataProviderInterface
interface.
You can use the Smile ElasticSuite framework to add your custom renderer.
This can be done by adding an item to the Smile\ElasticsuiteCore\Block\Search\Form\Autocomplete
rendererList
argument via DI, like this :
<type name="Smile\ElasticsuiteCore\Block\Search\Form\Autocomplete">
<arguments>
<argument name="rendererList" xsi:type="array">
<item name="product" xsi:type="array">
<item name="title" xsi:type="string">Products</item>
<item name="template" xsi:type="string">Smile_ElasticsuiteCatalog/autocomplete/product</item>
</item>
</argument>
</arguments>
</type>
The item can have 2 parameters :
Parameter | Required | Description |
---|---|---|
title | No | Title of the box in the autocomplete results. Can be empty. |
template | Yes | The path to the .html template, in a Magento compliant syntax. Eg: Smile_ElasticSuiteCatalog/autocomplete/product will link to Smile_ElasticSuiteCatalog/view/frontend/web/template/autocomplete/product.html |
- User's Guide
- Getting Started
- Fulltext Search Engine
- [Faceting configuration](Faceting configuration)
- Merchandising in categories
- Autocomplete
- Thesaurus
- Releases