0

I'm currently able to display single, detailed orders in the customer area of Magento's front-end. I log into my test account and I go to My Account > My Orders where I am presented with a summary of my previous test orders. If I click on one of the orders I'm taken to page via one of the following example URLs:

site.com/sales/order/view/order_id/1/
site.com/sales/order/view/order_id/2/

This page displays a shipping info, billing info and a summary products purchased.

My question: Is there a way to use this controller or URL to display every previous order with detailed info? The client would like a detailed summary of all past orders. If not, where would I begin to create this module?

  • 2
    So maybe you want to extend the order list view with more detailed informatinos for each order? I think the order view should only show detailed informations of the selected order. – smiggle Mar 21 '14 at 18:34
  • If you going to "My Account" -> "My Orders" (link "example.com/sales/order/history/"), you can see the order history. Order view display only one order detail. – Sohel Rana Mar 21 '14 at 18:37
2

So the good news for what you want is that the complete order information is added to the block Mage_Sales_Block_Order_History. You can see this be looking into the __construct function. Here it add the appropriate orders to the block.

$orders = Mage::getResourceModel('sales/order_collection')
    ->addFieldToSelect('*')
    ->addFieldToFilter('customer_id', Mage::getSingleton('customer/session')->getCustomer()->getId())
    ->addFieldToFilter('state', array('in' => Mage::getSingleton('sales/order_config')->getVisibleOnFrontStates()))
    ->setOrder('created_at', 'desc')
;

$this->setOrders($orders);

So technically what you should be able to do is using layout xml change the template used on this block and display the information from the order that you want in this new template. The layout handle of the page to use would be sales_order_history and the code could look something like.

<sales_order_history>
    <reference name="sales.order.history">
         <action method="setTemplate"><template>your/new/template.phtml</template></action>
    </reference>
</sales_order_history>

Note that you may need to add the blocks that display tax and totals etc via the layout but you can check what the normal order display page uses and add these. Check the layout handle sales_order_view for how it adds item renderers etc.

| improve this answer | |

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.