3

I am creating a custom model and rewriting the sales/order_status model and create the function

public function _afterSave(Mage_Core_Model_Abstract $object){

    echo "here"; exit;
}

this function is executing perfectly but i want to get data. how can I achieve this task?

2 Answers 2

4

better using $this instead of $object, try it like Mage::log($this->_getEventData(), null, 'debug.log', true)

0
2

use the $object variable.
Use Mage::log($object->getData(), null, 'debug.log', true) to see what values you have available and then use what ever you need.

[EDIT]
The code above works if you rewrite the Mage_Sales_Model_Resource_Order_Status class

For Mage_Sales_Model_Order_Status your method should look like this:

public function _afterSave()
{
    Mage::log($this->getData(), null, 'debug.log', true);
    parent::_afterSave();
}

Again, you should see in var/log/debug.log the values you have available.

6
  • Fatal error: Call to a member function getData() May 13, 2015 at 12:23
  • wait...are you rewriteing Mage_Sales_Model_Order_Status or Mage_Sales_Model_Resource_Order_Status ?
    – Marius
    May 13, 2015 at 12:24
  • Mage_Sales_Model_Order_Status May 13, 2015 at 12:25
  • i tried it before but get the same error.. May 13, 2015 at 12:25
  • @QaisarSatti. See my update.
    – Marius
    May 13, 2015 at 12:28

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.