0

I have added additional colomns description and image in eav_attribute_option_value table.

Which means each option of an custom attribute has its own description and image.

I have saved the attribute options for an attribute, but failed to save options's image and description please provide me a solution.

function getAddOptions($objectManager, $option, $attributeName)
{
    $eavConfig = $objectManager->create('\Magento\Eav\Model\Config');
    $attribute = $eavConfig->getAttribute('catalog_product', $attributeName);
    $status = checkExistingOptions($option, $eavConfig, $attribute);
    if (!$status) {
        $newOption['attribute_id'] = $attribute->getAttributeId();


        $newOption['value'][0][0] = $option;
        $newOption['description'][0][0] = 'nice color';

        $eavSetup = $objectManager->get('\Magento\Eav\Setup\EavSetup');
        $eavSetup->addAttributeOption($newOption);
        // $eavSetup->addAttributeDescription($descArray);
    }
}
2
  • add code what you have tried so far Jul 28 '18 at 5:20
  • It saves only the option but failed to save the description
    – Jaisa
    Jul 28 '18 at 5:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.