I have redirected the form to cart page.

 $this->_redirect('checkout/cart/add', array('product' => 1, 'qty' => 1, 'price' => 500));

Now I want to save price value in table?

product and qty parameters are added in table successfully but not able to change price value.

Can anyone tell what parameter to pass for Price?

I have called below event

  <checkout_cart_product_add_after> <!-- identifier of the event we want to catch -->
      <checkout_cart_product_add_after_handler> <!-- identifier of the event handler -->
        <type>model</type> <!-- class method call type; valid are model, object and singleton -->
        <class>customiseproductprice/observer</class> <!-- observers class alias -->
        <method>applyCustomPrice</method>  <!-- observer's method to be called -->
        <args></args> <!-- additional arguments passed to observer -->

Assume that you want purchase this item with this custom price.

for those you need to use event checkout_cart_product_add_after.

Using event at observer with help $item->setCustomPrice() and $item->setOriginalPrice(), Mage::app()->getRequest()->getParam('price').

You can purchase this item with custom price.

follow Programmatically add product to cart with price change for set custom price during the cart.

In your case, you need to use change at applyDiscount() function

public function applyDiscount(Varien_Event_Observer $observer)
    /* @var $item Mage_Sales_Model_Quote_Item */
    $item = $observer->getQuoteItem();
    if ($item->getParentItem()) {
        $item = $item->getParentItem();

    // Make sure we don't have a negative
    if (Mage::app()->getRequest()->getParam('price') > 0) {
        $specialPrice = Mage::app()->getRequest()->getParam('price');
| improve this answer | |
  • I have called event i.e checkout_cart_product_add_after in Observer file. But when I submit the form to cart page, it is not calling event. – jassi Jan 11 '17 at 12:45
  • are you sure that .. items has been cart from this url and i want sure that that observer is hitting when product is card – Amit Bera Jan 11 '17 at 12:50
  • Item gets added in sales_flat_quote_item table. But I am not able to halt checkout_cart_product_add_after event. I have added event in question. I have called above event. – jassi Jan 11 '17 at 12:54
  • I am able to call checkout_cart_save_after event but not getting quote item. – jassi Jan 12 '17 at 6:30
  • Run $observer->getDataObject() to get the object from pre defined default model prefixed events. – jassi Jan 12 '17 at 8:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.