The object $items
is not empty, it is just to large to log ... sowrite it to logfile. This breaks the observer method and your last Mage::log('function end')
is not reached. Try this instead:
For debugging of large objects you should use debug()
the that works with every type of Varien Object. Advantage over var_dump
or print_r
is that it will leave out all recursive data and keeps your log small.
/**
* Present object data as string in debug mode
*
* @param mixed $data
* @param array $objects
* @return string
*/
public function newOrderdebug(Varien_Event_Observer$data=null, $observer&$objects=array())
{
$orderif (is_null($data)) {
$hash = $observer->getOrderspl_object_hash($this);
Mage::log(array_keys if ($order->getData!empty($objects[$hash])), null,{
'new return '*** RECURSION ***';
}
$objects[$hash] = true;
$data = $this-order.log'>getData();
Mage::log($order->getData}
...
}
Try this instead ...
public function newOrder('your_key'Varien_Event_Observer $observer),
{
null, 'new $order = $observer-order.log'>getOrder();
Mage::log(get_class_methods$items->debug($order), null, 'new-order.log');
}
Same for $items
.
You can also use:
# only get available data keys
Mage::log($itemsarray_keys($order->debug>getData()), null, 'new-order.log');
}