0

How can I call my custom front-end controller action in my Observer function? Is dispatch function worked?

<?php
    ....
    public function salesOrderSaveAfter(Varien_Event_Observer $observer)
    {
        $order = $observer->getEvent()->getOrder();
        $order_id = $order->getId();
        $state= $order->getStatus();
        //here I can call the action controller
    }
    ...
2
  • Why do you want to call the controller's method in the observer?
    – Ner
    Nov 14, 2017 at 11:06
  • I want to create my order in Exact ERP. Exact having redirect URL so
    – ams
    Nov 14, 2017 at 12:40

1 Answer 1

1

You can use:

$controller = Mage::getControllerInstance(
    'The_Controller_Class',
    Mage::app()->getRequest(),
    Mage::app()->getResponse());

Reference

2
  • can you explain me more about it
    – ams
    Nov 15, 2017 at 5:50
  • You have a good explanation in the reference link
    – PЯINCƎ
    Nov 15, 2017 at 6:06

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.