2

I ran this module on my website: https://github.com/Smile-SA/elasticsuite

Everything seems to be working fine. But I have a problem with the configuration.

When I start search, gets the result but only the product names: enter image description here

How to display here also additional attributes, like product image, price, add to the basket etc?

@update

I put file in: app/design/frontend/Sm/Market/Magento_Search/layout/default.xml

<body>
    <referenceContainer name="Sm_Market">
        <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>
    <referenceBlock name="top.search">
        <arguments>
            <argument name="rendererList" xsi:type="array">
                <item name="product" xsi:type="array">
                    <item name="title" xsi:type="string" translate="true">Products</item>
                    <item name="template" xsi:type="string">Smile_ElasticsuiteCatalog/autocomplete/product</item>
                </item>
                <item name="category" xsi:type="array">
                    <item name="title" xsi:type="string" translate="true">Categories</item>
                    <item name="template" xsi:type="string">Smile_ElasticsuiteCatalog/autocomplete/category</item>
                </item>
                <item name="product_attribute" xsi:type="array">
                    <item name="title" xsi:type="string" translate="true">Attributes</item>
                    <item name="template" xsi:type="string">Smile_ElasticsuiteCore/autocomplete/term</item>
                    <item name="titleRenderer" xsi:type="string">Smile_ElasticsuiteCatalog/js/autocomplete/product-attribute</item>
                </item>
            </argument>
        </arguments>
    </referenceBlock>        
</body>
3

If you are using a custom theme you may need to ensure that the layout in your theme is rendering the ElasticSuite blocks for search and not the defaults.

You need to check Magento_Search/layout/default.xml in your theme and replace blocks referring to search changing "mytheme" to the reference containernames in your existing theme xml.

<body>
    <referenceContainer name="mytheme_header">
        <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>
    <referenceBlock name="top.search">
        <arguments>
            <argument name="rendererList" xsi:type="array">
                <item name="product" xsi:type="array">
                    <item name="title" xsi:type="string" translate="true">Products</item>
                    <item name="template" xsi:type="string">Smile_ElasticsuiteCatalog/autocomplete/product</item>
                </item>
                <item name="category" xsi:type="array">
                    <item name="title" xsi:type="string" translate="true">Categories</item>
                    <item name="template" xsi:type="string">Smile_ElasticsuiteCatalog/autocomplete/category</item>
                </item>
                <item name="product_attribute" xsi:type="array">
                    <item name="title" xsi:type="string" translate="true">Attributes</item>
                    <item name="template" xsi:type="string">Smile_ElasticsuiteCore/autocomplete/term</item>
                    <item name="titleRenderer" xsi:type="string">Smile_ElasticsuiteCatalog/js/autocomplete/product-attribute</item>
                </item>
            </argument>
        </arguments>
    </referenceBlock>        
</body>

This will load the correct js and css for the ElasticSuite search form and auto complete.

5
  • Thank you for your help. I check file: app/code/frontend/Sm/Market/Magento_Search/ and also is available custom search: app/code/frontend/Sm/Market/Sm_Searchbox/layout/default.xml Can you tell me where to paste this code? Also, can you explain me more where I can get name="mytheme_header
    – Sylvester
    Nov 18 '20 at 10:21
  • when i added this code then the search engine automatically hides and doesn't work. Can we exchange a few words by email?
    – Sylvester
    Nov 18 '20 at 11:12
  • If you have a module also applying search layout changes that might be more complex. What is the search module doing? Perhaps you should try disabling these modules and testing search first - then look at what changes you need to make to override the modules.
    – paj
    Nov 18 '20 at 12:44
  • Can you please confirm that I added a correct <referenceContainer name="Sm_Market"> ? If yes, It will try to debug and disable other search modules.
    – Sylvester
    Nov 18 '20 at 13:01
  • I can't confirm that without seeing the xml, if you google this issue you will find other resources that should also help you resolve the problem with your setup.
    – paj
    Nov 18 '20 at 14:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.