[英]Magento 1.9 - Override layout to display Custom Attribute on Cart Page (RWD Theme)
I am trying to display custom attribute on cart page below SKU
field. 我正在尝试在SKU
字段下方的购物车页面上显示自定义属性。 I managed to do it using below code at this location app/design/frontend/rwd/default/template/checkout/cart/item
我设法在此位置使用以下代码来做到这一点app/design/frontend/rwd/default/template/checkout/cart/item
<div class="product-cart-sku">
<span class="label"><?php echo $this->__('Points'); ?>:</span> <?php echo $_item->getProduct()->getData('customer_product_points'); ?>
</div>
Placing default.phtml
at location app/design/frontend/base/default/template/namespace/modulename/checkout/cart/item
is not working. 将default.phtml
放置在位置app/design/frontend/base/default/template/namespace/modulename/checkout/cart/item
无效。
How do I override default layout in order to display my custom attribute ? 如何覆盖默认布局以显示自定义属性? Currently it fetches rwd
package. 目前,它获取rwd
软件包。 I do not intend to change the package, but if my module is installed, it will call my item/default.phtml
and display attribute. 我无意更改软件包,但是如果安装了我的模块,它将调用我的item/default.phtml
和display属性。
Tried using below code in my layout xml but not does not seem to be working. 尝试在我的布局xml中使用以下代码,但似乎无法正常工作。
<checkout_cart_index>
<reference name ="checkout.cart">
<block type="checkout/cart" name="checkout.cart">
<action method="addItemRender">
<type>simple</type><block>checkout/cart_item_renderer</block><template>ei/productpoint/checkout/cart/item/default.phtml</template>
</action>
</block>
</reference>
</checkout_cart_index>
PS It should work for all types of products PS应适用于所有类型的产品
Try this 尝试这个
<checkout_cart_index>
<reference name="checkout.cart">
<action method="setTemplate"><template>{your_namespace}/{your_modulename}/checkout/cart/item/default.phtml</template></action>
</reference>
</checkout_cart_index>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.