Skip to content

Commit a087e83

Browse files
committed
Adds Viewed Product storeId field
1 parent c9d3b11 commit a087e83

File tree

3 files changed

+10
-7
lines changed

3 files changed

+10
-7
lines changed

Block/Catalog/Product/ViewedProduct.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,8 @@ public function getViewedProductJson()
200200
'URL' => $_product->getProductUrl(),
201201
'Price' => $this->getPrice(),
202202
'FinalPrice' => $this->getFinalPrice(),
203-
'Categories' => $this->getProductCategories()
203+
'Categories' => $this->getProductCategories(),
204+
'StoreId' => $this->_klaviyoScopeSetting->storeId
204205
];
205206

206207
if ($this->getProductImage()) {
@@ -224,7 +225,8 @@ public function getViewedItemJson()
224225
'Categories' => $this->getProductCategories(),
225226
'Metadata' => array(
226227
'Price' => $this->getPrice()
227-
)
228+
),
229+
'StoreId' => $this->_klaviyoScopeSetting->storeId
228230
];
229231

230232
if ($this->getProductImage()) {

CHANGELOG.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
298298

299299
<!-- END RELEASE NOTES -->
300300
<!-- BEGIN LINKS -->
301-
[Unreleased]: https://github.com/klaviyo/magento2-klaviyo/compare/4.1.4...HEAD
301+
[Unreleased]: https://github.com/klaviyo/magento2-klaviyo/compare/4.2.0...HEAD
302+
[4.2.0]: https://github.com/klaviyo/magento2-klaviyo/compare/4.1.4...4.2.0
302303
[4.1.4]: https://github.com/klaviyo/magento2-klaviyo/compare/4.1.3...4.1.4
303304
[4.1.3]: https://github.com/klaviyo/magento2-klaviyo/compare/4.1.2...4.1.3
304305
[4.1.2]: https://github.com/klaviyo/magento2-klaviyo/compare/4.1.1...4.1.2

Helper/ScopeSetting.php

+4-4
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ class ScopeSetting extends \Magento\Framework\App\Helper\AbstractHelper
5252
/**
5353
* @var int
5454
*/
55-
protected $_storeId;
55+
public $storeId;
5656

5757
/**
5858
* @var \Magento\Framework\Module\ModuleListInterface
@@ -75,7 +75,7 @@ public function __construct(
7575
$this->_scopeConfig = $context->getScopeConfig();
7676
$this->_request = $context->getRequest();
7777
$this->_state = $state;
78-
$this->_storeId = $storeManager->getStore()->getId();
78+
$this->storeId = $storeManager->getStore()->getId();
7979
$this->_moduleList = $moduleList;
8080
$this->_configWriter = $configWriter;
8181
}
@@ -114,7 +114,7 @@ protected function getScopeSetting($path, $storeId = null)
114114
$scopedWebsiteCode = $this->_request->getParam('website');
115115
} else {
116116
// In frontend area. Only concerned with store for frontend.
117-
$scopedStoreCode = $this->_storeId;
117+
$scopedStoreCode = $this->storeId;
118118
}
119119

120120
if (isset($scopedStoreCode)) {
@@ -142,7 +142,7 @@ protected function setScopeSetting($path, $value)
142142
$scopedWebsiteCode = $this->_request->getParam('website');
143143
} else {
144144
// In frontend area. Only concerned with store for frontend.
145-
$scopedStoreCode = $this->_storeId;
145+
$scopedStoreCode = $this->storeId;
146146
}
147147

148148
if (isset($scopedStoreCode)) {

0 commit comments

Comments
 (0)