@Nilesh亚达夫,车和结算环节都使用不同的方法来创建顶部链接
<action method="addCartLink"></action>
<action method="addCheckoutLink"></action>
其他使用addLink
功能
结帐和车用类Mage_Checkout_Block_Links
功能addCheckoutLink and addCartLink
修改XML代码
<reference name="top.links">
<block type="checkout/links" name="checkout_cart_link">
<action method="addCartLink"><liParams>id="my-custom-id"</liParams></action>
<action method="addCheckoutLink"> <liParams>id="my-custom-id"</liParams></action>
</block>
</reference>
和Copy app/code/core/Mage/Checkout/Block/Links.php
到
app/code/local/Mage/Checkout/Block/Links.php
转到功能修改逻辑在addCartLink
public function addCartLink($liparams=null)
{
.....
if(is_null())
{ $parentBlock->addLink($text, 'checkout/cart', $text, true, array(), 50, null, 'class="top-link-cart"');
}else
{
$parentBlock->addLink($text, 'checkout/cart', $text, true, array(), 50, $liparams, 'class="top-link-cart"');
}
....
另外
public function addCheckoutLink($liparams=null)
{
....
if ($parentBlock && Mage::helper('core')->isModuleOutputEnabled('Mage_Checkout')) {
$text = $this->__('Checkout');
if(is_null()){
$parentBlock->addLink(
$text, 'checkout', $text,
true, array('_secure' => true), 60, null,
'class="top-link-checkout"'
);
}else{
$parentBlock->addLink(
$text, 'checkout', $text,
true, array('_secure' => true), 60, $liparams=null,
'class="top-link-checkout"'
);
}
}
..
}
哪个magento版??? –