0

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;?>
7
  • You want to hide item-options? Or you want to remove from the object? – philwinkle Apr 15 '13 at 13:57
  • If you click the image link it's probably easier to see. Just the price off the item-options. – user994319 Apr 15 '13 at 14:40
  • The price probably has an html <span> with a class. Can you use inspect element in Chrome or Firefox and show the generated source for the item-options class dl? – philwinkle Apr 15 '13 at 15:11
  • Have already, there isn't a span from what I can see. You are welcome to have a look yourself foscamuk.co.uk/checkout/cart – user994319 Apr 15 '13 at 15:19
  • If you print options array you can able to see price in option label just put condition using this price label – Mufaddal Apr 16 '13 at 5:11
3

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.