From c285398e0334df9ee822944da4a28d3b91d91dfe Mon Sep 17 00:00:00 2001 From: magentix Date: Wed, 6 Nov 2024 16:00:55 +0100 Subject: [PATCH 1/3] AMC-483: Dot not use option code as admin label in single store mode --- Helper/Store.php | 10 +++++++++- Job/Option.php | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/Helper/Store.php b/Helper/Store.php index de924e93..b6be382a 100644 --- a/Helper/Store.php +++ b/Helper/Store.php @@ -111,7 +111,7 @@ public function getStores($arrayKey = 'store_id') continue; } - if ($this->storeManager->isSingleStoreMode() && (int)$websiteId !== 0) { + if ($this->isSingleStoreMode() && (int)$websiteId !== 0) { continue; } @@ -195,6 +195,14 @@ public function getStores($arrayKey = 'store_id') return $data; } + /** + * @return bool + */ + public function isSingleStoreMode(): bool + { + return $this->storeManager->isSingleStoreMode(); + } + /** * Retrieve all store combination * diff --git a/Job/Option.php b/Job/Option.php index c3193829..c5ac0904 100644 --- a/Job/Option.php +++ b/Job/Option.php @@ -532,7 +532,7 @@ public function insertSwatchOption(): void /** @var string $value */ $value = 'labels-' . $local; - if ($this->configHelper->getOptionCodeAsAdminLabel() && $store['store_id'] == 0) { + if (!$this->storeHelper->isSingleStoreMode() && $this->configHelper->getOptionCodeAsAdminLabel() && $store['store_id'] == 0) { $value = 'code'; } From 6a5914b25cebdcbbca7f76a747e9215a985e4cda Mon Sep 17 00:00:00 2001 From: magentix Date: Tue, 19 Nov 2024 14:05:33 +0100 Subject: [PATCH 2/3] AMC-483: Fix single store mode URL rewrite --- Helper/Store.php | 5 +++-- Job/Category.php | 2 +- Job/Product.php | 8 ++++---- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Helper/Store.php b/Helper/Store.php index b6be382a..9f1e7a74 100644 --- a/Helper/Store.php +++ b/Helper/Store.php @@ -79,10 +79,11 @@ public function __construct( * Retrieve all stores information * * @param string|string[] $arrayKey + * @param bool $ignoreSingleStore * * @return mixed[] */ - public function getStores($arrayKey = 'store_id') + public function getStores($arrayKey = 'store_id', bool $ignoreSingleStore = false) { if (!is_array($arrayKey)) { $arrayKey = [$arrayKey]; @@ -111,7 +112,7 @@ public function getStores($arrayKey = 'store_id') continue; } - if ($this->isSingleStoreMode() && (int)$websiteId !== 0) { + if (!$ignoreSingleStore && $this->isSingleStoreMode() && (int)$websiteId !== 0) { continue; } diff --git a/Job/Category.php b/Job/Category.php index 8d9f0bd4..50fe5a36 100755 --- a/Job/Category.php +++ b/Job/Category.php @@ -788,7 +788,7 @@ public function setUrlRewrite() /** @var string $tableName */ $tmpTable = $this->entitiesHelper->getTableName($this->jobExecutor->getCurrentJob()->getCode()); /** @var array $stores */ - $stores = $this->storeHelper->getStores('lang'); + $stores = $this->storeHelper->getStores('lang', true); /** @var mixed[] $categoryPath */ $categoryPath = $this->getCategoryPath(); /** @var mixed[] $rootCatAndStore */ diff --git a/Job/Product.php b/Job/Product.php index c759335a..c6535119 100644 --- a/Job/Product.php +++ b/Job/Product.php @@ -3669,9 +3669,9 @@ public function setUrlRewrite(): void $urlRewriteTable = $this->entitiesHelper->getTable('url_rewrite'); $productCategoriesTable = $this->entitiesHelper->getTable('catalog_category_product'); $stores = array_merge( - $this->storeHelper->getStores(['lang']), // en_US - $this->storeHelper->getStores(['lang', 'channel_code']), // en_US-channel - $this->storeHelper->getStores(['channel_code']) // channel + $this->storeHelper->getStores(['lang'], true), // en_US + $this->storeHelper->getStores(['lang', 'channel_code'], true), // en_US-channel + $this->storeHelper->getStores(['channel_code'], true) // channel ); $isUrlMapped = false; @@ -3687,7 +3687,7 @@ public function setUrlRewrite(): void // Reset stores variable to generate a column per store when nothing is mapped or url_key is global if (!$isUrlMapped) { $stores = array_merge( - $this->storeHelper->getStores(['lang']) // en_US + $this->storeHelper->getStores(['lang'], true) // en_US ); } From fc69208cf5ef86c126ed16a9c86b0f6469184d8c Mon Sep 17 00:00:00 2001 From: magentix Date: Tue, 17 Dec 2024 10:41:33 +0100 Subject: [PATCH 3/3] Bump to 104.3.17 --- CHANGELOG.md | 4 ++++ composer.json | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9a75cf7d..d606ed3d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -526,3 +526,7 @@ ### Version 104.3.16 : * PGTO-398: Do not create an empty value for visual and color swatch in stores + +### Version 104.3.17 : +* AMC-483: Dot not use option code as admin label in single store mode +* AMC-483: Fix single store mode URL rewrite diff --git a/composer.json b/composer.json index 42004c84..678c2c1e 100644 --- a/composer.json +++ b/composer.json @@ -14,7 +14,7 @@ "nyholm/psr7": "^1.5" }, "type": "magento2-module", - "version": "104.3.16", + "version": "104.3.17", "license": [ "OSL-3.0", "AFL-3.0"