0

I have list of option value for attribute, But i just need to save this value in attribute at one time .

i already used below script, using this script i have to save attribute on every new option add.

$languageValues[0] = $item;
$attr = $objectManager->create('\Magento\Eav\Model\Entity\Attribute'); 
$attr->load($attributeShopbyID->getId()); 
$option = array(); 
$option['value']['shopbyattribute'] = $languageValues; 
$attr->addData(array('option' => $option));
$attr->save();

instead of saving attribute every time i just need to save all option at once.

1 Answer 1

0

Below solution is work for me :

$languageValues[0] = $item;
$attr = $objectManager->create('\Magento\Eav\Model\Entity\Attribute'); 
$attr->load($attributeShopbyID->getId()); 
$option = array(); 
$option['value']['shopbyattribute'.$i] = $languageValues; 
$attr->addData(array('option' => $option));
$attr->save();

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.