magento:在另一个街区移动购物车

magento:在另一个街区移动购物车,magento,Magento,我是Magento新手,我正在尝试将我的购物车链接与导航栏中的其他链接分开 我采取了以下步骤: 1) 在etc/modules <?xml version="1.0"?> <config> <modules> <Marco_TopRightLinks> <active>true</active> <codePool>local</cod

我是Magento新手,我正在尝试将我的购物车链接与导航栏中的其他链接分开

我采取了以下步骤: 1) 在
etc/modules

<?xml version="1.0"?>
<config>
    <modules>
        <Marco_TopRightLinks>
            <active>true</active>
            <codePool>local</codePool>
        </Marco_TopRightLinks>
    </modules>
</config>
3) 添加到
app/code/local/Marco/TopRightLinks/etc
包含以下内容的
config.xml
文件:

class Marco_TopRightLinks_Block_Links extends Mage_Checkout_Block_Links
{
    protected function _construct()
    {
        $this->setTemplate('page/template/logged-links.phtml');
    }
}
<config>
    <modules>
        <Marco_TopRightLinks>
            <version>0.1.0</version>
        </Marco_TopRightLinks>
    </modules>
    <global>
        <blocks>
            <topright>
                <class>Marco_TopRightLinks_Block</class>
            </topright>
        </blocks>
    </global>
</config>
为此:

<block type="page/html_header" name="header" as="header">
  <block type="page/template_links" name="top.links" as="topLinks"/>
  <block type="topright/links" name="top.right_links" as="topRightLinks"/>
<!-- Mage_Checkout -->
<reference name="top.right_links">
  <block type="topright/links" name="checkout_cart_link">
    <action method="addCartLink"></action>
    <!--<action method="addCheckoutLink"></action>-->
  </block>
</reference>
添加在
[my_template]/page/template
右链接.phtml
文件

这将导致Magento异常:

Invalid method Marco_TopRightLinks_Block_Links::removeLinkByUrl(Array
(
  [0] => http://mysitecom/checkout/cart/
)
你能帮助我了解正在发生的事情和我能做什么吗?(我不想接触任何innter magento方法,我确信
addCartLink
工作得很好:D)我的目标只是将cart链接移动到我的html中的另一个位置

编辑: 如果,而不是扩展
Mage\u Checkout\u Block\u链接

class Marco_TopRightLinks_Block_Links extends Mage_Checkout_Block_Links
class Marco_TopRightLinks_Block_Links extends Mage_Page_Block_Template_Links
我扩展
Mage\u页面\块\模板\链接

class Marco_TopRightLinks_Block_Links extends Mage_Checkout_Block_Links
class Marco_TopRightLinks_Block_Links extends Mage_Page_Block_Template_Links
例外情况发生了变化

Invalid method Marco_TopRightLinks_Block_Links::addCartLink

尝试将cinnfig.xml中的topright链接替换为topright链接

<config>
    <modules>
        <Marco_TopRightLinks>
            <version>0.1.0</version>
        </Marco_TopRightLinks>
    </modules>
    <global>
        <blocks>
            <toprightlinks>
                <class>Marco_TopRightLinks_Block</class>
            </toprightlinks>
        </blocks>
    </global>
</config>

0.1.0
Marco_TopRightLinks_区块

在这里,我给你一个想法,用你的自定义块将模板从一个更改到另一个

您可以通过布局系统添加块(这也是添加普通内容的方式)

如果尚未为模块定义布局XML文件,请执行以下操作:

<frontend>
    <layout>
        <updates>
            <your_module module="Your_Module">
                <file>your/module.xml</file>
            </your_module>
        </updates>
    </layout>
</frontend>

您的/module.xml
使用布局文件(app/design/frontend/base/default/layout/your/module.xml)向布局和更新句柄添加块。例如:

<?xml version="1.0"?>
<layout>
    <a_handle_for_you>
        <reference name="content">
            <block type="core/text" name="yourblock">
                <action method="setText">
                    <arg>You should see this text.</arg>
                </action>
            </block>
        </reference>
    </a_handle_for_you>
    <checkout_onepage_success>
        <update handle="a_handle_for_you" />
    </checkout_onepage_success>
    <checkout_multishipping_success>
        <update handle="a_handle_for_you" />
    </checkout_multishipping_success>
</layout>


. 为了深入了解解决问题的方法,错误是在
checkout.xml中,我不应该替换块类型。Magento应该使用自己的。我应该只更改
page.xml
中的块类型,因此容器正在更改,而内容保持不变

在这种情况下,它无法识别我创建的块