I haven't tested this, so I'm just taking a wild guess.
The link you mentioned from integer-net explains how to use a select field using a class Namespace_Module_Block_Config_Adminhtml_Form_Field_Country
as renderer.
Using the same example, just add a new method to the renderer class (mentioned above)
public function getExtraParams()
{
return ' multiple="multiple" ';
}
On the other hand, this might not work since for multiple selects you have too have the input name like name[]
instead of name
so you can receive an array via post or get from it.
If it does not work try to replace
$this->addColumn('country_id', array(
'label' => Mage::helper('namespace_module')->__('Country'),
'renderer' => $this->_getRenderer(),
));
with
$this->addColumn('country_id[]', array(
'label' => Mage::helper('namespace_module')->__('Country'),
'renderer' => $this->_getRenderer(),
));
Again, not sure this will work.
I'm just throwing out ideas that are simple to test and don't involve a lot of coding. Maybe you get lucky and one works.
Update
In the same class where you added the method getExtraParams
try adding / changing the method setInputName
.
Make it look like this:
public function setInputName($value)
{
return $this->setName($value.'[]');
}
second Update
change the method _prepareArrayRow
in your shippingCosts
block (in the example) to this:
protected function _prepareArrayRow(Varien_Object $row)
{
$countries = $row->getData('country_id');
foreach ($countries as $country) {
$row->setData(
'option_extra_attr_' . $this->_getRenderer()
->calcOptionHash($country),
'selected="selected"'
);
}
}
and it should work. And put back the column name from country_id[]
to country_id
.