I am having trouble getting the following function to work:
Mage::getModel('sales/order');
I attempted this, however it returned no results:
$res=Mage::getModel('sales/order');
$orderId=$res->getOrderId();
echo '<pre>';
print_r($orderId);
I am having trouble getting the following function to work:
Mage::getModel('sales/order');
I attempted this, however it returned no results:
$res=Mage::getModel('sales/order');
$orderId=$res->getOrderId();
echo '<pre>';
print_r($orderId);
I guess by res
you mean resource so I'll make a leap of logic and assume you mean to query a resource collection.
echo '<pre>';
$resource = Mage::getModel('sales/order')->getCollection();
foreach ($resource as $order) {
echo $order->getId(), "\n";
}
echo '</pre>';
$order = Mage::getModel('sales/order')->load($order_id);
$items = $order->getAllItems();
$itemcount=count($items);
$name=array();
$unitPrice=array();
$sku=array();
$ids=array();
$qty=array();
foreach ($items as $itemId => $item)
{
$name[] = $item->getName();
$unitPrice[]=$item->getPrice();
$sku[]=$item->getSku();
$ids[]=$item->getProductId();
$qty[]=$item->getQtyToInvoice();
}