From d3453b76525de370ec13e92d70bba64865cc400a Mon Sep 17 00:00:00 2001 From: magentix Date: Thu, 24 Oct 2024 14:32:49 +0200 Subject: [PATCH 1/8] PGTO-398: Do not create an empty value for visual swatch in stores --- Job/Option.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Job/Option.php b/Job/Option.php index 81a3dada..824715d5 100644 --- a/Job/Option.php +++ b/Job/Option.php @@ -557,6 +557,11 @@ public function insertSwatchOption(): void foreach ($swatchesAttributesData as $swatchesAttributeData) { $optionTypeAndValue = $this->getTypeAndValue($swatchesAttributes, $swatchesAttributeData); + if ((int)$optionTypeAndValue['type'] === Swatch::SWATCH_TYPE_VISUAL_IMAGE && + (int)$swatchesAttributeData['store_id'] !== 0) + { + continue; + } $dataToInsert[] = [ 'option_id' => $swatchesAttributeData['option_id'], 'store_id' => $swatchesAttributeData['store_id'], @@ -597,8 +602,9 @@ public function getTypeAndValue(array $swatchesAttributes, array $swatchesAttrib $current = $connection->fetchRow( $connection->select() ->from($this->entitiesHelper->getTable('eav_attribute_option_swatch'), ['value', 'type']) - ->where('store_id = ?', $swatchesAttributeData['store_id']) + ->where('store_id = 0 OR store_id = ?', $swatchesAttributeData['store_id']) ->where('option_id = ?', $swatchesAttributeData['option_id']) + ->order('store_id DESC') ->limit(1) ); if (!empty($current)) { From d74020337880dc012dd9a58f221f03f63ca5284c Mon Sep 17 00:00:00 2001 From: magentix Date: Thu, 24 Oct 2024 14:37:20 +0200 Subject: [PATCH 2/8] PGTO-472: Empty product model option label if not exist for local --- Helper/ProductModel.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Helper/ProductModel.php b/Helper/ProductModel.php index 832cec4c..08ccfcd2 100644 --- a/Helper/ProductModel.php +++ b/Helper/ProductModel.php @@ -283,7 +283,7 @@ public function insertData(AkeneoPimClientInterface $akeneoClient, array $filter /** @var string[][] $option */ foreach ($config['options'] as $option) { if ($option['code'] === $newData || $option['code'] === $label) { - $table['data'][$i][$label] = [$newLabel => $option['labels'][$locale]]; + $table['data'][$i][$label] = [$newLabel => $option['labels'][$locale] ?? '']; } } } @@ -441,7 +441,7 @@ public function getMetricsSymbols($akeneoClient) * * @param string $code * @param string|null $family - * + * * @return void */ public function addColumns($code, ?string $family = null) From 2a1bb006b1797b7f3db1859104d4029e7932d1b3 Mon Sep 17 00:00:00 2001 From: magentix Date: Thu, 24 Oct 2024 14:38:11 +0200 Subject: [PATCH 3/8] PGTO-463: Fix empty option label error for table attributes --- Job/Product.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Job/Product.php b/Job/Product.php index ceb068a1..3ea28961 100644 --- a/Job/Product.php +++ b/Job/Product.php @@ -752,7 +752,7 @@ public function insertData() /** @var string[][] $option */ foreach ($config['options'] as $option) { if ($option['code'] === $newData || $option['code'] === $label) { - $table['data'][$i][$label] = [$newLabel => $option['labels'][$locale]]; + $table['data'][$i][$label] = [$newLabel => $option['labels'][$locale] ?? '']; } } } From bbd001b34d49cd17c34ef94634c9f0ee014651f8 Mon Sep 17 00:00:00 2001 From: magentix Date: Thu, 24 Oct 2024 14:39:06 +0200 Subject: [PATCH 4/8] Set default product name to empty instead of null --- Job/Product.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Job/Product.php b/Job/Product.php index 3ea28961..13bcd9f9 100644 --- a/Job/Product.php +++ b/Job/Product.php @@ -5188,7 +5188,7 @@ protected function handleNoName(): void $connection->query('INSERT IGNORE INTO `' . $entityVarcharTable . '` (`attribute_id`, `store_id`, `value`, `' . $columnIdentifier . '`) - SELECT ' . $attribute->getId() . ', 0, NULL, `' . $columnIdentifier . '` FROM `' . $entityTable . '` e + SELECT ' . $attribute->getId() . ', 0, "", `' . $columnIdentifier . '` FROM `' . $entityTable . '` e INNER JOIN `' . $tmpTable . '` t ON e.`entity_id` = t.`_entity_id`'); } } From 18bbde87ab585be5507f323d89e62b86bee6cadd Mon Sep 17 00:00:00 2001 From: magentix Date: Thu, 24 Oct 2024 14:42:49 +0200 Subject: [PATCH 5/8] PGTO-479: Fix UUID error when product models have no variant --- Job/Product.php | 27 ++++++++++++++------------- 1 file changed, 14 insertions(+), 13 deletions(-) diff --git a/Job/Product.php b/Job/Product.php index 13bcd9f9..77f8fc54 100644 --- a/Job/Product.php +++ b/Job/Product.php @@ -605,8 +605,6 @@ public function createTable() __('No product found for family: %1 but product model found, process with import', $family), $this->logger ); - - return; } else { $product = reset($products); // Make sure to delete product model table @@ -621,17 +619,20 @@ public function createTable() if ($this->entitiesHelper->isProductUuidEdition()) { $tmpTable = $this->entitiesHelper->getTableName($this->jobExecutor->getCurrentJob()->getCode()); - $connection->changeColumn( - $tmpTable, - 'uuid', - 'uuid', - [ - 'nullable' => true, - 'type' => Table::TYPE_TEXT, - 'length' => 255, - 'comment' => 'UUID', - ] - ); + $definition = [ + 'nullable' => true, + 'type' => Table::TYPE_TEXT, + 'length' => 255, + 'comment' => 'UUID', + ]; + + if ($connection->tableColumnExists($tmpTable, 'uuid')) { + $connection->changeColumn($tmpTable, 'uuid', 'uuid', $definition); + } else { + // We have no product (like product models without variant) with applied filters + // We need to add manually the column + $connection->addColumn($tmpTable, 'uuid', $definition); + } $connection->addIndex($tmpTable, 'UNIQUE_UUID', 'uuid', 'unique'); } } From 161ffd219635faccd5d002ad16b1f3564c6c3041 Mon Sep 17 00:00:00 2001 From: magentix Date: Thu, 24 Oct 2024 14:52:11 +0200 Subject: [PATCH 6/8] Update UUID according sku configured column --- Job/Product.php | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/Job/Product.php b/Job/Product.php index 77f8fc54..c759335a 100644 --- a/Job/Product.php +++ b/Job/Product.php @@ -1726,12 +1726,14 @@ public function matchEntities() return; } - if ($this->entitiesHelper->isProductUuidEdition() && $connection->tableColumnExists($tmpTable, 'sku')) { - // We replace the sku by the uuid in the Akeneo entities table if needed for retro-compatibility + $skuColumn = $this->configHelper->getAkeneoAttributeCodeForSku() ?: 'sku'; + + if ($this->entitiesHelper->isProductUuidEdition() && $connection->tableColumnExists($tmpTable, $skuColumn)) { + // We replace the sku by the uuid in the Akeneo entities table if needed $entitiesTable = $this->entitiesHelper->getTable('akeneo_connector_entities'); $uuids = $connection->select() ->from(false, ['code' => 'tmp.uuid']) - ->joinInner(['tmp' => $tmpTable], '`tmp`.`sku` = `ace`.`code`', []) + ->joinInner(['tmp' => $tmpTable], '`tmp`.`' . $skuColumn . '` = `ace`.`code`', []) ->where('`ace`.`import` = ?', 'product'); $connection->query($connection->updateFromSelect($uuids, ['ace' => $entitiesTable])); } From 376179bea6f0664f3045739dde76761d723e1679 Mon Sep 17 00:00:00 2001 From: magentix Date: Thu, 24 Oct 2024 14:52:59 +0200 Subject: [PATCH 7/8] PGTO-480: Fix request to match existing options --- Helper/Import/Option.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Helper/Import/Option.php b/Helper/Import/Option.php index 047d3800..4097929f 100644 --- a/Helper/Import/Option.php +++ b/Helper/Import/Option.php @@ -98,7 +98,7 @@ public function matchEntity($pimKey, $entityTable, $entityKey, $import, $prefix ['a' => $this->getTable('eav_attribute')], 'o.`attribute_id` = a.`attribute_id` AND t.`attribute` = a.`attribute_code`', [] - )->where('e.store_id = ?', 0)->where('a.entity_type_id', $entityTypeId); + )->where('e.store_id = ?', 0)->where('a.entity_type_id = ?', $entityTypeId); /** @var string[] $existingMagentoOptions */ $existingMagentoOptions = $connection->query($select)->fetchAll(); /** @var string[] $existingMagentoOptionIds */ From 71cc5b84c4ab34d267894497f31f1ba5432afb7d Mon Sep 17 00:00:00 2001 From: magentix Date: Thu, 24 Oct 2024 14:58:20 +0200 Subject: [PATCH 8/8] Bump to 104.3.15 --- CHANGELOG.md | 9 +++++++++ composer.json | 2 +- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index eec538cf..b236280c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -514,3 +514,12 @@ * PGTO-340: Fix job executor date format * PGTO-462: Set attribute code to lowercase for options * Fix non-scopable localizable attribute import + +### Version 104.3.15 : +* PGTO-398: Do not create an empty value for visual swatch in stores +* PGTO-463: Fix empty option label error for table attributes +* PGTO-472: Empty product model option label if not exist for local +* PGTO-479: Fix UUID error when product models have no variant +* PGTO-480: Fix request to match existing options +* Set default product name to empty instead of null +* Update UUID according sku configured column diff --git a/composer.json b/composer.json index 41173aaf..8bf69715 100644 --- a/composer.json +++ b/composer.json @@ -14,7 +14,7 @@ "nyholm/psr7": "^1.5" }, "type": "magento2-module", - "version": "104.3.14", + "version": "104.3.15", "license": [ "OSL-3.0", "AFL-3.0"