I have created attributes that save directly to a quote item in my checkout_cart_product_add_after
Observer method will not persist the value as it seems to be reverted after the Observer exits.
See code samples below:
config.xml (snippet):
<checkout_cart_product_add_after>
<observers>
<module>
<type>model</type>
<class>NativeRemedies_OrderGroove_Model_Observer</class>
<method>productAddAfter</method>
</module>
</observers>
</checkout_cart_product_add_after>
Observer.php (snippet):
public function handleOrderGroove()
{
foreach($this->og->products as $_product){
if($_product->every>0){
foreach($this->_quote->getAllVisibleItems() as $_item){
//if sku is in the active list of recurring products selected add quote item id to array
if($_item->getSku()==$_product->id){
Mage::helper('nrordergroove')->setRecurringItem($_item->getItemId());
$_item->setOrdergrooveActive(true)->save();
$_item->getProduct()->setPrice(2);
$_item->setCustomPrice(2);
$_item->setOriginalCustomPrice(2);
$_item->getProduct()->setIsSuperMode(true);
}
}
} // else, do nothing
}
The $_item object in this example isn't providing the facility to retain the attribute as set - even when calling ->save()
.
Thank in advance for your help. I have seen all of the tutorials about setting custom prices and attributes - nothing seems to remedy the situation!
Edit 1
I'm starting to feel like this is a bug in 1.6+. I have seen much discussion on various boards about this working in >=1.4.
Edit 2
Just to be absolutely clear, the issue here is that the Custom Pricing attribute is being overwritten effectively by the Product model or the collectTotals methods. I need a workaround.