AvS_FastSimpleImport icon indicating copy to clipboard operation
AvS_FastSimpleImport copied to clipboard

Missing select/multiselect attribute options are created but import fails anyway

Open pogster opened this issue 8 years ago • 0 comments

Hi!

I have activated the creation of new attribute options. The import will fail with error messages:

:::: Invalid value for 'kabelfarbe_lichterketten'. Possible options are: braun, grün, schwarz, transparent, weiß. Your input: silber :::: In Line(s) 1, 2

Looking at the code I'm not sure how it is supposed to work.

As far as I can see it the attributes are initialized in Mage_ImportExport_Model_Import_Entity_Product_Type_Abstract in the constructor.

The method _createAttributeOption is called in the AvS_FastSimpleImport_Model_Import_Entity_Product::validateData (before validation) and will not extend the _attributes created earlier.

In consequence, this code in AvS_FastSimpleImport_Model_Import_Entity_Product::isAttributeValid will fail (i.e. $valid == false):

case 'select':
case 'multiselect':
    $isAutocreate = isset($this->_dropdownAttributes[$attrCode]) || isset($this->_multiselectAttributes[$attrCode]);
    if ($this->getIsDryRun() && ($isAutocreate)) {
        $valid = true; // Force validation in case of dry run with options of dropdown or multiselect which doesn't yet exist
        break;
    }
    $valid = isset($attrParams['options'][strtolower($rowData[$attrCode])]);
    $message = 'Possible options are: ' . implode(', ', array_keys($attrParams['options'])) . '. Your input: ' . $rowData[$attrCode];
    break;

There are several ways to workaround this problem, how is it intended to work?

pogster avatar Aug 15 '16 15:08 pogster