0

I need to set a new value for the shipping_description column of the sales_flat_order table.

I would like to know in which file I can define this value before the order is created in the database ?

Thanks for your help

0

you could add an observer on the 'sales_quote_address_collect_totals_after' event.

In your custom module, in config.xml add the following:

<config>
    ....
    <frontend>
            <events>                
                <sales_quote_address_collect_totals_after>
                    <observers>
                        <adjust_shipping_description>
                            <type>singleton</type>
                            <class>model_group/observer</class>
                            <method>adjustShippingDescription</method>
                        </adjust_shipping_description>
                    </observers>
                </sales_quote_address_collect_totals_after>
            </events>
    </frontend>
</config>

then add the Observer.php class in your module's Model folder with the following code:

    /**
     * Will set a new shipping description for the current quote
     *
     * @author Your Name <your_email@domain.com>
     * @event  sales_quote_address_collect_totals_after
     * @scope  frontend
     * @param  Varien_Event_Observer $observer
     */
    public function adjustShippingCostsData(Varien_Event_Observer $observer)
    {
        /** @var $address Mage_Sales_Model_Quote_Address */
        $address = $observer->getQuoteAddress();

        $newDescription = 'test string';

        // reset description on shipping address
        $address->setShippingDescription($newDescription);       
    }

** don't forget to correctly map the observer class relative to your module in the config(the 'model_group' part) and also the php class name and location. Also, if you need this change to occur for both orders placed in frontend and admin panel, change the tag to

Your Answer

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

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