How to get the ID of a custom attribute when having the custom attribute text value?
-
30-10-2019 - |
Question
I want to update a custom attribute and I can do that like this:
$product = Mage::getModel('catalog/product')
->loadByAttribute('sku',"mysku");
$product->addAttributeUpdate('manufacturer', 281);
echo $product->getAttributeText('manufacturer');
In addAttributeUpdate()
instead of passing 281
which is the ID
I only have an attribute text so I should get the ID of that attribute text and insert it in the place of 281
How can I do that?
$attrtext = 'myatttext';
$product->addAttributeUpdate('manufacturer', $attrtext->getId() /* ???????? */);
No correct solution
Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange