Skip to content

Commit

Permalink
Merge pull request #712 from akeneo/release/104.3.17
Browse files Browse the repository at this point in the history
Release/104.3.17
  • Loading branch information
magentix authored Dec 17, 2024
2 parents 2ac5c3b + fc69208 commit e9c9ff8
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 9 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
13 changes: 11 additions & 2 deletions Helper/Store.php
Original file line number Diff line number Diff line change
Expand Up @@ -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];
Expand Down Expand Up @@ -111,7 +112,7 @@ public function getStores($arrayKey = 'store_id')
continue;
}

if ($this->storeManager->isSingleStoreMode() && (int)$websiteId !== 0) {
if (!$ignoreSingleStore && $this->isSingleStoreMode() && (int)$websiteId !== 0) {
continue;
}

Expand Down Expand Up @@ -195,6 +196,14 @@ public function getStores($arrayKey = 'store_id')
return $data;
}

/**
* @return bool
*/
public function isSingleStoreMode(): bool
{
return $this->storeManager->isSingleStoreMode();
}

/**
* Retrieve all store combination
*
Expand Down
2 changes: 1 addition & 1 deletion Job/Category.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
2 changes: 1 addition & 1 deletion Job/Option.php
Original file line number Diff line number Diff line change
Expand Up @@ -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';
}

Expand Down
8 changes: 4 additions & 4 deletions Job/Product.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
);
}

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit e9c9ff8

Please sign in to comment.