Skip to content

Commit

Permalink
Fixed indexed product positions for anchor categories.
Browse files Browse the repository at this point in the history
  • Loading branch information
Evgeni Obukhovsky committed Apr 25, 2017
1 parent a9e8595 commit 9e6ad2f
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,10 @@ protected function createAnchorSelect(\Magento\Store\Model\Store $store)
['ccp' => $this->getTable('catalog_category_product')],
'ccp.category_id = cc2.child_id',
[]
)->joinLeft(
['ccp2' => $this->getTable('catalog_category_product')],
'ccp2.category_id = cc2.parent_id AND ccp.product_id = ccp2.product_id',
[]
)->joinInner(
['cpe' => $this->getTable('catalog_product_entity')],
'ccp.product_id = cpe.entity_id',
Expand Down Expand Up @@ -493,7 +497,7 @@ protected function createAnchorSelect(\Magento\Store\Model\Store $store)
[
'category_id' => 'cc.entity_id',
'product_id' => 'ccp.product_id',
'position' => new \Zend_Db_Expr('ccp.position + 10000'),
'position' => new \Zend_Db_Expr($this->connection->getIfNullSql('ccp2.position', 'ccp.position + 10000')),
'is_parent' => new \Zend_Db_Expr('0'),
'store_id' => new \Zend_Db_Expr($store->getId()),
'visibility' => new \Zend_Db_Expr($this->connection->getIfNullSql('cpvs.value', 'cpvd.value')),
Expand Down

0 comments on commit 9e6ad2f

Please sign in to comment.