magento training 4

Subject:
When a customer is logged in, display "My orders" in top links area, put this link after "My cart". 
This link is same as the "My orders" in customer’s "My account" page.
When customer is logged out, don’t display this link in top links area.

========================================================================================
1. Copy the file app/design/frontend/base/default/layout/sales.xml to your folder. In the new file,
You will find the code

  
  
  
  
  1. <reference name="customer_account_navigation"> 
  2.             <action method="addLink" translate="label" module="sales"><name>orders</name><path>sales/order/history/</path><label>My Orders</label></action> 
  3.         </reference> 
in customer_account handle, comment this reference.

2. Copy the file app/design/frontend/base/default/layout/customer.xml to your folder. 
In the new file, Add 
  
  
  
  
  1. <reference name="top.links"> 
  2.     <action method="addLink" translate="label" module="sales"><name>orders</name><path></path><label>My Orders</label><prepare/><urlParams/><position>55</position></action> 
  3. </reference> 
to the <customer_logged_in> handle. Here, this action is the one we comment from sales.xml file. 
We use position tag to put the "order" after the cart. Why we use the value 55? We can check the 
source code app/code/core/Mage/Checkout/Block/Links.php. Here, we can see the position 
of "addCartLink" is 50 and the postion of "addCheckoutLink" is 60. So we put the order link's 
position is 55.

本文出自 “Epicor, magento” 博客,转载请与作者联系!

你可能感兴趣的:(Magento,exercise)