Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert "Adds StoreID field to Added to Cart and Viewed Product events" #311

Merged
merged 1 commit into from
Sep 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions Block/Catalog/Product/ViewedProduct.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,8 +200,7 @@ public function getViewedProductJson()
'URL' => $_product->getProductUrl(),
'Price' => $this->getPrice(),
'FinalPrice' => $this->getFinalPrice(),
'Categories' => $this->getProductCategories(),
'StoreID' => $this->_klaviyoScopeSetting->storeId
'Categories' => $this->getProductCategories()
];

if ($this->getProductImage()) {
Expand All @@ -225,8 +224,7 @@ public function getViewedItemJson()
'Categories' => $this->getProductCategories(),
'Metadata' => array(
'Price' => $this->getPrice()
),
'StoreID' => $this->_klaviyoScopeSetting->storeId
)
];

if ($this->getProductImage()) {
Expand Down
6 changes: 0 additions & 6 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
<!-- BEGIN RELEASE NOTES -->
### [Unreleased]

#### Added
- Adds StoreID field to Viewed Product events

#### Changed
- Updates StoreId field to StoreID for Added to Cart events

### [4.1.4] - 2024-05-22

#### Changed
Expand Down
4 changes: 2 additions & 2 deletions Cron/KlSyncs.php
Original file line number Diff line number Diff line change
Expand Up @@ -144,8 +144,8 @@ private function sendUpdatesToApp(array $groupedRows, bool $isRetry = false)

//TODO: if conditional for backward compatibility, needs to be removed in future versions
$storeId = '';
if (isset($decodedPayload['StoreID'])) {
$storeId = $decodedPayload['StoreID'];
if (isset($decodedPayload['StoreId'])) {
$storeId = $decodedPayload['StoreId'];
}

$response = $this->_dataHelper->klaviyoTrackEvent(
Expand Down
8 changes: 4 additions & 4 deletions Helper/ScopeSetting.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class ScopeSetting extends \Magento\Framework\App\Helper\AbstractHelper
/**
* @var int
*/
public $storeId;
protected $_storeId;

/**
* @var \Magento\Framework\Module\ModuleListInterface
Expand All @@ -75,7 +75,7 @@ public function __construct(
$this->_scopeConfig = $context->getScopeConfig();
$this->_request = $context->getRequest();
$this->_state = $state;
$this->storeId = $storeManager->getStore()->getId();
$this->_storeId = $storeManager->getStore()->getId();
$this->_moduleList = $moduleList;
$this->_configWriter = $configWriter;
}
Expand Down Expand Up @@ -114,7 +114,7 @@ protected function getScopeSetting($path, $storeId = null)
$scopedWebsiteCode = $this->_request->getParam('website');
} else {
// In frontend area. Only concerned with store for frontend.
$scopedStoreCode = $this->storeId;
$scopedStoreCode = $this->_storeId;
}

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

if (isset($scopedStoreCode)) {
Expand Down
2 changes: 1 addition & 1 deletion Observer/SalesQuoteSaveAfter.php
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ public function execute(Observer $observer)
// Setting QuoteId at this point since the MaskedQuoteId is not updated when this event is dispatched,
$klAddedToCartPayload['QuoteId'] = isset($encodedCustomerId) ? "kx_identifier_$encodedCustomerId" : $quote->getId();
// Setting StoreId in payload
$klAddedToCartPayload['StoreID'] = $quote->getStoreId();
$klAddedToCartPayload['StoreId'] = $quote->getStoreId();

$stringifiedPayload = json_encode($klAddedToCartPayload);

Expand Down
Loading