2

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?

  • 1
    in your Namespace_ModuleB.xml in app/etc/modules, add this line: <depends><Namespace_ModuleA/></depends>, after <codePool>local</codePool> line. Didn't check this, but anyway give it a try. – Shathish Aug 19 '13 at 5:37
  • It worked! I thought of this but dismissed it but it absolutely worked. If you put this as an answer I will mark as correct. – James Aug 19 '13 at 5:51
  • all right, glad you got it working :) – Shathish Aug 19 '13 at 5:52
1

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.

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.