xml 重新排序并将类添加到Top.Links - Magento 1.9社区版
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了xml 重新排序并将类添加到Top.Links - Magento 1.9社区版相关的知识,希望对你有一定的参考价值。
<?xml version="1.0"?>
<!--
[Your site name] XML overrides
-->
<layout version="0.1.0">
<!-- updating top.links to add class names -->
<!-- Section 1: Removing Current Links -->
<default>
<reference name="top.links">
<!-- Removes 'My Account' link -->
<action method="removeLinkByUrl"><url helper="customer/getAccountUrl"/></action>
<!-- Removes 'My Cart' AND 'Checkout' links -->
<remove name="checkout_cart_link" />
</reference>
</default>
<customer_logged_out>
<!-- Removes 'Log In' link -->
<reference name="top.links">
<action method="removeLinkByUrl"><url helper="customer/getLoginUrl"/></action>
</reference>
</customer_logged_out>
<customer_logged_in>
<!-- Removes 'Log Out' link -->
<reference name="top.links">
<action method="removeLinkByUrl"><url helper="customer/getLogoutUrl"/></action>
</reference>
</customer_logged_in>
<!-- Section 2: Adding New Links -->
<!-- order can be easily edited here by changing the position number -->
<default>
<reference name="top.links">
<!-- add My Account -->
<!-- default position 10 -->
<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>
<liParams>
<class>top-account</class>
</liParams>
<aParams>
<class>top-account-a</class>
</aParams>
<beforeText/>
<afterText/>
</action>
<!-- add My Wishlist -->
<!-- default position 20 -->
<reference name="wishlist_link">
<action method="setLiParams"><params>class="top-wishlist"</params></action>
<action method="setAParams"><params>class="top-wishlist-a"</params></action>
</reference>
<!-- add My Cart -->
<!-- default position 40 -->
<block type="checkout/links" name="checkout_cart_link_custom">
<action method="addCartLink"></action>
</block>
<!-- add Checkout -->
<!-- default position 50 -->
<action method="addLink" translate="label title">
<label>Checkout</label>
<url>/checkout</url>
<title>Checkout</title>
<prepare />
<urlParams/>
<position>50</position>
<liParams>
<class>top-checkout</class>
</liParams>
<aParams>
<class>top-checkout-a</class>
</aParams>
<beforeText />
<afterText />
</action>
</reference>
</default>
<customer_logged_out>
<!-- add Log In (when customer is not logged in) -->
<reference name="top.links">
<action method="addLink" translate="label title" module="customer">
<label>Log In</label>
<url helper="customer/getAccountUrl"/>
<title>Log In</title>
<prepare/>
<urlParams/>
<position>70</position>
<liParams>
<class>top-log-in</class>
</liParams>
<aParams>
<class>top-log-in-a</class>
</aParams>
<beforeText />
<afterText />
</action>
</reference>
<!-- add Register (when customer is not logged in) -->
<reference name="top.links">
<action method="addLink" translate="label title" module="customer">
<label>Register</label>
<url helper="customer/getRegisterUrl"/>
<title>Register</title>
<prepare/>
<urlParams/>
<position>60</position>
<liParams>
<class>top-register</class>
</liParams>
<aParams>
<class>top-register-a</class>
</aParams>
<beforeText />
<afterText />
</action>
</reference>
</customer_logged_out>
<customer_logged_in>
<!-- add Log Out (when customer is logged in) -->
<reference name="top.links">
<action method="addLink" translate="label title" module="customer">
<label>Log Out</label>
<url helper="customer/getLogoutUrl"/>
<title>Log Out</title>
<prepare/>
<urlParams/>
<position>70</position>
<liParams>
<class>top-log-out</class>
</liParams>
<aParams>
<class>top-log-out-a</class>
</aParams>
<beforeText />
<afterText />
</action>
</reference>
</customer_logged_in>
</layout>
以上是关于xml 重新排序并将类添加到Top.Links - Magento 1.9社区版的主要内容,如果未能解决你的问题,请参考以下文章