Steps to reproduce
- Install Magento from
develop branch.
- Add two widgets of type ‘Catalog Product List’ to the ‘CMS homepage’ at location content.bottom with different titles, but the same conditions. For example, condition could be product price is greater than 0
- Refresh cache and visit homepage
Expected result
- Two widgets appear on homepage with the same products, but different titles.
Actual result
- First widget loaded shows twice depending on sort order
- See: Magento\CatalogWidget\Block\Product\ProductList::getCacheKeyInfo which doesn’t take into consideration the widget_id.
/**
* Get key pieces for caching block content
*
* @return array
*/
public function getCacheKeyInfo()
{
$conditions = $this->getData('conditions')
? $this->getData('conditions')
: $this->getData('conditions_encoded');
return [
'CATALOG_PRODUCTS_LIST_WIDGET',
$this->_storeManager->getStore()->getId(),
$this->_design->getDesignTheme()->getId(),
$this->httpContext->getValue(\Magento\Customer\Model\Context::CONTEXT_GROUP),
intval($this->getRequest()->getParam(self::PAGE_VAR_NAME, 1)),
$this->getProductsPerPage(),
$conditions
];
}
Hi @twslade. Thank you for your report. The issue has been fixed in magento/magento2#14816 by @ihor-sviziev in 2.3-develop branch Related commit(s):
The fix will be available with the upcoming 2.3.0 release.