1

After calculated grand total in checkout page observer not trigger,

enter image description here

Observer :

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> 
    <frontend>
        <events>
            <sales_order_place_before>
                <observers>
                    <Gta_RestrictProductByCountry_Observer>   
                        <type>singleton</type>
                        <class>Gta_RestrictProductByCountry_Observer</class>
                        <method>cartevent</method>
                    </Gta_RestrictProductByCountry_Observer>
                </observers>
            </sales_order_place_before>      
        </events>
    </frontend>
    </global>   
</config>

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

<?php
class Gta_RestrictProductByCountry_Observer
{
    public function cartevent($Observer)
    {
        // $order = $Observer->getEvent();
        // $shipping = $order->getShippingAddress()->getShippingMethod();
        // Mage::log($shipping->getName(),null,'event.log');

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

Your Answer

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

Browse other questions tagged or ask your own question.