I have an extra custom field on cart page. If any user inputs something in that field and updates the cart than I need to add extra 4 Pounds to the cart having label as "Extra Price".
I am using
<checkout_cart_save_after>
<observers>
<module_cart_update>
<type>singleton</type>
<class>webroot/observer</class>
<method>logopriceMethod</method>
</module_cart_update>
</observers>
</checkout_cart_save_after>
Following is my current code :
public function logopriceMethod(Varien_Event_Observer $observer){
$invoice = $observer->getEvent()->getInvoice();
$order = $invoice->getOrder();
$order->setExtraFeeAmountInvoiced($order->getExtraFeeAmountInvoiced() + 4);
$order->setBaseExtraFeeAmountInvoiced($order->getExtraFeeAmountInvoiced() + 4);
}
But the above code gives me following error :
Fatal error: Call to a member function getOrder() on null in /var/www/clients/.../Model/Observer.php on line 52
I am using THIS module but it adds custom price as soon as a product is added to cart. What I am trying is to modify the code so as to add extra price on cart update (If there is any value in custom field on cart page).