1

I want to add a new customer page (sales/order/unpaid-history) like sales/order/history in customer menu, it shows all the unpaid order with status pending_payment. Same template, same data, but has a condition filter.

Can modify magento core file, simple the best

My thought is copy the sales/order layout file, add a new phtml template, add a new method in sales order model. Is it right?

thanks for your help

  • my magento version is 1.8.1.0 – hahamy Apr 15 '15 at 16:42
1

Don't modify core files!

Magento adds the history tab in sales.xml as follows:

<customer_account>
    <reference name="customer_account_navigation">
        <action method="addLink" translate="label" module="sales"><name>orders</name><path>sales/order/history/</path><label>My Orders</label></action>
    </reference>
</customer_account>

You can use the same layout update in a custom module:

<customer_account>
    <reference name="customer_account_navigation">
        <action method="addLink" translate="label" module="your_module"><name>unpaid_history</name><path>your/controller/unpaidHistory/</path><label>Unpaid History</label></action>
    </reference>
</customer_account>

This will add a link "Unpaid History" pointing to your/controller/unpaidHistory

For the layout of your custom controller, you can look again, how Magento does it with the history:

<sales_order_history translate="label">
    <label>Customer My Account Order History</label>
    <update handle="customer_account"/>
    <reference name="my.account.wrapper">
        <block type="sales/order_history" name="sales.order.history">
            <block type="core/text_list" name="sales.order.history.info" as="info" translate="label">
                <label>Order History Info</label>
            </block>
        </block>
        <block type="customer/account_dashboard" name="customer.account.link.back" template="customer/account/link/back.phtml"/>
    </reference>
</sales_order_history>

Copy it to your layout file, replace sales_order_history with your_controller_unpaidHistory and replace the <block type="sales/order_history"> block with your custom block and custom template.

| 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.