Here is the modules config file: app\etc\modules\Cart_Updates.xml
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<Cart_Updates>
<codePool>local</codePool>
<active>true</active>
</Cart_Updates>
</modules>
</config>
Here is my config file : in app\code\local\Cart\Updates\etc\config.xml
<?xml version="1.0"?>
<config>
<modules>
<Cart_Updates>
<version>1.0.1</version>
</Cart_Updates>
</modules>
<global>
<models>
<Cart_Updates>
<class>Cart_Updates_Model</class>
</Cart_Updates>
</models>
<events>
<sales_quote_add_item>
<observers>
<cart_updates_model_observer>
<type>singleton</type>
<class>Cart_Updates_Model_Observer</class>
<method>updatePrice</method>
</cart_updates_model_observer>
</observers>
</sales_quote_add_item>
</events>
</global>
</config>
And here is the Observer: in app\code\local\Cart\Updates\Model\Observer.php
<?php
class Cart_Updates_Model_Observer {
public function modifyPrice(Varien_Event_Observer $observer) {
//exit;
$order = Mage::registry('current_order'); //For getting current order
echo $orderid = $order->getRealOrderId(); // For getting orderid
$quote_item = $observer->getQuoteItem();
$payment = 30; //add your custom product price here and do your logic here
$quote_item->setOriginalCustomPrice($payment);
$quote_item->save();
return $this;
}
}
?>