-
Notifications
You must be signed in to change notification settings - Fork 340
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
Sorting not applied #431
Comments
Hello, the sort order is set on the ES query, you are right. Since this error is not present on our demo environment (see http://demo.magento-elastic-suite.io/index.php/men/tops-men/jackets-men.html?product_list_order=name ), could you please ensure you still reproduce this bug when you de-activate your third party modules ? Eg. : Do you have any modules which could be rewriting / pluggin-ing the Product Collection ? |
Hi @romainruaud, Thanks for your fast answer. You are right. Elasticsearch is not the cause of this issue. Deactivating all other modules helped. So I have to go on searching the problem. I thought I've done that already but it seems that I missed a module while deactivating. Sorry for the question, I did everything possible and got stuck with no idea how to go on. Thanks again. |
Hello @diybook No problem, you are always welcome if you need more informations about how is working our module ! I close this issue for now, since the issue does not seem to be related to elasticsuite. Feel free to reopen it if needed. Best regards |
Hi @romainruaud, I may have found the issue and maybe you can help. Maybe it's also relevant for ElasticSearch. We render the filters of the layered navigation before product.list on category page. Of course it is duplicated from sidebar but with images. Therefore we get the filters and go through the items of the filters in our custom block. At that moment they are not initialized and will be initialized. For that (cause it is an Attribute) ElasticSearch is getting the productCollection through: $productCollection = $this->getLayer()->getProductCollection(); After that the collection of the product.list is wrong. It may be an Magento issue or it may be an ES issue. I'm not sure. When moving that block below the product.list everything works. But the block should be displayed before. Any ideas? Best regards, |
Oh well I see. Unfortunately there is no solutions here. This is due to Magento behavior as I explained here : https://github.com/Smile-SA/elasticsuite/wiki/FAQ#i-have-problems-with-the-pagination--sorting There is an issue on the Magento's repo describing the problem : magento/magento2#7253 Since the toolbar and product list are interdependants, there is not much we can do to fix this. Best regards, |
@diybook Just want to say thank you for your explanation. Was already some hours in trouble/debugging and your post pointed me in the right way. Thanks!!! |
Hello all, @PieterCappelle have solve this issue, cause I'm in that position myself right now. My custom sorting doesn't work after I started using ES. Thanks |
Changing the sort order on category page do not has any effect on the results.
Preconditions
Magento CE with custom theme and some custom modules. Disabling elastic search results in an collection with sort order in.
Magento Version : 2.1.6
ElasticSuite Version : 2.3.5
Environment : Development mode
Third party modules :
Amasty/Stockstatus
Apptrian/ImageOptimizer
Fooman/EmailAttachments
Fooman/PrintOrderPdf
Magenerds/BasePrice
Some custom Modules
Steps to reproduce
SELECT
e
.*,price_index
.price
,price_index
.tax_class_id
,price_index
.final_price
, IF(price_index.tier_price IS NOT NULL, LEAST(price_index.min_price, price_index.tier_price), price_index.min_price) ASminimal_price
,price_index
.min_price
,price_index
.max_price
,price_index
.tier_price
,stock_status_index
.stock_status
ASis_salable
FROMcatalog_product_entity
ASe
INNER JOINcatalog_product_index_price
ASprice_index
ON price_index.entity_id = e.entity_id AND price_index.website_id = '1' AND price_index.customer_group_id = 0 LEFT JOINcataloginventory_stock_status
ASstock_status_index
ON e.entity_id = stock_status_index.product_id AND stock_status_index.website_id = 0 AND stock_status_index.stock_id = 1 WHERE (e.entity_id IN (411695, 411694, 411142, 410357, 410309, 410277, 410271, 410177, 410160, 410159, 410120, 410035, 409949, 409909, 409908, 409893, 409802, 409766, 409751, 409743, 409728, 409712, 409634, 409305, 409302, 408907, 408906, 408701, 408686, 408682, 408672, 408655, 407829, 397393, 397324, 397316, 397258, 397254, 397178, 397177, 397176)) LIMIT 40Limit is applied but not the order by.
Expected result
Actual result
I've tried to debug this but not sure where to go on. Where the sort order is set to that collection? It seems that this collection is set externally by elastic search, but I've not found that piece of code.
I've also tried to inspect the event "catalog_block_product_list_collection" but the output of this sql is even worse. Not Limit, no order by no stock_status as is_salable...
SELECT
e
.*,price_index
.price
,price_index
.tax_class_id
,price_index
.final_price
, IF(price_index.tier_price IS NOT NULL, LEAST(price_index.min_price, price_index.tier_price), price_index.min_price) ASminimal_price
,price_index
.min_price
,price_index
.max_price
,price_index
.tier_price
FROMcatalog_product_entity
ASe
INNER JOINcatalog_product_index_price
ASprice_index
ON price_index.entity_id = e.entity_id AND price_index.website_id = '1' AND price_index.customer_group_id = 0 WHERE (e.entity_id IN (411695, 411694, 411142, 410357, 410309, 410277, 410271, 410177, 410160, 410159, 410120, 410035, 409949, 409909, 409908, 409893, 409802, 409766, 409751, 409743, 409728, 409712, 409634, 409305, 409302, 408907, 408906, 408701, 408686, 408682, 408672, 408655, 407829, 397393, 397324, 397316, 397258, 397254, 397178, 397177, 397176))Any ideas where to go on debugging?
Best regards
The text was updated successfully, but these errors were encountered: