1

I want to modify value of custom attribute of custom attribute set in observer. I can modify some core attribute which is having setter method like $item->setCustomPrice($custom_price);
but I could not found any setter method for custom attribute. I tried with like $item->setData('voucher_value', 259); Also tried like

              $item->addOption(array(
                "product_id" => $item->getProduct()->getId(),
                "product" => $item->getProduct(),
                "code" => "voucher_value",
                "value" => serialize($results)
            ));  

But could not set value. Please Help.

2
  • i guess you can give a try like this $item->setVoucherValue(259), I guess your custm attribute is voucher_value – Mujahidh Oct 6 '15 at 9:39
  • I tried this but not working. voucher_value is attribute of 'Voucher' attribute set. – Sagardevd Oct 6 '15 at 9:46
0

You can always use setters and getters thanks to the magic methods of Varien_Object, or set it directly with $item->setData('voucher_value', 259) if you prefer. Attribute sets do not matter here.

But quote items do not automatically inherit product attributes. It's not clear from the question what exactly you are trying to achieve, but this tutorial should help you: http://www.atwix.com/magento/custom-product-attribute-quote-order-item/

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.