Skip to content

Commit

Permalink
MAGETWO-84932: PR#12466 [BACKPORT 2.1] #12522
Browse files Browse the repository at this point in the history
  • Loading branch information
Volodymyr Kublytskyi committed Dec 4, 2017
2 parents 6415e3d + 89bfc0c commit fb747cf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
14 changes: 11 additions & 3 deletions app/code/Magento/Catalog/Block/Product/ListProduct.php
Expand Up @@ -318,13 +318,21 @@ public function prepareSortableFieldsByCategory($category)
public function getIdentities()
{
$identities = [];
foreach ($this->_getProductCollection() as $item) {
$identities = array_merge($identities, $item->getIdentities());
}

$category = $this->getLayer()->getCurrentCategory();
if ($category) {
$identities[] = Product::CACHE_PRODUCT_CATEGORY_TAG . '_' . $category->getId();
}

//Check if category page shows only static block (No products)
if ($category->getData('display_mode') == Category::DM_PAGE) {
return $identities;
}

foreach ($this->_getProductCollection() as $item) {
$identities = array_merge($identities, $item->getIdentities());
}

return $identities;
}

Expand Down
Expand Up @@ -179,7 +179,7 @@ public function testGetIdentities()
->will($this->returnValue($currentCategory));

$this->assertEquals(
[$productTag, $categoryTag ],
[$categoryTag, $productTag],
$this->block->getIdentities()
);
}
Expand Down

0 comments on commit fb747cf

Please sign in to comment.