Sanjoy Roy

[MCM, MCP, SCJP] – Senior PHP Programmer

Magento – How to Change multiselect list box to select box?


In magento, by default if a select option has more than 2 values, it automatically make the select box to multiselect box.
if you need to change this to remain always select box, here is how to do:

Steps:
Edit the Form.php:
Location: /public_html/app/code/core/Mage/CatalogSearch/Block/Advanced/Form.php
Position: public function getAttributeSelectElement($attribute)
Line no.: 185
What to change: <pre>if (is_array($options) && count($options)>2)</pre>  to <pre>if (is_array($options) && count($options)>100)</pre>

One response to “Magento – How to Change multiselect list box to select box?

  1. Jeff 18/02/2011 at 6:52 PM

    Hi,

    I have updated this line which works great. However, in my dropdown box, I want to show “Select” option which is preselected. Currently Color Yellow is coming as preselected so added in search automatically.

    Thanks

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: