-
Notifications
You must be signed in to change notification settings - Fork 341
AutocompleteExtension
Romain Ruaud edited this page Jul 10, 2017
·
3 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 layout, like this :
<referenceContainer name="header-wrapper">
<block class="Smile\ElasticsuiteCore\Block\Search\Form\Autocomplete" name="top.search" as="topSearch" template="Smile_ElasticsuiteCore::search/form.mini.phtml">
<arguments>
<argument name="rendererList" xsi:type="array">
<item name="term" xsi:type="array">
<item name="title" xsi:type="string" translate="true">Search terms</item>
<item name="template" xsi:type="string">Smile_ElasticsuiteCore/autocomplete/term</item>
</item>
</argument>
</arguments>
</block>
</referenceContainer>
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
-
Developer's Guide
-
Releases
- Magento 2.3.x
- Magento 2.2.x
- Magento 2.1.x
- ElasticSuite 2.5.15
- ElasticSuite 2.5.14
- ElasticSuite 2.5.13
- ElasticSuite 2.5.12
- ElasticSuite 2.5.11
- ElasticSuite 2.5.10
- ElasticSuite 2.5.9
- ElasticSuite 2.5.8
- ElasticSuite 2.5.7
- ElasticSuite 2.5.6
- ElasticSuite 2.5.5
- ElasticSuite 2.5.4
- ElasticSuite 2.5.3
- ElasticSuite 2.5.2
- ElasticSuite 2.5.1
- ElasticSuite 2.5.0
- ElasticSuite 2.4.6
- ElasticSuite 2.4.5
- ElasticSuite 2.4.4
- ElasticSuite 2.4.3
- ElasticSuite 2.4.2
- ElasticSuite 2.4.1
- ElasticSuite 2.4.0
- ElasticSuite 2.3.10
- ElasticSuite 2.3.9
- ElasticSuite 2.3.8
- ElasticSuite 2.3.7
- ElasticSuite 2.3.6
- ElasticSuite 2.3.5
- ElasticSuite 2.3.4
- ElasticSuite 2.3.3
- ElasticSuite 2.3.2
- ElasticSuite 2.3.1
- ElasticSuite 2.3.0
- Magento 2.0.x