Skip to content

Commit b4651a9

Browse files
MAGETWO-84933: PR #12466 [BACKPORT 2.3] #12523
2 parents 9c73bc2 + 5b5552f commit b4651a9

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

app/code/Magento/Catalog/Block/Product/ListProduct.php

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -265,13 +265,21 @@ public function prepareSortableFieldsByCategory($category)
265265
public function getIdentities()
266266
{
267267
$identities = [];
268-
foreach ($this->_getProductCollection() as $item) {
269-
$identities = array_merge($identities, $item->getIdentities());
270-
}
268+
271269
$category = $this->getLayer()->getCurrentCategory();
272270
if ($category) {
273271
$identities[] = Product::CACHE_PRODUCT_CATEGORY_TAG . '_' . $category->getId();
274272
}
273+
274+
//Check if category page shows only static block (No products)
275+
if ($category->getData('display_mode') == Category::DM_PAGE) {
276+
return $identities;
277+
}
278+
279+
foreach ($this->_getProductCollection() as $item) {
280+
$identities = array_merge($identities, $item->getIdentities());
281+
}
282+
275283
return $identities;
276284
}
277285

app/code/Magento/Catalog/Test/Unit/Block/Product/ListProductTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ public function testGetIdentities()
192192
->will($this->returnValue($this->toolbarMock));
193193

194194
$this->assertEquals(
195-
[$productTag, $categoryTag],
195+
[$categoryTag, $productTag],
196196
$this->block->getIdentities()
197197
);
198198
$this->assertEquals(

0 commit comments

Comments
 (0)