Skip to main content
added 4 characters in body
Source Link

I don't think any of the both events can do the trick by itself. As long as you don't need that entity_id for the condition before the Magento shipping kicks in, you can use both events to make it work:

  • sales_order_shipment_save_beforesales_order_shipment_save_before: Do you checks in the condition and if they succeed, let them go through. Save all information within the observer.

  • sales_order_shipment_save_aftersales_order_shipment_save_after: Save the id that was generated in the Magento shipping and save all additional information you have saved before within the observer.

To make that work, you have to make sure the observer is loaded as a Singleton object, because otherwise the information will be gone as soon as it's recreated during the event. To me this solution is much better since it doesn't use any hacks to make it work, even though it comes with that additional complexity of another event.

I don't think any of the both events can do the trick by itself. As long as you don't need that entity_id for the condition before the Magento shipping kicks in, you can use both events to make it work:

  • sales_order_shipment_save_before: Do you checks in the condition and if they succeed, let them go through. Save all information within the observer.

  • sales_order_shipment_save_after: Save the id that was generated in the Magento shipping and save all additional information you have saved before within the observer.

To make that work, you have to make sure the observer is loaded as a Singleton object, because otherwise the information will be gone as soon as it's recreated during the event. To me this solution is much better since it doesn't use any hacks to make it work, even though it comes with that additional complexity of another event.

I don't think any of the both events can do the trick by itself. As long as you don't need that entity_id for the condition before the Magento shipping kicks in, you can use both events to make it work:

  • sales_order_shipment_save_before: Do you checks in the condition and if they succeed, let them go through. Save all information within the observer.

  • sales_order_shipment_save_after: Save the id that was generated in the Magento shipping and save all additional information you have saved before within the observer.

To make that work, you have to make sure the observer is loaded as a Singleton object, because otherwise the information will be gone as soon as it's recreated during the event. To me this solution is much better since it doesn't use any hacks to make it work, even though it comes with that additional complexity of another event.

Source Link

I don't think any of the both events can do the trick by itself. As long as you don't need that entity_id for the condition before the Magento shipping kicks in, you can use both events to make it work:

  • sales_order_shipment_save_before: Do you checks in the condition and if they succeed, let them go through. Save all information within the observer.

  • sales_order_shipment_save_after: Save the id that was generated in the Magento shipping and save all additional information you have saved before within the observer.

To make that work, you have to make sure the observer is loaded as a Singleton object, because otherwise the information will be gone as soon as it's recreated during the event. To me this solution is much better since it doesn't use any hacks to make it work, even though it comes with that additional complexity of another event.