Skip to content

Can't import attribute option over API if option is 'visual swatch' #10737

@slavkodick

Description

@slavkodick

Preconditions

  1. Magento 2.1.8

Steps to reproduce

  1. Import Attribute Option of type visual swatch (Color for example) over http request (API)

  2. Code example:
    {
    $option = $this->attrOptionFactory->create();
    $optionLabel = $this->attrOptionLabelFactory->create();

     $optionLabel->setStoreId(0);
     $optionLabel->setLabel('new_color');
    
     $option->setLabel('new_color');
     $option->setStoreLabels(array($optionLabel));
     
     $this->productAttributeOptionManagement->add('color', $option);
    

    }

Expected result

  1. New Attribute Option should be imported to backend

Actual result

  1. New Atttribute Option does not get imported because there is no entry in eav_attribute_option_swatch table

More info

Until Magento 2.1.7 the plugin did not trigger beforeSave function in swatches/Model/Plugin/EavAttribute and the Import data had not to match visual swatch data structure, it was imported
Since Magento 2.1.8 the function is renamed to beforeBeforeSave and the plugin triggers it,
so the Import data has to follow data structure of visual swatch, but since it is a API Import there is no entry in database and the new Option does not get imported

Metadata

Metadata

Assignees

Labels

Component: Framework/WebapiUSE ONLY for FRAMEWORK RELATED BUG! E.g If bug related to Catalog WEB API use just CatalogIssue: Clear DescriptionGate 2 Passed. Manual verification of the issue description passedIssue: Format is validGate 1 Passed. Automatic verification of issue format passedProgress: needs update

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions