Pages

Magento 1.9 - Find what event using in Observer.

Following code return what event used in the observer,

app\etc\modules\Gta_FindPaymentGateway.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Gta_FindPaymentGateway>
            <codePool>local</codePool>
            <active>true</active>
        </Gta_FindPaymentGateway>
    </modules>
</config>

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

<?xml version="1.0"?>
<config>
    <modules>
        <Gta_FindPaymentGateway>
            <version>1.0.0</version>
        </Gta_FindPaymentGateway>
    </modules>
    <global> 
        <models>
            <gta_findpaymentgateway>
                <class>Gta_FindPaymentGateway_Model</class>
            </gta_findpaymentgateway>
        </models> 
        <events>
            <checkout_cart_product_add_after>
                <observers>
                    <Gta_FindPaymentGateway_Model_Observer>   
                        <type>singleton</type>
                        <class>Gta_FindPaymentGateway_Model_Observer</class>
                        <method>paymenter</method>
                    </Gta_FindPaymentGateway_Model_Observer>
                </observers>
            </checkout_cart_product_add_after>      
        </events>
    </global> 
</config>

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

<?php
    class Gta_FindPaymentGateway_Model_Observer
    {
        public function paymenter($Observer)
        {
            $order = $Observer->getEvent();
            Mage::log($order->getName(),null,'eventsss.log',true);
        }
    }
?>

No comments:

Post a Comment