1

UPDATE
I've used the Firebear ImportExport Extension for now. That works without any problem. Its pricey but worth the money if magento cant get something "simple" like this working.


Good day,
we recently switched from Magento 2.3.x to Magento 2.4.6p2 on a fresh installation so i can rebuild our store without using old data and migrations.

I've created a multiselect attribute for some notes wich our supplier provides as numbers with a string as declaration.
For example:
2,97 where 2 = only suitable for xy & 97 = Not certified for ab

I've created the attribute and filled all the values, now its time to import. I've created the product import CSV and created a row with the attribute and the numbers which are also listed on admin view. The importer seems to take every entry as one so that 2,97 are one value and not seperated by the comma. I've also set the Multiple value separator on the importer to , but that doesnt seem to work.

Is there a work arround for that?


CSV Structure

sku;notes
KW_35290831_108031;2,97

Field separator: ;
Multiple value separator: ,


Magento Errors
Data validation failed. Please fix the following errors and upload the file again.

1. Value for 'notes' attribute contains incorrect value, see acceptable values on settings specified for Admin in row(s)

Each value is saved in the attribute but values with more than one number gets recognized as one by magento. Adding each possible value combination is no solution for the issue.

2
  • This is a Magento bug.
    – Sohel Rana
    Aug 16, 2023 at 9:04
  • Thought so, is there any workaround for that yet? or a patch?
    – Marcel H.
    Aug 16, 2023 at 9:07

2 Answers 2

0
  1. Modify the CSV Format

Since you mentioned that the importer is treating the entire value (e.g., "2,97") as one value, you can try modifying your CSV format.

Example CSV format:

sku,custom_notes product123,2|97

  1. Modify Import Settings

  2. Post-Import Attribute Update

Stores > Attributes > Product

After you've added these options, you can use the following SQL command to update the product attribute values based on the imported values:

UPDATE catalog_product_entity_varchar SET value = '2' WHERE attribute_id = (SELECT attribute_id FROM eav_attribute WHERE attribute_code = 'custom_notes') AND value = '2|97';

Repeat this SQL command for each individual value you need to separate.

1
  • Since there are roughly arround a thousand combinations of numbers this isnt a viable option but thanks for the effort
    – Marcel H.
    Aug 16, 2023 at 12:10
0

Here is the patch that you can use:

diff --git a/vendor/magento/module-catalog-import-export/Model/Import/Product/Type/AbstractType.php b/vendor/magento/module-catalog-import-export/Model/Import/Product/Type/AbstractType.php
--- a/vendor/magento/module-catalog-import-export/Model/Import/Product/Type/AbstractType.php    2023-05-16 17:11:06.000000000 +0600
+++ b/vendor/magento/module-catalog-import-export/Model/Import/Product/Type/AbstractType.php    2023-08-16 16:02:45.000000000 +0600
@@ -535,7 +535,7 @@
                     $resultAttrs[$attrCode] = $attrParams['options'][strtolower($rowData[$attrCode])];
                 } elseif ('multiselect' == $attrParams['type']) {
                     $resultAttrs[$attrCode] = [];
-                    foreach ($this->_entityModel->parseMultiselectValues($rowData[$attrCode]) as $value) {
+                    foreach ($this->_entityModel->parseMultiselectValues($rowData[$attrCode], $this->_entityModel->getMultipleValueSeparator()) as $value) {
                         $resultAttrs[$attrCode][] = $attrParams['options'][strtolower($value)];
                     }
                     $resultAttrs[$attrCode] = implode(',', $resultAttrs[$attrCode]);
1
  • Thank you for that quick response. Unfortunately it doesn work - Still returns the following error: Data validation failed. Please fix the following errors and upload the file again.. File is build with semicolumn as seperator and comma as multiple values seperator. Each value is saved in the attribute.
    – Marcel H.
    Aug 16, 2023 at 11:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.