0

I already have 1 observer on checkout_cart_product_add_after .

Before end of $this I woule like to call another observer which is located in different module

magento\app\code\Custom\Module\Observer\AnotherObserver.php

Both are executing on same event. But both files do different functionality that's why want to make it in separate files.

Don't want to merge code of 2 files in 1 file

6
  • 1
    If they are both observing checkout_cart_product_add_after then you wouldn't need to call 1 observer from the other as Magento will execute both. Without actually seeing the code this might not be easily answerable. Commented Feb 22, 2017 at 3:44
  • How to set priority which observer should call first?
    – Jackson
    Commented Feb 22, 2017 at 3:45
  • @AnkitShah should use <sequence> node in module.xml Commented Feb 22, 2017 at 3:48
  • @KhoaTruongDinh it's not working vice versa. I tried in both modules
    – Jackson
    Commented Feb 22, 2017 at 4:11
  • 1
    @KhoaTruongDinh i just indexed. Seems working fine :) Can post answer & will proceed with necessary
    – Jackson
    Commented Feb 22, 2017 at 6:18

1 Answer 1

2

In your case, should use <sequence> in the module.xml.

Read more here: http://devdocs.magento.com/guides/v2.0/extension-dev-guide/build/module-load-order.html

1

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.