cancel
Showing results for 
Search instead for 
Did you mean: 

What is wrong in my Event Observer?

What is wrong in my Event Observer?

I just want to display my event name,

 

app\etc\modules\Gta_RestrictProductByCountry.xml

 

<?xml version="1.0"?>

<config>

    <modules>

        <Gta_RestrictProductByCountry>

            <codePool>local</codePool>
            <active>true</active>

        </Gta_RestrictProductByCountry>

    </modules>

</config>

app\code\local\Gta\RestrictProductByCountry\etc\config.xml

 

<?xml version="1.0"?>
<config>
    <modules>
        <Gta_RestrictProductByCountry>
            <version>1.0.0</version>
        </Gta_RestrictProductByCountry>
    </modules>
    <global> 
        <models>
            <gta_restrictproductbycountry>
                <class>Gta_RestrictProductByCountry_Model</class>
            </gta_restrictproductbycountry>
        </models> 
     </global> 
    <frontend>
        <events>
            <!-- <sales_order_place_before> -->
            <checkout_cart_product_add_after>
                <observers>
                    <Gta_RestrictProductByCountry_Observer>   
                        <type>singleton</type>
                        <class>Gta_RestrictProductByCountry_Observer</class>
                        <method>cartevent</method>
                    </Gta_RestrictProductByCountry_Observer>
                </observers>
            <!-- </sales_order_place_before>       -->
            </checkout_cart_product_add_after>      
        </events>
    </frontend>

</config>

app\code\local\Gta\RestrictProductByCountry\Model\Observer.php

 

<?php
class Gta_RestrictProductByCountry_Observer
{
    public function cartevent($Observer)
    {

        $cart_product_check = $Observer->getEvent();
        Mage::log($cart_product_check->getName(), null, 'orderproduct.log',true);
    }
}