Getting Ordered Items and their Detail from Order ID in Magento
2011-03-22 15:32
447 查看
Here is a small snippet of code, yet useful, to get ordered items
and its details. I’ve deviced this code a lot before and posted in
Magento Commerce’s Forum as well. But felt like writting it again, so
that I can have a quick refrence to it as well. Next thing, I’ve tried a
lot to get all orders and their items details by single query, but have
not yet come up with a solution. If you have any method of finding
order and its details by a single query, then please do response. The
code below first needs an order ID as it parameters to give order
details.
view source
print
?
Hope this might “just” help somebody in need.
Debugging Magento Using Eclipse PDT & Zend Debugger
Getting Customer's Info Using Single Query Including Billing and Shipping Addresses
Getting Configurable Attributes (Super Attributes) of a Configurable Product
Creating Custom Sourced Multiselect Product Attribute
Using Custom Table for Custom Module in Magento
Getting Rescent Rating Summary of a product in Magento
Adding custom options to a product in Magento
Getting all custom options of a product in Magento
Using Custom Query in Magento
and its details. I’ve deviced this code a lot before and posted in
Magento Commerce’s Forum as well. But felt like writting it again, so
that I can have a quick refrence to it as well. Next thing, I’ve tried a
lot to get all orders and their items details by single query, but have
not yet come up with a solution. If you have any method of finding
order and its details by a single query, then please do response. The
code below first needs an order ID as it parameters to give order
details.
view source
?
01 | $order =Mage::getModel( 'sales/order' )->load( $order_id ); |
02 | $items = $order ->getAllItems(); |
03 | $itemcount = count ( $items ); |
04 | $name = array (); |
05 | $unitPrice = array (); |
06 | $sku = array (); |
07 | $ids = array (); |
08 | $qty = array (); |
09 | foreach ( $items as $itemId => $item ) |
10 | { |
11 | $name [] = $item ->getName(); |
12 | $unitPrice []= $item ->getPrice(); |
13 | $sku []= $item ->getSku(); |
14 | $ids []= $item ->getProductId(); |
15 | $qty []= $item ->getQtyToInvoice(); |
16 | } |
Related entries
Create and Download XLS Report file using Magento's CoreDebugging Magento Using Eclipse PDT & Zend Debugger
Getting Customer's Info Using Single Query Including Billing and Shipping Addresses
Getting Configurable Attributes (Super Attributes) of a Configurable Product
Creating Custom Sourced Multiselect Product Attribute
Using Custom Table for Custom Module in Magento
Getting Rescent Rating Summary of a product in Magento
Adding custom options to a product in Magento
Getting all custom options of a product in Magento
Using Custom Query in Magento
相关文章推荐
- Getting Ordered Items and their Detail from Order ID in Magento
- Getting Ordered Items and their Detail from Order ID in Magento
- How to Change the Order Increment ID and Prefix in Magento
- [leetcode刷题系列]Construct Binary Tree from Preorder and Inorder Traversal
- LeetCode题解-106-Construct Binary Tree from Inorder and Postorder Traversal
- [Leetcode 106, Medium] Construct Binary Tree from Inorder and Postorder Traversal
- 106. Construct Binary Tree from Inorder and Postorder Traversal
- Construct Binary Tree from Preorder and Inorder Traversal - Leetcode
- [leetcode]Construct Binary Tree from Inorder and Postorder Traversal
- LeetCode --- 106. Construct Binary Tree from Inorder and Postorder Traversal
- leetcode106. Construct Binary Tree from Inorder and Postorder Traversal
- LeetCode OJ:Construct Binary Tree from Inorder and Postorder Traversal(从中序以及后序遍历结果中构造二叉树)
- LeetCode | Construct Binary Tree from Preorder and Inorder Traversal
- LintCode 159:Construct Binary Tree from Preorder and Inorder Traversal
- Construct Binary Tree from Preorder and Inorder Traversal
- leetcode---Construct Binary Tree from Preorder and Inorder Traversal---树的构建
- leetcode---Construct Binary Tree from Inorder and Postorder Traversal
- leetCode 105.Construct Binary Tree from Preorder and Inorder Traversal (根据前序遍历和中序遍历构造二叉树)
- Construct Binary Tree from Inorder and Postorder Traversal
- 【LeetCode】105. Construct Binary Tree from Preorder and Inorder Traversal