Q:

magento - default size of select box

I need to move the "advanced search" feature of magento ecommerce to a sidebar.
In order to make it more compact I want to reduce the size of the "select" boxes.
The code in the advanced search phtml file looks like this:
<?php break;
case 'select': ?>
<div class="controls">
<?php echo $this->getAttributeSelectElement($_attribute) ?>
</div>

And the resulting html is this:
<div class="controls">
<select name="stagione[]" id="stagione" class="multiselect" title="Stagionalità" multiple="multiple" size="4">
...
</select>
</div>

How can I correct the size="4" to default to size="1" possibly just working on the phtml file without touching the core magento files?

A:

It's impossible to make this in a phtml file, because the size of the select is hardcoded in Mage_CatalogSearch_Block_Advanced_Form::getAttributeSelectElement.
// 2 - avoid yes/no selects to be multiselects
if (is_array($options) && count($options)>2) {
    $extra = 'multiple="multiple" size="4"';
    $name.= '[]';
}

You can create a rewrite for this block and override it.

