View Full Version : How to change the "Price" input fields to a dropdown menu with a fixed pricing range?

Ivan Amador
July 2, 2015, 03:08 AM
How to change the "Price" input fields to a dropdown menu where you can select a fixed pricing. (ie: $1,000 - $500,000)
But this needs to be related to the currency and the Property for (rent or sale) selected by user. The range for Sale shouldn't be the same as the range for Rent.

If I change this code here FTP > templates > your template > tpl > blocks > field_search.tpl

<input {if $fVal.$fKey.from}value="{$fVal.$fKey.from}"{/if} placeholder="{$lang.from}" class="numeric" type="text" name="f[{$field.Key}][from]" maxlength="15" />
<input {if $fVal.$fKey.to}value="{$fVal.$fKey.to}"{/if} placeholder="{$lang.to}" class="numeric" type="text" name="f[{$field.Key}][to]" maxlength="15" />

with this one:

<select title="{$lang.from}" name="f[{$field.Key}][from]">
<option value="0">{$lang.any|replace:'-':''}</option>
{section name=from start=1000 loop=20000 step=1000}
<option value="{$smarty.section.from.index}" {if $smarty.section.from.index == $fVal.$fKey.from}selected="selected"{/if}>{$smarty.section.from.index}</option>

<select title="{$lang.from}" name="f[{$field.Key}][to]">
<option value="0">{$lang.any|replace:'-':''}</option>
{section name=to start=1000 loop=20000 step=1000}
<option value="{$smarty.section.to.index}" {if $smarty.section.to.index == $fVal.$fKey.to}selected="selected"{/if}>{$smarty.section.to.index}</option>

As Dmitry said here: http://www.flynax.com/forum/showthread.php?1965-Modification-to-the-frontend-search-engine&p=9273&viewfull=1#post9273

I will get the dropdown, but the prices wouldn't be related to the "currency" and "Property for" options.

Any idea?


September 7, 2015, 11:20 AM

What do you mean by "wouldn't be related" ?After submitting the form values are not sent?

September 7, 2015, 11:39 AM
Hello Ivan,
To bind the price field with currency you should also have currency dropdown as it presents by default.
By applying Dmitry's code you just replace the number inputs with the dropdowns but in general you have initial
search logic and the form should works properly.


September 9, 2015, 04:24 AM
Works fine for me, needed a bit of css tweaking

Sohail Zafar
March 4, 2017, 09:56 PM
How we can add like if user don't want to put price but want that people can contact him for the price and he can chose option drop down Please Contact option i try to change price field Admin Panel/Listing Fields/price/Edit Field but Field type set price how we can make it drop down so if user don't want to put price he can chose contact me option