1
votes

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: enter image description here

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

Thanks for the help

2
FYI, Magento now has its own StackExchange site: magento.stackexchange.comJohn Conde

2 Answers

3
votes

To resolve this issue you have to override the *Mage_Bundle_Helper_Catalog_Product_Configuration* class.

Create, in your localpool, a new Mage folder with respective subfolders of the helper

/---app
|   /---code
|       /---local
|           /---Mage
|               /---Bundle
|                   /---Helper
|                       /---Catalog
|                           /---Product
|                               /---Configuration.php

Copy the helper and edit the method getBundleOptions. You have to remove in $option['value'] this code

Mage::helper('core')->currency($this->getSelectionFinalPrice($item, bundleSelection)

To obtain this new method

   public function getBundleOptions(Mage_Catalog_Model_Product_Configuration_Item_Interface $item)
    {
        $options = array();
        $product = $item->getProduct();

        /**
         * @var Mage_Bundle_Model_Product_Type
         */
        $typeInstance = $product->getTypeInstance(true);

        // get bundle options
        $optionsQuoteItemOption = $item->getOptionByCode('bundle_option_ids');
        $bundleOptionsIds = $optionsQuoteItemOption ? unserialize($optionsQuoteItemOption->getValue()) : array();
        if ($bundleOptionsIds) {
            /**
            * @var Mage_Bundle_Model_Mysql4_Option_Collection
            */
            $optionsCollection = $typeInstance->getOptionsByIds($bundleOptionsIds, $product);

            // get and add bundle selections collection
            $selectionsQuoteItemOption = $item->getOptionByCode('bundle_selection_ids');

            $selectionsCollection = $typeInstance->getSelectionsByIds(
                unserialize($selectionsQuoteItemOption->getValue()),
                $product
            );

            $bundleOptions = $optionsCollection->appendSelections($selectionsCollection, true);
            foreach ($bundleOptions as $bundleOption) {
                if ($bundleOption->getSelections()) {
                    $option = array(
                        'label' => $bundleOption->getTitle(),
                        'value' => array()
                    );

                    $bundleSelections = $bundleOption->getSelections();

                    foreach ($bundleSelections as $bundleSelection) {
                        $qty = $this->getSelectionQty($product, $bundleSelection->getSelectionId()) * 1;
                        if ($qty) {
                            $option['value'][] = $qty . ' x ' . $this->escapeHtml($bundleSelection->getName());

                        }
                    }

                    if ($option['value']) {
                        $options[] = $option;
                    }
                }
            }
        }

        return $options;
    } 
0
votes

You can also achieve the same result by pure css. Try the following code in your css to remove the prices of items of bundle products.

.item-options dd span.price{ display:none; }