i try to add the value of an custom select and multiselect attribute in my custom product import job. But it do not work.
F.e. I have a custom SELECT attribute "pattern" with values (A,B,C), than i try to add the related product value in my import:
...
$oSimpleProduct = $this->_objectManager->create('\Magento\Catalog\Model\Product');
// ... add the min req. attributes
// HERE is my problem ... $oProductItem->getPattern() has value "A"
$oSimpleProduct->setCustomAttribute('pattern', $oProductItem->getPattern());
$oSimpleProduct->save();
...
After the save the product shows up in the magento admin .. but the field is still empty. If i load the product field it shows:
object(Magento\Framework\Api\AttributeValue)#3969 (1) {
["_data":protected]=>
array(2) {
["attribute_code"]=>
string(7) "pattern"
["value"]=>
string(1) "0"
}
}
Do anyone know what i am doing wrong? - How can i add SELECT AND MULTISELECT Values?