Skip to content

Commit

Permalink
Merge pull request #73 from YotpoLtd/v1.4.8
Browse files Browse the repository at this point in the history
v1.4.8: Added a timestamp query param to the snippet loader and url_coupon processor requests.
  • Loading branch information
pniel-cohen authored Aug 21, 2024
2 parents 8833659 + be5eeac commit a910651
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 7 deletions.
5 changes: 5 additions & 0 deletions Block/Snippet.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@

class Snippet extends AbstractBlock
{
public function getSnippetLoaderUrl()
{
return $this->getUrl('rest/V1/swell/session/snippet');
}

public function getFullActionName()
{
return $this->getRequest()->getFullActionName();
Expand Down
6 changes: 4 additions & 2 deletions Block/UrlCouponCodeJs.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ public function getUrlCouponCodeUrl()
if(!($couponCode = $this->getUrlCouponCode())){
return '';
}
return $this->getUrl('yotpo_loyalty/session/urlcouponcode') . '?' . http_build_query([
YotpoLoyaltyHelper::COUPON_CODE_QUERY_PARAM => $couponCode
return $this->getUrl('yotpo_loyalty/session/urlcouponcode', [
'_query' => [
YotpoLoyaltyHelper::COUPON_CODE_QUERY_PARAM => $couponCode
]
]);
}
}
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "yotpo/magento2-module-yotpo-loyalty",
"description": "Magento 2 module for integration with Yotpo",
"type": "magento2-module",
"version": "1.4.7",
"version": "1.4.8",
"repositories": [{
"type": "git",
"url": "https://github.com/YotpoLtd/magento2-module-yotpo-loyalty"
Expand All @@ -23,4 +23,4 @@
"Yotpo\\Loyalty\\": ""
}
}
}
}
2 changes: 1 addition & 1 deletion etc/module.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
<module name="Yotpo_Loyalty" setup_version="1.4.7">
<module name="Yotpo_Loyalty" setup_version="1.4.8">
<sequence>
<module name="Magento_Catalog" />
</sequence>
Expand Down
2 changes: 1 addition & 1 deletion view/frontend/templates/snippet.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
$(document).ready(function() {
try {
storage.get(
'<?php echo $block->getUrl('rest/V1/swell/session/snippet') ?>'
'<?= $block->getSnippetLoaderUrl() ?>' + '?timestamp=' + new Date().getTime()
).done(function (response) {
response = JSON.parse(response);
if(!response.error && response.snippet){
Expand Down
2 changes: 1 addition & 1 deletion view/frontend/templates/url_coupon_code_js_body.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use Yotpo\Loyalty\Helper\Data as YotpoLoyaltyHelper;
],function($, storage) {
$(document).ready(function() {
try {
storage.get(yotpoLoyaltyCouponCodeUrl)
storage.get(yotpoLoyaltyCouponCodeUrl + '&timestamp=' + new Date().getTime())
.done(function (response) {
if (response.error) {
throw response;
Expand Down

0 comments on commit a910651

Please sign in to comment.