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

Getting error with Admin category and all products in each category #1345

Closed
shrinet opened this issue Mar 7, 2019 · 9 comments
Closed

Getting error with Admin category and all products in each category #1345

shrinet opened this issue Mar 7, 2019 · 9 comments

Comments

@shrinet
Copy link

shrinet commented Mar 7, 2019

Hello,
I am getting this errors on admin side as well as frontend, Admin side Category editing page not opening due to error and on frontend every product shows in every category.

my environment is

Preconditions

Magento Version : 2.2.7 CE
ElasticSearch Version: 5.6.15
ElasticSuite Version : 2.6.0
Environment : Production

Steps to reproduce

  1. composer require smile/elasticsuite ~2.6.0

  2. bin/magento module:enable Smile_ElasticsuiteCore Smile_ElasticsuiteCatalog Smile_ElasticsuiteSwatches Smile_ElasticsuiteCatalogRule Smile_ElasticsuiteVirtualCategory Smile_ElasticsuiteThesaurus Smile_ElasticsuiteCatalogOptimizer Smile_ElasticsuiteTracker

  3. Setup config values.

  4. Reindex everything

Expected result

  1. Category editor should be shown.
  2. Products should be shown in respective categories.

Actual result

category_error

Stack Trace:
`[06-Mar-2019 22:11:12 UTC] PHP Fatal error: Uncaught Error: Call to a member function getCategorySearchQuery() on null in /vendor/smile/elasticsuite/src/module-elasticsuite-virtual-category/Model/Preview.php:105
Stack trace:

#0 /vendor/smile/elasticsuite/src/module-elasticsuite-virtual-category/Model/Preview.php(75): Smile\ElasticsuiteVirtualCategory\Model\Preview->getQueryFilter()

#1 /vendor/smile/elasticsuite/src/module-elasticsuite-catalog/Model/ProductSorter/AbstractPreview.php(148): Smile\ElasticsuiteVirtualCategory\Model\Preview->prepareProductCollection(Object(Smile\ElasticsuiteCatalog\Model\ResourceModel\Product\Fulltext\Collection\Interceptor))

#2 /vendor/smile/elasticsuite/src/module-elasticsuite-catalog/Model/ProductSorter/AbstractPreview.php(158): Smile\ElasticsuiteCatalog\Model\ProductSorter\AbstractPreview->getProductCollection()

#3 /vendor/smile/elasticsuite/src/module-elasticsuite-catalog/Model/ProductSorter/ in /vendor/smile/elasticsuite/src/module-elasticsuite-virtual-category/Model/Preview.php on line 105`

Please suggest

@Quazz
Copy link

Quazz commented Mar 7, 2019

I get the same thing using

Magento Version : 2.3.0 CE
ElasticSearch Version: 5.2.2
ElasticSuite Version : 2.7.5
Environment : Production

#880 was supposedly the fix for it (and/or raising php max_input_vars), but it seems that changes since may have caused a similar/new/same problem here.

I temporarily commented out lines 75 to 78 of Preview.php so I can still edit categories (staying away from virtual categories of course)

UPDATE: Alright, turns out that a different module was extending Magento\Catalog\Model\Category which caused the issues for me.

@shrinet
Copy link
Author

shrinet commented Mar 7, 2019

Thanks @Quazz for update, could you Please elaborate how other module caused issue and solutions.

Thanks

@Quazz
Copy link

Quazz commented Mar 8, 2019

@shrinet Because the Category model was being overwritten by another model, it wasn't returning what elasticsuite expected it to return, the data it required not being present it returns a "null" value.

By commenting out the lines I mentioned, I noticed in the error log (after reloading admin category page) one particular line that caught my eye:

Smile\\ElasticsuiteVirtualCategory\\Controller\\Adminhtml\\Category\\Virtual\\Preview->addVirtualCategoryData(Object(ICEShop\\Icecatlive\\Model\\Catalog\\Category\\Interceptor))

On a hunch I went into that module's files, opened etc/di.xml and commented out the line that replaced Magento\Catalog\Model\Category, recompiled di and everything started working.

Do note that depending on the module overwriting the class, it may be necessary to take different steps. For me this works because I do not require the modified category model of that model (and it does not depend on it).

For your case though, probably best to update your ElasticSuite to 2.6.7 first

@romainruaud
Copy link
Collaborator

@shrinet did you investigate more ?

Could you please also provide a list of third party modules you use ? So far we do not reproduce this issue on a vanilla Magento + Elasticsuite.

Regards

@shrinet
Copy link
Author

shrinet commented Mar 20, 2019

Thanks for your response, I did investigation and found that there was a module calling collection directly creating issue, Now I'm testing it again after removing that extension.

Will update soon. Thanks

@no-response
Copy link

no-response bot commented Apr 5, 2019

This issue was waiting update from the author for too long.
Without any update, we are unfortunately not sure how to resolve this issue.
We are therefore reluctantly going to close this bug for now. Please don't hesitate to comment on the bug if you have any more information for us; we will reopen it right away!
Thanks for your contribution.

1 similar comment
@no-response
Copy link

no-response bot commented Apr 5, 2019

This issue was waiting update from the author for too long.
Without any update, we are unfortunately not sure how to resolve this issue.
We are therefore reluctantly going to close this bug for now. Please don't hesitate to comment on the bug if you have any more information for us; we will reopen it right away!
Thanks for your contribution.

@sateesh285
Copy link

Quazz WE are getting the same issue now. Could you please guide what need to be done in order to fix this we are using latest version of elastic suite.

@Quazz
Copy link

Quazz commented Sep 8, 2024

Quazz WE are getting the same issue now. Could you please guide what need to be done in order to fix this we are using latest version of elastic suite.

This was a long time so I don't remember precisely, but based on my previous comment you likely have an extension that is overriding the Category or the Category Collection model. You'll have to investigate these extensions and find the one that's doing the override.

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

No branches or pull requests

4 participants