Xml Magento-cart.phtml-覆盖问题

Xml Magento-cart.phtml-覆盖问题,xml,magento,Xml,Magento,我已经看到了几个如何覆盖cart.phtml的示例,但是在我的文件中似乎没有一个是有效的 我的主题是: 应用程序/设计/前端/默认/ves_时尚/ 该文件位于: app/design/frontend/default/ves_fashion/template/checkout/cart.phtml 我已在中创建了cart.phtml: app/design/frontend/default/ves_fashion/template/customsite/checkout/cart.ph

我已经看到了几个如何覆盖cart.phtml的示例,但是在我的文件中似乎没有一个是有效的

我的主题是:

  • 应用程序/设计/前端/默认/ves_时尚/
该文件位于:

  • app/design/frontend/default/ves_fashion/template/checkout/cart.phtml
我已在中创建了cart.phtml:

  • app/design/frontend/default/ves_fashion/template/customsite/checkout/cart.phtml
然后,我检查了主题的layout.xml:

  • app/design/frontend/default/ves_fashion/layout/checkout.xml
看看这个:

<layout>
    <checkout_cart_index translate="label">
        <label>Shopping Cart</label>
        <remove name="right"/>
        <remove name="left"/>
        <!-- Mage_Checkout -->
        <reference name="root">
            <action method="setTemplate"><template>page/1column.phtml</template></action>
        </reference>
        <reference name="content">
            <block type="checkout/cart" name="checkout.cart">
                <action method="setCartTemplate"><value>checkout/cart.phtml</value></action>
                <action method="setEmptyTemplate"><value>checkout/cart/noItems.phtml</value></action>
...

购物车
第/1页column.phtml
checkout/cart.phtml
checkout/cart/noItems.phtml
...
我知道我想用自己的cart.phtml覆盖此cart.phtml,并执行了以下操作: 我在中打开了local.xml

app/etc/local.xml

并插入:

 <layout>
        <checkout_cart_index translate="label">
            <reference name="content">
                <block type="checkout/cart" name="checkout.cart">
                    <action method="setCartTemplate"><value>customsite/checkout/cart.phtml</value></action>
                    <action method="setEmptyTemplate"><value>customsite/checkout/cart/noItems.phtml</value></action>
                </block>
            </reference>
        </checkout_cart_index>
    </layout>

customsite/checkout/cart.phtml
customsite/checkout/cart/noItems.phtml
但这是行不通的。我现在需要做什么?app/etc/中的local.xml是正确的还是我必须使用app/design/frontend/default/ves_fashion/layout/local.xml中的一个?我还看到过一些例子,其中标记被省略,值标记被命名为,内容被设置为checkout.cart-如果原始xml文件显示不同的内容,为什么要这样做


如果有人能帮我,那就太好了。谢谢

app/etc/local.xml文件不是您想要的。包含站点的环境信息的

您可以随意直接在主题的布局文件中进行更改:

app/design/frontend/default/ves_fashion/layout/checkout.xml


或者,如果愿意,您可以在该文件夹中添加一个
local.xml
,并在那里进行布局更新。

正如其他人所指出的,将布局句柄添加到
app/etc/local.xml
文件是错误的。这只是为了配置。您的主题应该在
app/design/frontend/{Your package name}/{Your theme variation name}/layout/local.xml
中定义自己的
local.xml
文件,或者您的模块应该在
app/design/frontend/base/default/layout/{Your namespace}{Your module}.xml
中定义自己的布局句柄


然而,写了这些之后,您的问题中提供的布局XML存在一个固有的问题。按原样,这些布局定义将不起作用。调用
setCartTemplate
setEmptyTemplate
是正确的,但是如果没有必须在它们之后直接调用的基本方法调用,它们将无法工作:
choosetTemplate
。如果查看
app/design/frontend/base/default/layout/checkout.xml文件,可以直接在前两个文件之后看到该方法。在修改Magento购物车模板时,许多人都会因为这个方法调用而感到沮丧,这一点从StackOverflow问题的数量就可以明显看出。我已经在这里对这个问题做了详尽的解释:。

就像已经回答了一样,
local.xml
是错误的编辑文件。问题是,你为什么一开始就编辑它?你能提供这些信息吗(也许还有一些参考)?