Showing results for 
Search instead for 
Did you mean: 

Include SKU within Bundle Option DropDown


Include SKU within Bundle Option DropDown



When dealing with a bundled product, the associated bundle items when in the drop-down option, will display the product title along with the additional price. I have been tinkering yet unable to figure out how to include the SKU of the product as well. I believe the correct file would be the select.phtml within



However through my feeble attempts, I have not been able to include the SKU. Any ideas? Below is the file for ease of access:


<?php /* @var $this Mage_Bundle_Block_Catalog_Product_View_Type_Bundle_Option_Select */ ?>
<?php $_option      = $this->getOption(); ?>
<?php $_selections  = $_option->getSelections(); ?>
<?php $_default     = $_option->getDefaultSelection(); ?>
<?php list($_defaultQty, $_canChangeQty) = $this->_getDefaultValues(); ?>
<?php $tierPriceHtml = ''; ?>
<label<?php if ($_option->getRequired()) echo ' class="required"' ?>><?php echo $this->escapeHtml($_option->getTitle()) ?><?php if ($_option->getRequired()) echo '<em>*</em>' ?></label>
<dd<?php if ($_option->decoratedIsLast){?> class="last"<?php }?>>
<div class="input-box">
<?php /** @var $_selection Mage_Catalog_Model_Product*/ ?>
<?php if ($this->_showSingle()): ?>
    <?php echo $this->getSelectionTitlePrice($_selections[0]); ?>
    <?php if ($_selections[0]->getSelectionCanChangeQty()): ?>
        <?php $tierPriceHtml = $this->getTierPriceHtml($_selections[0]); ?>
    <?php endif; ?>
    <input type="hidden" name="bundle_option[<?php echo $_option->getId() ?>]" value="<?php echo $_selections[0]->getSelectionId() ?>"/>
<?php else:?>
    <select onchange="bundle.changeSelection(this)" id="bundle-option-<?php echo $_option->getId() ?>" name="bundle_option[<?php echo $_option->getId() ?>]" class="bundle-option-<?php echo $_option->getId() ?><?php if ($_option->getRequired()) echo ' required-entry' ?> bundle-option-select change-container-classname">
        <option value=""><?php echo $this->__('Choose a selection...') ?></option>
    <?php foreach ($_selections as $_selection): ?>
        <?php if ($_selection->getSelectionCanChangeQty() && $this->_isSelected($_selection)): ?>

            <?php $tierPriceHtml = $this->getTierPriceHtml($_selection); ?>
        <?php endif; ?>
        <option value="<?php echo $_selection->getSelectionId() ?>"<?php if ($this->_isSelected($_selection)) echo ' selected="selected"' ?><?php if (!$_selection->isSaleable()) echo ' disabled="disabled"' ?>><?php echo $this->getSelectionTitlePrice($_selection, false) ?></option>
    <?php endforeach; ?>
<?php endif; ?>
<span id="bundle-option-<?php echo $_option->getId() ?>-tier-prices"> <?php echo $tierPriceHtml; ?></span>
<span class="qty-holder">
    <label for="bundle-option-<?php echo $_option->getId() ?>-qty-input"><?php echo $this->__('Qty:') ?>&nbsp;</label><input onkeyup="bundle.changeOptionQty(this, event)" onblur="bundle.changeOptionQty(this, event)" <?php if (!$_canChangeQty) echo ' disabled="disabled"' ?> id="bundle-option-<?php echo $_option->getId() ?>-qty-input" class="input-text qty<?php if (!$_canChangeQty) echo ' qty-disabled' ?>" type="text" name="bundle_option_qty[<?php echo $_option->getId() ?>]" value="<?php echo $_defaultQty ?>"/>

Re: Include SKU within Bundle Option DropDown

After a day of racking my brain (as I don't know much php at all) I have found a solution, though maybe not the prettiest or most elegant, it works.


Within the said file;



I added to the top:


<?php $_product     = $this->getProduct(); ?>

And within the line that spits out each dropdown option, I added:


<?php echo $this->__('SKU: ') . $this->htmlEscape($_selection->getData('sku'));?>

Which then prints out each SKU for each different dropdown item after its title and price. Hope it can help someone.