66namespace Magento \Catalog \Block \Product ;
77
88use Magento \Customer \Model \Context as CustomerContext ;
9+ use Magento \Framework \App \Http \Context as HttpContext ;
910
1011/**
1112 * New products block
@@ -18,29 +19,29 @@ class NewProduct extends \Magento\Catalog\Block\Product\AbstractProduct implemen
1819 /**
1920 * Default value for products count that will be shown
2021 */
21- const DEFAULT_PRODUCTS_COUNT = 10 ;
22+ public const DEFAULT_PRODUCTS_COUNT = 10 ;
2223
2324 /**
24- * Products count
25+ * How much product should be displayed at once
2526 *
2627 * @var int
2728 */
2829 protected $ _productsCount ;
2930
3031 /**
31- * @var \Magento\Framework\App\Http\Context
32+ * @var HttpContext
3233 */
3334 protected $ httpContext ;
3435
3536 /**
36- * Catalog product visibility
37+ * Catalog product visibility model
3738 *
3839 * @var \Magento\Catalog\Model\Product\Visibility
3940 */
4041 protected $ _catalogProductVisibility ;
4142
4243 /**
43- * Product collection factory
44+ * Catalog product collection factory
4445 *
4546 * @var \Magento\Catalog\Model\ResourceModel\Product\CollectionFactory
4647 */
@@ -57,7 +58,7 @@ public function __construct(
5758 \Magento \Catalog \Block \Product \Context $ context ,
5859 \Magento \Catalog \Model \ResourceModel \Product \CollectionFactory $ productCollectionFactory ,
5960 \Magento \Catalog \Model \Product \Visibility $ catalogProductVisibility ,
60- \ Magento \ Framework \ App \ Http \ Context $ httpContext ,
61+ HttpContext $ httpContext ,
6162 array $ data = []
6263 ) {
6364 $ this ->_productCollectionFactory = $ productCollectionFactory ;
@@ -95,13 +96,15 @@ protected function _construct()
9596 */
9697 public function getCacheKeyInfo ()
9798 {
99+ $ store = $ this ->_storeManager ->getStore ();
98100 return [
99101 'CATALOG_PRODUCT_NEW ' ,
100- $ this -> _storeManager -> getStore () ->getId (),
102+ $ store ->getId (),
101103 $ this ->_design ->getDesignTheme ()->getId (),
102104 $ this ->httpContext ->getValue (CustomerContext::CONTEXT_GROUP ),
103105 'template ' => $ this ->getTemplate (),
104- $ this ->getProductsCount ()
106+ $ this ->getProductsCount (),
107+ $ this ->httpContext ->getValue (HttpContext::CONTEXT_CURRENCY ) ?: $ store ->getDefaultCurrency ()->getCode ()
105108 ];
106109 }
107110
0 commit comments