I would link to add a link to Order History in my top.links menu . I add this code in my local.xml:

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

But every time i click on "Order link" the path is added to the url so I have someting link : site.com/customer/sales/order/history and then site.com/customer/sales/order/history/sales/order/history. What is wrong?


You can do it same way Magento doing for other top links

for example,

<action method="addLink" translate="label title" module="customer"><label>My Account</label><url helper="customer/getAccountUrl"/><title>My Account</title><prepare/><urlParams/><position>10</position></action>

You will need to create one function in helper class with return order history url,

I did it in Mage_Customer_Helper_Data and added my function as below

public function getOrderHistoryUrl()
    return $this->_getUrl('sales/order/history');

Now you can used this function in xml same as it was in my account link, so it should be like

<reference name="top.links">
      <action method="addLink" translate="label" module="customer"><label>Orders</label><url helper="customer/getOrderHistoryUrl"/><title>My Orders</title><prepare/><urlParams/><position>50</position></action>

you can extend the helper class or you can do it with your own custom helper class and module.

  • You shouldn't need to overwrite/add to core files. If you did want to add a helper you should do it in your own module. You can still use ` <action method="addLink" translate="label" module="sales"><name>orders</name><path>sales/order/history/</path><label>My Orders</label></action> – rob3000 Nov 1 '15 at 2:21
  • i've got some problem with extend sales helper. I've create another ask here link. This method work properly if i make a copy of the original file (Thanks Akhilesh Patel!!) but i don't like to copy all the file.. I would like to extend the helper class... – laura Nov 2 '15 at 8:47

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.