I have tried getTotalQtyOrdered() but still not success, Any idea guys?
$dirPath = Mage::getBaseDir('var') . DS . 'export';
if (!is_dir($dirPath)) {
mkdir($dirPath, 0777, true);
}
foreach ($order->getAllVisibleItems() as $item){
$data[] = array(
'ID' => $item->getSku(),
'QTY' => $item->getQty(),
'PRICE' => $item->getPrice()
);
}
$xml = new SimpleXMLElement('<root/>');
foreach ($data as $item) {
$xmlItem = $xml->addChild('item');
foreach ($item as $key => $value) {
$xmlItem->addChild($key, $value);
}
}
file_put_contents($dirPath. DS .$order->getIncrementId().'.xml', $xml->asXML());