Is it possible to add custom values to select options e.g. in configurable products?
I need to add the sku of the option to the option, so that it will become
<option id="354" price="10" sku="my_sku">Option name</option>
I figured out that the Block Class of the Select is Mage_Catalog_Block_Product_View_Options_Type_Select
, so I overrided the class but I don't know which code I have to edit.
I found the definition of addOption
in Mage_Catalog_Model_Product_Option
but there is no big logic.
Edit: This is not the right definition.
The right definition is in the Block class Mage_Core_Block_Html_Select
/**
* Add an option to HTML select
*
* @param string $value HTML value
* @param string $label HTML label
* @param array $params HTML attributes
* @return Mage_Core_Block_Html_Select
*/
public function addOption($value, $label, $params=array())
{
$this->_options[] = array('value' => $value, 'label' => $label, 'params' => $params);
return $this;
}
Cache is deactivated.