MrRees
MrRees

Reputation: 1

Magento total orders quantity

on my checkout page (Magento 1.7.0.2) i want to show how many packages were we already send to our customers.

Does anyone have idea how to print quantity of all orders (all time)

I hope someone will solve this problem with one-line of code. :)

Thanks in advice!

Upvotes: 0

Views: 981

Answers (1)

Rajiv Ranjan
Rajiv Ranjan

Reputation: 1869

You can get all ordered quantity by using below SQL Query:

$read = Mage::getSingleton('core/resource')->getConnection('core_read');
$sql="SELECT sum(total_qty_ordered) total_ordered_quantity FROM `sales_flat_order` where state!='canceled'";
$data = $read->fetchRow($sql);
echo round($data['total_ordered_quantity'],0);

Hope it will help you!

Upvotes: 1

Related Questions