i want to add custom donate(like tip) module in addition to product price
suppose Product A (price 100) have text box field 1:donate with blank value which user have to enter user can insert any value and product price will be donated value + product price
how can i implement this via observer
i tried using "checkout_cart_product_add_after" observer
code of observer.php
class Mour_Customgroup_Model_Observer
{
public function modifyPrice(Varien_Event_Observer $obs ){
// Get the quote item
$quote = $obs->getEvent()->getQuote();
$item = $obs->getQuoteItem();
$product_id=$item->getProductId();
$_product=Mage::getModel('catalog/product')->load($product_id);
$newprice=$_product->getPrice()+10;
Mage::log('My log entry', null, 'mylogfile.log');
// Set the custom price
$item->setCustomPrice($newprice);
$item->setOriginalCustomPrice($newprice);
// Enable super mode on the product.
$item->getProduct()->setIsSuperMode(true);
}
}
but this code adds same amount to add items in cart
my issue are
- how to pass value of donate text box to observer
- add donated value to product price
- donted value should also show in admin order detail