Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Using this module with a custom theme does not display autocomplete as expected #79

Closed
phronesis opened this issue Jul 11, 2016 · 6 comments

Comments

@phronesis
Copy link

This module works perfectly with Magento Custom Luma theme. However for a custom theme, the structure of autocomplete differs from what is obtainable with the Luma theme. I have removed the custom theme's implementation of Search but I can see that it picks the Magento's Default implementation of item.phtml which uses <li> tags.
Any suggestions as to extra steps to take to make a custom theme display Autocomplete like Luma does?

@afoucret
Copy link
Contributor

Hi @phronesis,

We are not using the standard autocomplete template since we have to render several area into the autocomplete (popular terms, products, ...). The standard template does not have such an option.

As a result, we ship our own template into the module module-elasticsuite-core/view/frontend/web/template/autocomplete/term.html. Here is the related layout :

    <body>
        <referenceContainer name="header-wrapper">
            <block class="Smile\ElasticsuiteCore\Block\Search\Form\Autocomplete" name="top.search" as="topSearch" template="Smile_ElasticsuiteCore::search/form.mini.phtml"/>
        </referenceContainer>
    </body>

As you can see it override the standard search module search form. Overriding this into a custom theme should be done into a custom Smile_ElasticsuiteCoredirectory in your template.

If it is ok for you I will close this one as it is more a support than a real bug. Feel free to ask me to reopen if you think there is a bug here.

@phronesis
Copy link
Author

Ok Thanks. I had done that, but it was not working. I realised in the custom theme we were using, there was a layout defining that set the Block to Magento's default search. When I took that out, it worked as expected. Thanks for an excellent extension. Our site search is now fast and behaves as expected.

@afoucret
Copy link
Contributor

Very happy to see you have found how to fix the problem and very glad that the module fits with your expectations.

Don't hesitate to contribute and to promote it around you. We are trying to get the widest community we can.

BR,

@acidreian666
Copy link

@afoucret Can you please provide full details on overriding the standard search module search form & how to have it done using a custom Smile_ElasticsuiteCoredirectory in your template.

@phronesis David Can you possibly explain the steps used to fix your autocomplete with a custom theme. The theme I'm using is the Porto Theme. I been struggling to track down how there theme is defining the Default set block and how to make it point to the elasticsuite autocomeplete.

Sorry for opening up a closed topic that's 29 days old but i think this information could be good to be added to the Wiki for users like my self with limited knowledge of Magento 2 theme development.

@phronesis
Copy link
Author

Within My theme folder, at the same level with folders like Magento_Catalog, Magento_Customer, Magento_Checkout, etc. I created a folder with the name: Smile_ElasticsuiteCore and within the folder, created the following subfolder: templates/search and copied the file form.mini.phtml from smile/elasticsuite/src/module-elasticsuite-core/view/frontend/templates/search/form.mini.phtml to the search folder.
For Yours, Within the copied file, check your theme file for that same file and check for changes your theme made to that file and include them in the Smile_ElasticsuiteCore/templates/search/form.mini.phtml file.
Clear your cache and check if changes reflect.
If you do not see changes, then it would mean that within your theme, there's a layout entry for search that points elsewhere, so do a search within your theme layout files for the text "top.search".
For mine, when i removed the block entry from my theme layout file, the changes where picked up. You will have to test that there are no side effects of doing that.
@afoucret I hope that helps.

@asmitarane
Copy link

Can we use smile elasticsuite extesnion with custom search form in magento 2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants