Skip to content

Commit fec92f3

Browse files
nuzilrostyslav-hymon
authored andcommitted
Fix for Magento Issue 13950 Solution: Use currency code instead currency symbol in cache key generating to get unique cache of these block for different currencies.
1 parent a2f6a08 commit fec92f3

File tree

2 files changed

+5
-3
lines changed

2 files changed

+5
-3
lines changed

app/code/Magento/CatalogWidget/Block/Product/ProductsList.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ public function getCacheKeyInfo()
160160

161161
return [
162162
'CATALOG_PRODUCTS_LIST_WIDGET',
163-
$this->getPriceCurrency()->getCurrencySymbol(),
163+
$this->getPriceCurrency()->getCurrency()->getCode(),
164164
$this->_storeManager->getStore()->getId(),
165165
$this->_design->getDesignTheme()->getId(),
166166
$this->httpContext->getValue(\Magento\Customer\Model\Context::CONTEXT_GROUP),

app/code/Magento/CatalogWidget/Test/Unit/Block/Product/ProductsListTest.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,9 @@ public function testGetCacheKeyInfo()
147147
$this->request->expects($this->once())->method('getParam')->with('page_number')->willReturn(1);
148148

149149
$this->request->expects($this->once())->method('getParams')->willReturn('request_params');
150-
$this->priceCurrency->expects($this->once())->method('getCurrencySymbol')->willReturn('$');
150+
$currency = $this->createMock(\Magento\Directory\Model\Currency::class);
151+
$currency->expects($this->once())->method('getCode')->willReturn('USD');
152+
$this->priceCurrency->expects($this->once())->method('getCurrency')->willReturn($currency);
151153

152154
$this->serializer->expects($this->any())
153155
->method('serialize')
@@ -157,7 +159,7 @@ public function testGetCacheKeyInfo()
157159

158160
$cacheKey = [
159161
'CATALOG_PRODUCTS_LIST_WIDGET',
160-
'$',
162+
'USD',
161163
1,
162164
'blank',
163165
'context_group',

0 commit comments

Comments
 (0)