From bf3887534ab6aba795c98682e114a2b638a46634 Mon Sep 17 00:00:00 2001 From: Dair Baidauletov Date: Wed, 11 Jan 2023 14:34:26 +0200 Subject: [PATCH 1/4] Add store filter to category collection --- Model/Service/Product/Category/DefaultCategoryService.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Model/Service/Product/Category/DefaultCategoryService.php b/Model/Service/Product/Category/DefaultCategoryService.php index d1845f788..419aee8b7 100644 --- a/Model/Service/Product/Category/DefaultCategoryService.php +++ b/Model/Service/Product/Category/DefaultCategoryService.php @@ -85,7 +85,8 @@ public function __construct( public function getCategories(Product $product, StoreInterface $store) { $categories = []; - foreach ($product->getCategoryCollection() as $category) { + foreach ($product->getCategoryCollection()->setStore($store->getId()) as $category) { + $rootCategoryId = $store->getRootCategoryId(); $categoryString = $this->getCategory($category, $store); if (!empty($categoryString)) { $categories[] = $categoryString; From 34589e8af1ada38833fcbd71256b6c76a3486dc1 Mon Sep 17 00:00:00 2001 From: Dair Baidauletov Date: Wed, 11 Jan 2023 14:37:55 +0200 Subject: [PATCH 2/4] bump version --- CHANGELOG.md | 3 +++ composer.json | 2 +- etc/module.xml | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ec8f00f47..a7bb54cbe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ All notable changes to this project will be documented in this file. This project adheres to Semantic Versioning. +### 7.2.1 +* Add store filter to the DefaulCategoryService to generate categories for specific store + ### 7.2.0 * Remove `nosto_product_sync` message queue consumer diff --git a/composer.json b/composer.json index bb2271fd3..f3c5842e5 100644 --- a/composer.json +++ b/composer.json @@ -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": "7.2.0", + "version": "7.2.1", "require-dev": { "phpmd/phpmd": "^2.5", "sebastian/phpcpd": "*", diff --git a/etc/module.xml b/etc/module.xml index cfbd2b7d3..cb7bd78e3 100755 --- a/etc/module.xml +++ b/etc/module.xml @@ -37,5 +37,5 @@ - + From fe9bef3898d9ef103821ec3e4f1b78adab216602 Mon Sep 17 00:00:00 2001 From: Dair Baidauletov Date: Wed, 11 Jan 2023 14:40:14 +0200 Subject: [PATCH 3/4] Remove unnecessary statement --- Model/Service/Product/Category/DefaultCategoryService.php | 1 - 1 file changed, 1 deletion(-) diff --git a/Model/Service/Product/Category/DefaultCategoryService.php b/Model/Service/Product/Category/DefaultCategoryService.php index 419aee8b7..ea59616ae 100644 --- a/Model/Service/Product/Category/DefaultCategoryService.php +++ b/Model/Service/Product/Category/DefaultCategoryService.php @@ -86,7 +86,6 @@ public function getCategories(Product $product, StoreInterface $store) { $categories = []; foreach ($product->getCategoryCollection()->setStore($store->getId()) as $category) { - $rootCategoryId = $store->getRootCategoryId(); $categoryString = $this->getCategory($category, $store); if (!empty($categoryString)) { $categories[] = $categoryString; From e775b464e4b3a51054f4576d360d81facc7b7e07 Mon Sep 17 00:00:00 2001 From: Dair Baidauletov Date: Wed, 11 Jan 2023 14:51:48 +0200 Subject: [PATCH 4/4] Phan suppress undeclared method --- Model/Service/Product/Category/DefaultCategoryService.php | 1 + 1 file changed, 1 insertion(+) diff --git a/Model/Service/Product/Category/DefaultCategoryService.php b/Model/Service/Product/Category/DefaultCategoryService.php index ea59616ae..316e16823 100644 --- a/Model/Service/Product/Category/DefaultCategoryService.php +++ b/Model/Service/Product/Category/DefaultCategoryService.php @@ -85,6 +85,7 @@ public function __construct( public function getCategories(Product $product, StoreInterface $store) { $categories = []; + /** @phan-suppress-next-line PhanUndeclaredMethod */ foreach ($product->getCategoryCollection()->setStore($store->getId()) as $category) { $categoryString = $this->getCategory($category, $store); if (!empty($categoryString)) {