This is the function you are referring. At the end, select html is built by core/html_select block
public function getCountryHtmlSelect($defValue=null, $name='country_id', $id='country', $title='Country')
{
Varien_Profiler::start('TEST: '.__METHOD__);
if (is_null($defValue)) {
$defValue = $this->getCountryId();
}
$cacheKey = 'DIRECTORY_COUNTRY_SELECT_STORE_'.Mage::app()->getStore()->getCode();
if (Mage::app()->useCache('config') && $cache = Mage::app()->loadCache($cacheKey)) {
$options = unserialize($cache);
} else {
$options = $this->getCountryCollection()->toOptionArray();
if (Mage::app()->useCache('config')) {
Mage::app()->saveCache(serialize($options), $cacheKey, array('config'));
}
}
$html = $this->getLayout()->createBlock('core/html_select')
->setName($name)
->setId($id)
->setTitle(Mage::helper('directory')->__($title))
->setClass('validate-select')
->setValue($defValue)
->setOptions($options)
->getHtml();
Varien_Profiler::stop('TEST: '.__METHOD__);
return $html;
}
The good news for you are core/html_select block allows including some extra data, such as you want, using setExtraParams()
method
For instance, take a look at Mage_Checkout_Block_Onepage_Abstract::getCountryHtmlSelect() method
public function getCountryHtmlSelect($type)
{
$countryId = $this->getAddress()->getCountryId();
if (is_null($countryId)) {
$countryId = Mage::helper('core')->getDefaultCountry();
}
$select = $this->getLayout()->createBlock('core/html_select')
->setName($type.'[country_id]')
->setId($type.':country_id')
->setTitle(Mage::helper('checkout')->__('Country'))
->setClass('validate-select')
->setValue($countryId)
->setOptions($this->getCountryOptions());
if ($type === 'shipping') {
$select->setExtraParams('onchange="if(window.shipping)shipping.setSameAsBilling(false);"');
}
return $select->getHtml();
}
Mage::getBlockSingleton('directory/data')->getCountryHtmlSelect($this->getEstimateCountryId())
, So how to edit this ?