2

config.xml :-

  <events>
  <checkout_cart_add_product_complete> 
    <observers>
      <checkout_cart_product_add_after_handler> 
        <type>model</type> 
        <class>observertest/observer</class> 
        <method>addToCartAdditionalItem</method>  
      </checkout_cart_product_add_after_handler>
    </observers>
  </checkout_cart_add_product_complete>

   <checkout_cart_update_item_complete> 
    <observers>
      <checkout_cart_update_item_handler> 
        <type>model</type> 
        <class>observertest/observer</class> 
        <method>updateCartItem</method>  
      </checkout_cart_update_item_handler>
    </observers>
  </checkout_cart_update_item_complete>
 </events>

In the events tag you can see 2 event in which first one(checkout_cart_add_product_complete) is working fine but second one is not.

Where i'm doing wrong, please let me know.

Note:-

I also tried to use checkout_cart_update_items_after instead of checkout_cart_update_item_complete it's working fine but by using this event not getting updated cart total price (just getting old one). e.g- suppose before updating my cart if in my cart a product having 4 qty & it's subtotal is $80($20*4) & if i went to update 3 more qty(20*7=$140) then this time by using event checkout_cart_update_items_after i'm getting $80 on my event action(updateCartItem) but i want $140.

Thanks!!!

1
  • After a long afford, i got the solution. I've used checkout_cart_save_after & it's working as per as my requirement. Apr 13, 2018 at 19:23

1 Answer 1

1

checkout_cart_update_item_complete is dispatched in Mage_Checkout_CartController::updateItemOptionsAction() ... haven't testet it, but method description says:

/**
 * Update product configuration for a cart item
 */
public function updateItemOptionsAction()

I'm not sure if this is used only for configurable products. You can try checkout_cart_update_items_after instead.

It's dispatched in Mage_Checkout_Model_Cart::updateItems() and should work for every cart update:

/**
 * Update cart items information
 *
 * @param   array $data
 * @return  Mage_Checkout_Model_Cart
 */
public function updateItems($data)
4
  • Thanks for your reply, i already used checkout_cart_update_items_after & it's working fine but it's not fulfulling my requirement. i want to remove a specific product let's say X whenever cart value less than 100$ and add X whenever cart value atleast $100. Mar 24, 2018 at 14:55
  • @wakarAhamad and it's not working? I use this in some of my extensions and I'm pretty sure that it works. You can add add a Mage::log in Mage.php dispatchEvent to check if this event is fired on your cart update action.
    – sv3n
    Mar 24, 2018 at 14:59
  • @wakarAhamad can you please add these information to your question? I've I working solution for it ... but no time at the moment. Will update my answer later.
    – sv3n
    Mar 24, 2018 at 15:04
  • I'm saying checkout_cart_update_items_after it's working fine but by using this event not getting updated cart total price (just getting old one). e.g- suppose before updating my cart if in my cart a product having 4 qty & it's subtotal is $80($20*4) & if i went to update 3 more qty(20*7=$140) then this time by using event checkout_cart_update_items_after i'm getting $80 on my event action(updateCartItem) but i want $140. Mar 24, 2018 at 15:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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