Sanjoy Roy

[MCM, MCP, SCJP] – Senior PHP Programmer

Tag Archives: Sales Order

Magento observer sales order

 * Register an event trigger after the order has been saved
 * Is triggered by sales_order_save_after event 
public function hookSalesOrderSaveAfter ($observer)
    $order = $observer->getEvent()->getOrder(); // returns the Mage_Sales_Model_Order Object
    Mage::app()->setCurrentStore(Mage_Core_Model_App::ADMIN_STORE_ID); // Magento can only save attributes in admin mode
    $order->getResource()->saveAttribute($order, "vendor");
    $order->getResource()->saveAttribute($order, "call_to_action");
    $order->getResource()->saveAttribute($order, "keycode");
    return $this;

%d bloggers like this: