1

I have order and invoice. I want to get product from invoice and I tried 2 function getAllItems() and getItemsCollection() but not found product_id.

2

You can get product id from order # using following code:

<?php $orderIncrementId = '100000010';
       $order = Mage::getModel('sales/order')->loadByIncrementId($orderIncrementId);
       $items = $order->getAllVisibleItems();
       foreach($items as $i):
          echo $i->getProductId();
       endforeach;

    ?>
| improve this answer | |
  • Thanks a lot. I just found solution but your help is very useful! :) – Khuebt Apr 5 '16 at 10:24
  • 1
    Hey i am have an issue similar, how to get product id from payment? Can u help me again, sir? – Khuebt Apr 5 '16 at 18:19
  • Oh sr solution is smilar. Tks u again. :v – Khuebt Apr 5 '16 at 18:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.