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 @@ -431,6 +431,10 @@ protected function createAnchorSelect(\Magento\Store\Model\Store $store)
431
431
['ccp ' => $ this ->getTable ('catalog_category_product ' )],
432
432
'ccp.category_id = cc2.child_id ' ,
433
433
[]
434
+ )->joinLeft (
435
+ ['ccp2 ' => $ this ->getTable ('catalog_category_product ' )],
436
+ 'ccp2.category_id = cc2.parent_id AND ccp.product_id = ccp2.product_id ' ,
437
+ []
434
438
)->joinInner (
435
439
['cpe ' => $ this ->getTable ('catalog_product_entity ' )],
436
440
'ccp.product_id = cpe.entity_id ' ,
@@ -493,7 +497,7 @@ protected function createAnchorSelect(\Magento\Store\Model\Store $store)
493
497
[
494
498
'category_id ' => 'cc.entity_id ' ,
495
499
'product_id ' => 'ccp.product_id ' ,
496
- 'position ' => new \Zend_Db_Expr (' ccp.position + 10000 ' ),
500
+ 'position ' => new \Zend_Db_Expr ($ this -> connection -> getIfNullSql ( ' ccp2.position ' , ' ccp.position + 10000 ') ),
497
501
'is_parent ' => new \Zend_Db_Expr ('0 ' ),
498
502
'store_id ' => new \Zend_Db_Expr ($ store ->getId ()),
499
503
'visibility ' => new \Zend_Db_Expr ($ this ->connection ->getIfNullSql ('cpvs.value ' , 'cpvd.value ' )),
You can’t perform that action at this time.
0 commit comments