问题
Here is my code:
<reference name="top.links">
<action method="removeLinkByUrl"><url>checkout/cart</url></action>
</reference>
Here how can i get full path of checkout/cart in <url></url>?
回答1:
If you want to remove that link from the header of the whole site, I would just copy the checkout.xml layout file to my custom theme directory to override it, and comment/delete the line where it is added:
<reference name="top.links">
<block type="checkout/links" name="checkout_cart_link">
<!--<action method="addCartLink"></action>--> <!-- remove this -->
<action method="addCheckoutLink"></action>
</block>
</reference>
But if you really need to remove the link via removeLinkByUrl(), looking through the core code they usually do this:
<action method="removeLinkByUrl"><url helper="customer/getRegisterUrl" /></action>
Then there is a method called getRegisterUrl() in app/code/core/Mage/Customer/Helper/Data.php which looks like this:
public function getRegisterUrl()
{
return $this->_getUrl('customer/account/create');
}
So if you need to get a URL for checkout/cart you could set up a custom Helper in a custom extension which does something similar.
I hope this helps! Good luck!
来源:https://stackoverflow.com/questions/6235990/how-can-i-get-the-full-path-in-local-xml-file