Skip to content

Commit

Permalink
MAGETWO-84933: PR #12466 [BACKPORT 2.3] #12523
Browse files Browse the repository at this point in the history
 - Merge Pull Request #12523 from atishgoswami/magento2:varnish-xtags-categorypage-fix-2.3
 - Merged commits:
   1. 960dcca
  • Loading branch information
miguelbalparda committed Dec 2, 2017
2 parents 4067591 + 960dcca commit 5b5552f
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 @@ -265,13 +265,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 @@ -192,7 +192,7 @@ public function testGetIdentities()
->will($this->returnValue($this->toolbarMock));

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

0 comments on commit 5b5552f

Please sign in to comment.