Skip to content

Commit

Permalink
Merge pull request #346 from Nosto/release/4.1.0
Browse files Browse the repository at this point in the history
Release 4.1.0
  • Loading branch information
Dair Baidauletov authored Nov 16, 2022
2 parents 73a592d + 6ca8b5c commit 93bc1d2
Show file tree
Hide file tree
Showing 9 changed files with 41 additions and 28 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@
All notable changes to this project will be documented in this file.
This project adheres to Semantic Versioning(http://semver.org/).

## 4.1.0
- Add compatibility with Prestashop 8
- Add category ids to product tagging

## 4.0.5
- Remove tax calculation from supplier cost in product builder

Expand Down
7 changes: 0 additions & 7 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -112,13 +112,6 @@
<arg value="${buildsrc}/nostotagging.php"/>
</exec>
<delete file="${buildsrc}/nostotagging.php-e"/>
<exec executable="sed">
<arg value="-i"/>
<arg value="-e"/>
<arg value="s/$this->version = self::PLUGIN_VERSION/$this->version= '${version}'/g"/>
<arg value="${buildsrc}/nostotagging.php"/>
</exec>
<delete file="${buildsrc}/nostotagging.php-e"/>
</target>

<target name="phpmd">
Expand Down
4 changes: 3 additions & 1 deletion classes/helpers/NostoHelperController.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,9 @@ public static function resolveObject($idName, $klass, $method, $multiLanguageObj
}
$argsArray = array();
$argsArray['full'] = false;
$argsArray['idlang'] = $multiLanguageObject ? NostoHelperContext::getLanguageId() : null;
if ($multiLanguageObject) {
$argsArray['idlang'] = NostoHelperContext::getLanguageId();
}
$argsArray['idshop'] = NostoHelperContext::getShopId();
$argsForObject = array();
$argsForObject[] = $id; // First argument is always the id
Expand Down
8 changes: 4 additions & 4 deletions classes/helpers/NostoHelperFlash.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,15 @@ class NostoHelperFlash
public static function add($type, $message)
{
$cookie = Context::getContext()->cookie;
$cookieData = isset($cookie->nostotagging) ? Tools::jsonDecode($cookie->nostotagging, true) : array();
$cookieData = isset($cookie->nostotagging) ? json_decode($cookie->nostotagging, true) : array();
if (!isset($cookieData['flash_messages'])) {
$cookieData['flash_messages'] = array();
}
if (!isset($cookieData['flash_messages'][$type])) {
$cookieData['flash_messages'][$type] = array();
}
$cookieData['flash_messages'][$type][] = $message;
$cookie->nostotagging = Tools::jsonEncode($cookieData);
$cookie->nostotagging = json_encode($cookieData);
}

/**
Expand All @@ -61,11 +61,11 @@ public static function getList($type)
{
$flashMessages = array();
$cookie = Context::getContext()->cookie;
$cookieData = isset($cookie->nostotagging) ? Tools::jsonDecode($cookie->nostotagging, true) : array();
$cookieData = isset($cookie->nostotagging) ? json_decode($cookie->nostotagging, true) : array();
if (isset($cookieData['flash_messages'][$type])) {
$flashMessages = $cookieData['flash_messages'][$type];
unset($cookieData['flash_messages'][$type]);
$cookie->nostotagging = Tools::jsonEncode($cookieData);
$cookie->nostotagging = json_encode($cookieData);
}
return $flashMessages;
}
Expand Down
3 changes: 2 additions & 1 deletion classes/models/NostoProduct.php
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ protected function amendTags(Product $product)
}

/**
* Builds the category paths the product belongs to and returns them.
* Builds the category paths and ids the product belongs to .
*
* By "path" we mean the full tree path of the products categories and sub-categories.
*
Expand All @@ -345,6 +345,7 @@ protected function amendTags(Product $product)
protected function amendCategories(Product $product)
{
$productCategories = $product->getCategories();
$this->setCategoryIds($productCategories);
foreach ($productCategories as $categoryId) {
$category = new Category((int)$categoryId, NostoHelperContext::getLanguageId());
$nostoCategory = NostoCategory::loadData($category);
Expand Down
23 changes: 18 additions & 5 deletions classes/models/NostoSku.php
Original file line number Diff line number Diff line change
Expand Up @@ -92,13 +92,26 @@ protected function amendCustomFields(Combination $combination)
);
foreach ($attributes as $attributesInfo) {
$attributeId = $attributesInfo['id_attribute'];
$attribute = new Attribute(
$attributeId,
NostoHelperContext::getLanguageId(),
NostoHelperContext::getShopId()
);

if (version_compare(_PS_VERSION_, '8') < 0) {
$attribute = new Attribute(
$attributeId,
NostoHelperContext::getLanguageId(),
NostoHelperContext::getShopId()
);
} else {
/** @phan-suppress-next-next-line PhanUndeclaredClassMethod */
/** @noinspection PhpUndefinedClassInspection */
$attribute = new ProductAttribute(
$attributeId,
NostoHelperContext::getLanguageId(),
NostoHelperContext::getShopId()
);
}

$attributeName = $attributesInfo['name'];
$attributeGroup = new AttributeGroup(
/** @phan-suppress-next-line PhanUndeclaredClassProperty */
$attribute->id_attribute_group,
NostoHelperContext::getLanguageId(),
NostoHelperContext::getShopId()
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"AFL-3.0"
],
"require": {
"nosto/php-sdk": "^6.0",
"nosto/php-sdk": "^6.1",
"ext-json": "*"
},
"require-dev": {
Expand Down
14 changes: 7 additions & 7 deletions composer.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions nostotagging.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ class NostoTagging extends Module
*
* @var string
*/
const PLUGIN_VERSION = '4.0.5';
const PLUGIN_VERSION = '4.1.0';

/**
* Internal name of the Nosto plug-in
Expand Down Expand Up @@ -150,7 +150,7 @@ public function __construct()
$this->bootstrap = true; // Necessary for Bootstrap CSS initialisation in the UI
$this->author = 'Nosto';
$this->need_instance = 1;
$this->ps_versions_compliancy = array('min' => '1.5.5.0', 'max' => '2');
$this->ps_versions_compliancy = array('min' => '1.5.5.0', 'max' => '8.1.0');
$this->module_key = '8d80397cab6ca02dfe8ef681b48c37a3';

parent::__construct();
Expand Down

0 comments on commit 93bc1d2

Please sign in to comment.