Skip to content

Commit

Permalink
Fixes #2255, added join-criteria with catalog category table for bett…
Browse files Browse the repository at this point in the history
…er matching row_id
  • Loading branch information
vahonc authored and romainruaud committed Sep 27, 2021
1 parent 5b1886a commit 08c8fa8
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -210,12 +210,18 @@ private function joinStorePosition(\Magento\Framework\Db\Select &$select, $store
$linkField = $this->getEntityMetaData(CategoryInterface::class)->getLinkField();

$conditions = [
"p.category_id = use_store_positions.{$linkField}",
"c.{$linkField} = use_store_positions.{$linkField}",
"use_store_positions.store_id = " . (int) $storeId,
"use_store_positions.attribute_id = " . (int) $useStorePositionsAttr->getAttributeId(),
];
$joinCondition = new \Zend_Db_Expr(implode(" AND ", $conditions));

$select->joinLeft(
['c' => $this->getTable('catalog_category_entity')],
'p.category_id = c.entity_id',
[]
);

$select->joinLeft(
['use_store_positions' => $useStorePositionsAttr->getBackendTable()],
$joinCondition,
Expand Down

0 comments on commit 08c8fa8

Please sign in to comment.