我需要在简单产品上预选某些自定义选项。它们将是下拉菜或复选框。

有帮助吗?

解决方案

因此,对于“定制”选项选择,请下载和复选框,为值的HTML生成 Mage_Catalog_Block_Product_View_Options_Type_Select::getValuesHtml().

我建议在前端显示选项默认值的内容是重写此块并自定义以设置默认选项为选定的选项。

对于复选框和收音机,请查看该部分:

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

对于选择和mutli选择,请参阅该部分:

if ($configValue) {
    $select->setValue($configValue);
}
许可以下: CC-BY-SA归因
scroll top