문제

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.

도움이 되었습니까?

해결책

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();
라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 magento.stackexchange
scroll top