Magento 1.9 - Override layout to display Custom Attribute on Cart Page (RWD Theme)

magento.stackexchange https://magento.stackexchange.com/questions/95852

  •  20-10-2020
  •  | 
  •  

Frage

I am trying to display custom attribute on cart page below SKU field. I managed to do it using below code at this location 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.

How do I override default layout in order to display my custom attribute ? Currently it fetches rwd package. I do not intend to change the package, but if my module is installed, it will call my item/default.phtml and display attribute.

Tried using below code in my layout xml but not does not seem to be working.

<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>

P.S. It should work for all types of products

War es hilfreich?

Lösung

This this

<checkout_cart_index>
        <reference name="checkout.cart">
            <action method="setTemplate"><template>{your_namespace}/{your_modulename}/checkout/car‌​t/item/default.phtml</template></action>
        </reference>
</checkout_cart_index>
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit magento.stackexchange
scroll top