File tree 1 file changed +5
-1
lines changed
app/code/Magento/Catalog/Model/Indexer/Category/Product
1 file changed +5
-1
lines changed Original file line number Diff line number Diff line change @@ -421,6 +421,10 @@ protected function createAnchorSelect(\Magento\Store\Model\Store $store)
421
421
['ccp ' => $ this ->getTable ('catalog_category_product ' )],
422
422
'ccp.category_id = cc2.child_id ' ,
423
423
[]
424
+ )->joinLeft (
425
+ ['ccp2 ' => $ this ->getTable ('catalog_category_product ' )],
426
+ 'ccp2.category_id = cc2.parent_id AND ccp.product_id = ccp2.product_id ' ,
427
+ []
424
428
)->joinInner (
425
429
['cpe ' => $ this ->getTable ('catalog_product_entity ' )],
426
430
'ccp.product_id = cpe.entity_id ' ,
@@ -483,7 +487,7 @@ protected function createAnchorSelect(\Magento\Store\Model\Store $store)
483
487
[
484
488
'category_id ' => 'cc.entity_id ' ,
485
489
'product_id ' => 'ccp.product_id ' ,
486
- 'position ' => new \Zend_Db_Expr (' ccp.position + 10000 ' ),
490
+ 'position ' => new \Zend_Db_Expr ($ this -> connection -> getIfNullSql ( ' ccp2.position ' , ' ccp.position + 10000 ') ),
487
491
'is_parent ' => new \Zend_Db_Expr ('0 ' ),
488
492
'store_id ' => new \Zend_Db_Expr ($ store ->getId ()),
489
493
'visibility ' => new \Zend_Db_Expr ($ this ->connection ->getIfNullSql ('cpvs.value ' , 'cpvd.value ' )),
You can’t perform that action at this time.
0 commit comments