2

For my condition how to get the shipping methods before order placed

My Observer : https://gist.github.com/ZusZus/66da0a7aaeb0db53eff38d8bb89ae941

3

The event before placing order is “sales_order_place_before“

3

How to do an action if an order is placed by a customer

You have 2 events you might use (there might be others).
sales_order_place_before is dispatched before the order is placed. sales_order_place_after is dispatched after the order is placed.
You can create an observer for one of those events. You will find here a tutorial on how to create observers.
You can access the order in your observer method like this:

public function doSomethingHere($observer) {
    $order = $observer->getEvent()->getOrder();
}
3

You can use sales_order_place_before event before placing the order.

Also, for getting shipping description for the order, you can use below code in your observer.

$order = $observer->getEvent()->getOrder();
echo $order->getShippingDescription();

If you want shipping method data, then you can use below code

$shipping = $order->getShippingAddress()->getShippingMethod();
var_dump($shipping->getData());

Edit:

I've changed $Observer to $observer in your Observer.php file. I think the issue is with the naming of the observer variable.

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

Hope it helps!!!

3

In magento1 try to do with this event sales_order_place_before which is work with before place order. and put in config.xml

<sales_order_place_before>
            <observers>
                <Gta_KolupadiRestrict_Model_Observer>   
                    <type>singleton</type>
                    <class>gta_kolupadiRestrict/observer</class>
                    <method>cartevent</method>
                </Gta_KolupadiRestrict_Model_Observer>
            </observers>
        </sales_order_place_before>      

hope its work for you

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