I am developing a store in which you can buy a card at fixed price and can add any amount as per users wish.
So when product added to cart product price should be calculated in such a way that product price+amount choosen by customer. in addition to this other concepts are as same as magento default function like shipping mod charges, delivery charges etc..
To do this I am creating an observer event checkout_cart_product_add_after.
I created a module and calling checkout_cart_product_add_after event.
Below in my module config file
<config>
.
.
.
<global>
<events>
<checkout_cart_product_add_after>
<observers>
<ucs_catalogorder_checkout_cart_product_add_after>
<type>model</type>
<class>Ucs_CatalogOrder_Model_Observer</class>
<method>checkoutCartProductAddAfter</method>
</ucs_catalogorder_checkout_cart_product_add_after>
</observers>
</checkout_cart_product_add_after>
</events>
</global>
</config>
and below is the Observer.php
<?php
class Ucs_CatalogOrder_Model_Observer
{
public function checkoutCartProductAddAfter($observer) {
$item = $observer->getEvent()->getQuoteItem();
$walletAmount = Mage::app()->getRequest()->getPost('card_wallet_amount');
$item->setCustomPrice($walletAmount);
$item->setOriginalCustomPrice($walletAmount);
$item->setCardWalletAmount($walletAmount);
//$item->save();
$item->getProduct()->setIsSuperMode(true);
return $this;
}
I have a custom field card_wallet_amount in my sales_flat_quote_item table, this field, custom_price and original_custom_price fields are getting updated with custom value, but total price is not updating based on the changes.
please suggest what goes wrong here.
As per my question database level, custom prices updating but on cart page, it is still showing only original product price.