Skip to content

Commit

Permalink
Merge branch 'release/1.1.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
ma4nn committed May 5, 2023
2 parents 45ab393 + a984a91 commit 7bbdbaa
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 20 deletions.
30 changes: 17 additions & 13 deletions Model/Cookie.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,15 @@

namespace Recolize\RecommendationEngine\Model;

use Magento\Framework\Serialize\SerializerInterface;
use Magento\Framework\Stdlib\Cookie\CookieMetadataFactory;
use Magento\Framework\Stdlib\Cookie\PhpCookieManager;
use Magento\Framework\Stdlib\CookieManagerInterface;
use Recolize\RecommendationEngine\Model\Cookie\UserData;

class Cookie
{
/**
* The cookie name.
*
* @var string
*/
/** @var string */
const COOKIE_NAME = 'recolize_parameter';

/**
Expand All @@ -35,16 +32,23 @@ class Cookie
*/
const COOKIE_LIFETIME = PhpCookieManager::EXPIRE_AT_END_OF_SESSION_TIME;

/**
* @param CookieManagerInterface $cookieManager
* @param CookieMetadataFactory $cookieMetadataFactory
*/
/** @var \Magento\Framework\Stdlib\CookieManagerInterface */
private $cookieManager;

/** @var \Magento\Framework\Stdlib\Cookie\CookieMetadataFactory */
private $cookieMetadataFactory;

/** @var \Magento\Framework\Serialize\SerializerInterface */
private $serializer;

public function __construct(
CookieManagerInterface $cookieManager,
CookieMetadataFactory $cookieMetadataFactory
CookieMetadataFactory $cookieMetadataFactory,
SerializerInterface $serializer
) {
$this->cookieManager = $cookieManager;
$this->cookieMetadataFactory = $cookieMetadataFactory;
$this->serializer = $serializer;
}

/**
Expand All @@ -69,16 +73,16 @@ public function updateUserData(UserData $userData)
private function save(array $additionalData)
{
try {
$cookieValue = \Zend_Json::decode($this->get());
$cookieValue = $this->serializer->unserialize($this->get());
} catch (\Exception $exception) {
}

try {
if (empty($cookieValue) === true) {
$cookieValue = array();
$cookieValue = [];
}

$cookieValue = \Zend_Json::encode(array_replace($cookieValue, $additionalData));
$cookieValue = $this->serializer->serialize(array_replace($cookieValue, $additionalData));
$this->set($cookieValue);
} catch (\Exception $exception) {}

Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
## Getting Started

Thank you very much for using our Recolize Recommendation Engine for Magento 2.
Please find some installation advices below and more information on [https://www.recolize.com](https://www.recolize.com/?utm_source=github&utm_medium=web&utm_campaign=github-help-area).
Please find some installation advices below and more information on [our website](https://www.recolize.com/?utm_source=github&utm_medium=web&utm_campaign=github-help-area).

### Prerequisites

Expand All @@ -29,23 +29,23 @@ We recommend to proceed with the following preparational steps before you start
bin/magento cache:flush
```

3. Register for free at [https://www.recolize.com/en/register](https://www.recolize.com/en/register?utm_source=github&utm_medium=web&utm_campaign=github-help-area), login into [Recolize Tool](https://tool.recolize.com/?utm_source=github&utm_medium=web&utm_campaign=github-help-area) and create a new domain with the product feed url that is displayed in _Stores > Configuration > Recolize Recommendation Engine > Recolize Product Feed Settings_.
3. [Register for free](https://www.recolize.com/en/register?utm_source=github&utm_medium=web&utm_campaign=github-help-area), login into [Recolize Tool](https://tool.recolize.com/?utm_source=github&utm_medium=web&utm_campaign=github-help-area) and create a new domain with the product feed url that is displayed in _Stores > Configuration > Recolize Recommendation Engine > Recolize Product Feed Settings_.

4. Copy the JavaScript snippet code from the domain configuration into the appropriate Magento setting at _Stores > Configuration > Recolize Recommendation Engine_.

#### Installation without Composer (if composer is not available)
1. Unpack the setup package Recolize_Recommendation_*.zip and upload the unpacked contents into the root directory of your Magento installation (for example via FTP).
1. Unpack the setup package `Recolize_Recommendation_*.zip` and upload the unpacked contents into the root directory of your Magento installation (for example via FTP).
The folder structure is exactly the same as in your Magento installation (app/code). In case of a fresh module installation no files will be overwritten.

2. Flush your Magento cache, e.g. in _System > Cache Management_ as well as the JavaScript-/CSS-Cache on the same page.

3. Register for free at [https://www.recolize.com/en/register](https://www.recolize.com/en/register?utm_source=github&utm_medium=web&utm_campaign=github-help-area), login into [Recolize Tool](https://tool.recolize.com/?utm_source=github&utm_medium=web&utm_campaign=github-help-area) and create a new domain with the product feed url that is displayed in _Stores > Configuration > Recolize Recommendation Engine > Recolize Product Feed Settings_.
3. [Register for free](https://www.recolize.com/en/register?utm_source=github&utm_medium=web&utm_campaign=github-help-area), login into [Recolize Tool](https://tool.recolize.com/?utm_source=github&utm_medium=web&utm_campaign=github-help-area) and create a new domain with the product feed url that is displayed in _Stores > Configuration > Recolize Recommendation Engine > Recolize Product Feed Settings_.

4. Copy the JavaScript snippet code from the domain configuration into the appropriate Magento setting at _Stores > Configuration > Recolize Recommendation Engine_.

## Authors

Recolize GmbH ([https://www.recolize.com](https://www.recolize.com/?utm_source=github&utm_medium=web&utm_campaign=github-help-area)).
Recolize GmbH ([https://www.recolize.com](https://www.recolize.com/?utm_source=github&utm_medium=web&utm_campaign=github-help-area))

## License

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "recolize/module-recommendation-engine-magento2",
"description": "The Recolize Recommendation Engine as extension for Magento 2",
"version": "1.1.0",
"version": "1.1.1",
"type": "magento2-module",
"keywords": [
"recolize",
Expand Down
6 changes: 6 additions & 0 deletions etc/di.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,12 @@
</arguments>
</type>

<type name="Recolize\RecommendationEngine\Model\Cookie">
<arguments>
<argument name="serializer" xsi:type="object">Magento\Framework\Serialize\Serializer\Json</argument>
</arguments>
</type>

<virtualType name="Recolize\RecommendationEngine\Model\Session\Storage" type="Magento\Framework\Session\Storage">
<arguments>
<argument name="namespace" xsi:type="string">recolize</argument>
Expand Down
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="Recolize_RecommendationEngine" setup_version="1.1.0">
<module name="Recolize_RecommendationEngine" setup_version="1.1.1">
<sequence>
<module name="Magento_Backend"/>
</sequence>
Expand Down

0 comments on commit 7bbdbaa

Please sign in to comment.