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

Filters in frontend disappear when you add a sequence to Smile_ElasticsuiteCatalog in a module #886

Closed
Tokipudi opened this issue Apr 20, 2018 · 6 comments

Comments

@Tokipudi
Copy link

Preconditions

Magento Version : EE 2.2.2
ElasticSuite Version : 2.5.8
Environment : Developer

Steps to reproduce

  1. Create a new module
  2. Add a sequence to Smile_ElasticsuiteCatalog

Expected result

The new module works properly

Actual result

The filters in the frontend, on the category page, disappear.

What is causing the issue

It is caused by the fact that Smile_ElasticsuiteCatalog gets loaded before Magento_LayeredNavigationStaging. This is due to the fact that Smile_ElasticsuiteCatalog has a sequence to Magento_LayeredNavigation, instead of Magento_LayeredNavigationStaging.

Smile_ElasticsuiteCatalog has a virtualType that requires Magento_LayeredNavigationStaging to be loaded first for it to work :

<virtualType name="Magento\LayeredNavigationStaging\Block\Navigation\Search" type="Smile\ElasticsuiteCatalog\Block\Navigation">
    <arguments>
        <argument name="filterList" xsi:type="object">searchFilterList</argument>
    </arguments>
</virtualType>

You can find it in frontend/etc/di.xml

How to solve the issue

Simply change the line <module name="Magento_LayeredNavigation" /> in Smile\ElasticsuiteCatalog\etc\module.xml by <module name="Magento_LayeredNavigationStaging" />, so that Magento_LayeredNavigationStaging, which also loads Magento_LayeredNavigation is always loaded before Smile_ElasticsuiteCatalog.

@romainruaud
Copy link
Collaborator

I agree, and we are knowing this one for a while already.

But we cannot add a sequence to Magento_LayeredNavigationStaging because this module is EE exclusive : adding a sequence to it would prevent being able to install Elasticsuite in Magento CE.

For now the solution is to ensure the process module sequence is generated (or generate it by yourself) in the app/etc/config.php file. Since this file should be versioned, once the proper sequence is made, it should be enough.

Regards

@Tokipudi
Copy link
Author

Thank you for your answer. We decided to simply add the sequence needed on every module that needs a sequence towards Smile_ElasticsuiteCatalog

I was also wondering something : is there any example on how to use function scores ? I can't seem to find any in the wiki, nor in the code, even though it seems like you've implemented some classes that handle it.

Basically, I would need to be able to use function scores for something similar to this

Thank you for your time

@afoucret
Copy link
Contributor

Hi @Tokipudi,

I close since you have found a workaround and there is no way for us to prevent this to append.
A good option would be to have optional dependencies in the Magento sequence module.

I will check if it is possible to have propose something to Magento ...

@afoucret
Copy link
Contributor

Reopen since it seems that we can add a non existing module into the module sequence definition without breaking anything. Dependency check is done using composer.

We should be able to add the Magento_LayeredNavigationStaging into the Smile_ElasticsuiteCatalog sequence without breaking community edition.

Note: it is an hack. Maybe Magento will change this behavior one day.

@afoucret
Copy link
Contributor

@Tokipudi you can test PR #893

We will test carefully to check there is no regression with community edition and release with 2.5.9 if everything is OK.

@afoucret
Copy link
Contributor

afoucret commented May 7, 2018

PR have been merged and will be part of the 2.5.9 upcoming maintenance release.

@afoucret afoucret closed this as completed May 7, 2018
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

3 participants