1
votes

I am working on a Magento module that requires one category of products to render a different checkout cart item than the others.

The Question: Is there a way to change, just for one product category, which template gets used in the checkout process for the cart item?

Things I've tried:

  • I've unsuccessfully searched for a pre render hook. My thought was I might be able to inject the template based on the category.
  • After setting the category and product design options to my template, the products still render with the system default template.

For example: For all products in category Default, use template: app/design/frontend/base/default/template/checkout/cart/item/default.phtml

For products in category CustomCart, use template: app/design/frontend/default/customcart/template/checkout/cart/item/default.phtml

2

2 Answers

1
votes

This should be quite easy. Try to insert a code like that in the "custom design" tab of your category:

  <reference name="product.info">
    <block type="catalog/product_view_type_simple" name="product.info.simple">
      <action method="setTemplate">
        <template>checkout/cart/item/default.phtml</template>
      </action>
    </block>
  </reference>

You need to change the product type and product name respectively.

0
votes

The way I ended up solving this was by adding a custom product type in my module. Then in the checkout.xml layout file, I added a new addItemRenderer action for the custom type.

I'm not sure if this is the easiest way to handle it, but it ended up working without too much effort.

If somebody needs help on adding a new Product Type, I found this thread very helpful. http://www.magentocommerce.com/boards/viewthread/27737/P15/