Magento – Removing custom option values from cart/checkout page

ce-1.7.0.2custom-optionsoverrides

My question is an exact duplicate of Remove item-options price from checkout cart except I don't quite understand the accepted answer. I assume I'd have to create a custom template file for this to work? This wouldn't be a problem if I understood what to include in that template file … i.e. how I would display the custom option label but not value. If my assumption is not right please correct me.

Is there an alternative way? Maybe overriding a class/method?

Best Answer

The custom options are displayed in the default template with the following snippet:

<?php if ($_options = $this->getOptionList()):?>
<dl class="item-options">
    <?php foreach ($_options as $_option) : ?>
    <?php $_formatedOptionValue = $this->getFormatedOptionValue($_option) ?>
    <dt><?php echo $this->escapeHtml($_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->escapeHtml($_option['label']) ?></dt>
                <dd><?php echo $_formatedOptionValue['full_view'] ?></dd>
            </dl>
        </div>
        <?php endif; ?>
    </dd>
    <?php endforeach; ?>
</dl>
<?php endif;?>

So for the needs you have described you could strip this back to simply show the label.

<?php if ($_options = $this->getOptionList()):?>
<dl class="item-options">
    <?php foreach ($_options as $_option) : ?>
    <dt><?php echo $this->escapeHtml($_option['label']) ?></dt>
    </dd>
    <?php endforeach; ?>
</dl>
<?php endif;?>
Related Topic