12

Magento 1 and Magento 2 both have the two event:

  1. sales_order_place_after
  2. sales_order_save_after.

I have some confusion about them, what is the detailed differences between them?

Which situation to use which?

19

sales_order_place_after

  1. This event is dispatched after the order payment is placed.
  2. This event function from Mage_Sales_Model_Order::place() in Magento 1 & \Magento\Sales\Model\Order::place() in Magento 2

sales_order_save_after

  1. This event is called every time the order is saved. For eg. Order status changed, invoiced, shipped & credit memo.
  2. This event extending the abstract model Mage_Core_Model_Abstract

    For eg. the Mage_Sales_Model_Order class event prefix is sales_order, so the actual after loading event’s name will be sales_order_load_after.

5

1. sales_order_place_after:

This event is dispatched from the

class Mage_Sales_Model_Order extends Mage_Sales_Model_Abstract
{
...
public function place()
{
    Mage::dispatchEvent('sales_order_place_before', array('order'=>$this));
    $this->_placePayment();
    Mage::dispatchEvent('sales_order_place_after', array('order'=>$this));
    return $this;
}

This event is dispatched only after clicking place order from frontend.

2. sales_order_save_after:

This event is triggered on saving order, either from backend or frontend. Everytime some edit is made in order and saved, this event is dispatched. This event is dispatched while placing order from frontend as well.

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.