我是magento的新手
有谁知道在哪里删除My Orders
客户帐户仪表板上导航中的链接?
明白了 盖兹
这是非常棘手和困难的
只想评论下面的代码
在sales.xml中
<customer_account>
<!-- Mage_Sales -->
<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>
我认为这是一个具体的链接,但如果你想删除任何指向客户仪表板的链接,你可以制作一个小模块来向块 Mage_Customer_Block_Account_Navigation 添加新操作
这里的解决方案:
您的扩展中的自定义块:
class CA_Removecustomerlinks_Block_Account_Navigation extends Mage_Customer_Block_Account_Navigation
{
/**
* Removes link by name
*
* @param string $name
* @return Mage_Page_Block_Template_Links
* @author @davidselo
* @company @compraAmiga
*/
public function removeLinkByName($name)
{
foreach ($this->_links as $k => $v) {
if ($v->getName() == $name) {
unset($this->_links[$k]);
}
}
return $this;
}
}
模块的配置
<?xml version="1.0" encoding="UTF-8"?>
<config>
<modules>
<CA_Removecustomerlinks>
<version>0.1.0</version>
</CA_Removecustomerlinks>
</modules>
<global>
<blocks>
<customer>
<rewrite>
<account_navigation>CA_Removecustomerlinks_Block_Account_Navigation</account_navigation>
</rewrite>
</customer>
</blocks>
</global>
</config>
现在您可以在 local.xml 中随意删除
<customer_account>
<reference name="customer_account_navigation">
<action method="removeLinkByName"><name>recurring_profiles</name></action>
<action method="removeLinkByName"><name>billing_agreements</name></action>
<action method="removeLinkByName"><name>downloadable_products</name></action>
</reference>
</customer_account>