Skip to content

Commit

Permalink
Merge pull request #772 from Nosto/release/6.0.1
Browse files Browse the repository at this point in the history
Release 6.0.1
  • Loading branch information
dairbuirabass authored May 23, 2022
2 parents b4cc9f5 + fad6b65 commit 4b2e5f4
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 670 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
All notable changes to this project will be documented in this file. This project adheres to Semantic Versioning.

### 6.0.1
* Add support for both version 2 and 3 of phpseclib/phpseclib library (for compatibility with Magento versions 2.3.x and 2.4.x)
* Remove customer visitor checksum generation when 2c.cid cookie does not exist

### 6.0.0
* Compatibility with Magento 2.4.4
* Bump minimum PHP version to 7.4
Expand Down
8 changes: 6 additions & 2 deletions CustomerData/CartTagging.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,16 @@ public function __construct(
*/
public function getSectionData()
{
$nostoCustomerId = $this->cookieManager->getCookie(NostoCustomer::COOKIE_NAME);
$data = [
'hcid' => $this->generateVisitorChecksum($nostoCustomerId),
'items' => [],
'restore_cart_url' => ''
];

$nostoCustomerId = $this->cookieManager->getCookie(NostoCustomer::COOKIE_NAME);
if ($nostoCustomerId) {
$data['hcid'] = $this->generateVisitorChecksum($nostoCustomerId);
}

$cart = $this->cartHelper->getCart();
$nostoCart = $this->nostoCartBuilder->build(
$this->getQuote(),
Expand Down
15 changes: 11 additions & 4 deletions Helper/Data.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php
<?php /** @noinspection ALL */
/**
* Copyright (c) 2020, Nosto Solutions Ltd
* All rights reserved.
Expand Down Expand Up @@ -47,7 +47,6 @@
use Magento\Store\Api\Data\StoreInterface;
use Magento\Store\Model\Store;
use Nosto\Tagging\Helper\Scope as NostoHelperScope;
use phpseclib3\Crypt\Random;

/**
* NostoHelperData helper used for common tasks, mainly configurations.
Expand Down Expand Up @@ -242,15 +241,23 @@ public function __construct(
* Nosto accounts used on this installation.
*
* @return string the ID.
* @suppress PhanAccessMethodInternal, PhanUndeclaredClassConstant, PhanUndeclaredClassMethod
*/
public function getInstallationId()
{
$installationId = $this->scopeConfig->getValue(
self::XML_PATH_INSTALLATION_ID
);
if (empty($installationId)) {
// Running bin2hex() will make the ID string length 64 characters.
$installationId = bin2hex(Random::string(32));
//Check if phpseclib v3 is used
//needed for comaptibility with Magento 2.4 versions
if (class_exists("phpseclib3\Crypt\Random")) {
// Running bin2hex() will make the ID string length 64 characters.
$installationId = bin2hex(\phpseclib3\Crypt\Random::string(32));
} else {
// Running bin2hex() will make the ID string length 64 characters.
$installationId = bin2hex(\phpseclib\Crypt\Random::string(32));
}
$this->configWriter->save(
self::XML_PATH_INSTALLATION_ID,
$installationId
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "nosto/module-nostotagging",
"description": "Increase your conversion rate and average order value by delivering your customers personalized product recommendations throughout their shopping journey.",
"type": "magento2-module",
"version": "6.0.0",
"version": "6.0.1",
"require-dev": {
"phpmd/phpmd": "^2.5",
"sebastian/phpcpd": "*",
Expand Down Expand Up @@ -39,10 +39,10 @@
"OSL-3.0"
],
"require": {
"nosto/php-sdk": ">=5.8.1",
"php": ">=7.4.0",
"magento/framework": ">=101.0.6|~102.0",
"ext-json": "*"
"ext-json": "*",
"nosto/php-sdk": "^5.8"
},
"repositories": [
{
Expand Down
Loading

0 comments on commit 4b2e5f4

Please sign in to comment.