Magento Forum

   
Not firing checkout_cart_product_add_before event
 
niandralades
Jr. Member
 
Total Posts:  15
Joined:  2012-06-15
 

Im trying to add an observer to the checkout_cart_product_add_before event.
but it it not working…
does anybody can see what i am doing wrong?

here is my config.xml:

<frontend>
        <
events>
            <
checkout_cart_product_add_before>  
                <
observers>  
                    <
check_product_type>  
                        <
type>singleton</type>  
                        <class>
Pricerulesextended/Observer</class>    
                        <
method>checkProductType</method>            
                    </
check_product_type>
                </
observers>
            </
checkout_cart_product_add_before>  
        </
events>
        <
routers>
            <
Dg_Pricerulesextended>
                <use>
standard</use>
                <
args>
                    <
module>Dg_Pricerulesextended</module>
                    <
frontName>giftvoucher</frontName>
                </
args>
            </
Dg_Pricerulesextended>
        </
routers>
    </
frontend>

here is my Observer:

class Dg_Pricerulesextended_Model_Observer {
public function checkProductType(Varien_Event_Observer $observer)
{
        
        
echo "TEST";
        exit;
}
}

Nobody????

 
Magento Community Magento Community
Magento Community
Magento Community
 
kiatng
Enthusiast
 
Total Posts:  875
Joined:  2008-09-03
Kuala Lumpur, Malaysia
 

try

<frontend>
        <
events>
            <
checkout_cart_product_add_before>  
                <
observers>  
                    <
check_product_type>  
                        <
type>singleton</type>  
                        <class>
Dg_Pricerulesextended_Model_Observer</class>    
                        <
method>checkProductType</method>            
                    </
check_product_type>
                </
observers>
            </
checkout_cart_product_add_before>  
        </
events>

</
frontend>

 
Magento Community Magento Community
Magento Community
Magento Community
 
niandralades
Jr. Member
 
Total Posts:  15
Joined:  2012-06-15
 

thanks for the reply,

but doesnt work either…

 
Magento Community Magento Community
Magento Community
Magento Community
 
Ryan Sun _Kuafu
Guru
 
Total Posts:  317
Joined:  2008-11-14
FL
 

there is no ‘checkout_cart_product_add_before’, only ‘checkout_cart_product_add_after’

 
Magento Community Magento Community
Magento Community
Magento Community
 
niandralades
Jr. Member
 
Total Posts:  15
Joined:  2012-06-15
 

thanx you where right… tried that event before as well, but was not working at that time..
think i had an other error then..

 
Magento Community Magento Community
Magento Community
Magento Community
 
chapagain
Sr. Member
 
Avatar
Total Posts:  202
Joined:  2009-07-19
 

This might help: http://www.crearegroup-ecommerce.co.uk/blog/magento-tips/using-a-controller-observer-to-dispatch-your-own-event.php

The basic idea is that at first you create a new event (checkout_cart_product_add_before) by yourself with the help of controller_action_predispatch event. After that, you can use checkout_cart_product_add_before event for your intended purpose.

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
    Back to top