I need to pre-select certain custom options on a Simple product. They will be either drop downs or checkboxes.


So for a custom option of type select, so drop down and checkboxes, the html for the values is generated at Mage_Catalog_Block_Product_View_Options_Type_Select::getValuesHtml().

What I would suggest to display the option defaults on the front end would be to rewrite this block and customize it to set the default options as selected.

For the checkboxes and radio have a look at the section:

$htmlValue = $_value->getOptionTypeId();
if ($arraySign) {
    $checked = (is_array($configValue) && in_array($htmlValue, $configValue)) ? 'checked' : '';
} else {
    $checked = $configValue == $htmlValue ? 'checked' : '';

And for selects and mutli-selects have a look at the section:

if ($configValue) {

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.