0

We are using magento 1.9. In that

How to get ordered product count not order qty of product. I want to how many product is there in that order?

I am using this but it showing ordered qty only

 <?php $_order = $this->getOrder(); //call the order echo $order_qty = floor($_order->getData('total_qty_ordered')); //get qty of all items rounded to full number (without 3.0000 or so) //echo $order_qty; ?> 

3 Answers 3

7

Try this

 <?php $_order = $this->getOrder() ?> <?php echo $_order->getTotalItemCount();?> 

For eg.

enter image description here

9
  • No it's not working Commented Jan 23, 2016 at 8:50
  • Can share your code ??? Commented Jan 23, 2016 at 8:58
  • code means i jus want to display how many product available in sales order page backend Commented Jan 23, 2016 at 9:00
  • ChecK $order = Mage::getModel('sales/order')->load($orderId); echo '<pre>'; print_r($order); Commented Jan 23, 2016 at 9:04
  • and give response me :) Commented Jan 23, 2016 at 9:06
1

You have to use $items = $order->getAllVisibleItems() instead of $items = $order->getAllItems().

getAllItems gets the configurable along with its associated simple product.

echo $NumberOfItem = count($items); 

so its up to you to use in your way.

1
  • No it's not working Commented Jan 23, 2016 at 8:51
0

For order Item count use below code.

$items = $order->getAllItems(); $itemcount = count($items); 
2
  • No it's not working Commented Jan 23, 2016 at 8:51
  • may be it help you : $order = Mage::getModel('sales/order')->loadByIncrementId($orderId); then use upper code. Commented Jan 23, 2016 at 10:47

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.