Skip to content

Commit fb747cf

Browse files
author
Volodymyr Kublytskyi
authored
MAGETWO-84932: PR#12466 [BACKPORT 2.1] #12522
2 parents 6415e3d + 89bfc0c commit fb747cf

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
@@ -318,13 +318,21 @@ public function prepareSortableFieldsByCategory($category)
318318
public function getIdentities()
319319
{
320320
$identities = [];
321-
foreach ($this->_getProductCollection() as $item) {
322-
$identities = array_merge($identities, $item->getIdentities());
323-
}
321+
324322
$category = $this->getLayer()->getCurrentCategory();
325323
if ($category) {
326324
$identities[] = Product::CACHE_PRODUCT_CATEGORY_TAG . '_' . $category->getId();
327325
}
326+
327+
//Check if category page shows only static block (No products)
328+
if ($category->getData('display_mode') == Category::DM_PAGE) {
329+
return $identities;
330+
}
331+
332+
foreach ($this->_getProductCollection() as $item) {
333+
$identities = array_merge($identities, $item->getIdentities());
334+
}
335+
328336
return $identities;
329337
}
330338

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ public function testGetIdentities()
179179
->will($this->returnValue($currentCategory));
180180

181181
$this->assertEquals(
182-
[$productTag, $categoryTag ],
182+
[$categoryTag, $productTag],
183183
$this->block->getIdentities()
184184
);
185185
}

0 commit comments

Comments
 (0)