Magento – Remove item-options price from checkout cart

cartcheckoutmagento-1.7

I'm looking for a way to remove the value of an item-option from the checkout cart, just removing the text as highlighted below:

Products in cart

I believe this is located in the file app/design/frontend/base/default/template/checkout/cart/item/default.phtml as "item-option"

<?php if ($_options = $this->getOptionList()):?>
        <dl class="item-options">
            <?php foreach ($_options as $_option) : ?>
            <?php $_formatedOptionValue = $this->getFormatedOptionValue($_option) ?>
            <dt><?php echo $this->htmlEscape($_option['label']) ?></dt>
            <dd<?php if (isset($_formatedOptionValue['full_view'])): ?> class="truncated"<?php endif; ?>><?php echo $_formatedOptionValue['value'] ?>
                <?php if (isset($_formatedOptionValue['full_view'])): ?>
                <div class="truncated_full_value">
                    <dl class="item-options">
                        <dt><?php echo $this->htmlEscape($_option['label']) ?></dt>
                        <dd><?php echo $_formatedOptionValue['full_view'] ?></dd>
                    </dl>
                </div>
                <?php endif; ?>
            </dd>
            <?php endforeach; ?>
        </dl>
        <?php endif;?>

Best Answer

It appears as though OP has solved this issue:

Resolved product in cart issue

There are a buffet of options here. This can be accomplished without a class rewrite by using a custom renderer class or renderer template. The Mage_Checkout_Block_Cart_Abstract sets the default renderer:

public function __construct()
{
    parent::__construct();
    $this->addItemRender('default', 'checkout/cart_item_renderer', 'checkout/cart/item/default.phtml');
}

Additional renderers are specified in checkout.xml:

<checkout_cart_index translate="label">
    <!-- ... -->
    <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>
            <action method="chooseTemplate"/>
            <action method="addItemRender"><type>simple</type><block>checkout/cart_item_renderer</block><template>checkout/cart/item/default.phtml</template></action>
            <action method="addItemRender"><type>grouped</type><block>checkout/cart_item_renderer_grouped</block><template>checkout/cart/item/default.phtml</template></action>
            <action method="addItemRender"><type>configurable</type><block>checkout/cart_item_renderer_configurable</block><template>checkout/cart/item/default.phtml</template></action>
     <!-- ... ->
</checkout_cart_index

It is possible to override these templates & specifications using similar directives in custom layout XML:

<checkout_cart_index>
    <action method="addItemRender" block="checkout.cart">
        <type>configurable</type>
        <block>checkout/cart_item_renderer_configurable</block
        <template>checkout/cart/item/configurable.phtml</template> <!-- custom! -->
    </action>
</checkout_cart_index>

The Mage_Catalog_Helper_Product_Configuration::getFormattedOptionValue() method is ultimately responsible for building the array which is parsed for the display - it's possible to rewrite that class method, but it would be necessary to ensure no knock-on effects exist with other types.

Related Topic