Question

I'm writing two custom modules that act independently on the sales_order_place_after event observer and modify order state and status. One module (Module A) will act on every order and update the state, status (pending dispatch) and create a shipment, and the other module (Module B) will only apply an action if some criteria is present (a fraud check) and mark the order back to another status (suspected fraud).

Currently it appears that they are firing in the order Module B then Module A when it needs to be the other way around. I get the impression this is what's occurring because the order history of an order that fulfils the criteria for ModuleB an order will go from pending->suspected_fraud->pending_dispatch when it should be going from pending->pending_dispatch->suspected_fraud

Is it possible to make Module A fire first and then Module B to fire second without combing the modules into 1?

Was it helpful?

Solution

in your Namespace_ModuleB.xml in app/etc/modules, add this line:

<depends><Namespace_ModuleA/></depends>

after <codePool>local</codePool> line.

So that Module A will be executed before Module B.

Licensed under: CC-BY-SA with attribution
Not affiliated with magento.stackexchange
scroll top