PDA

View Full Version : Show / Hide: Currency field



Fahad Almutairi
November 9, 2012, 07:45 PM
Hello my friends

I want to hide a currency field
But I can not do that

How?
---------------------------------------
You can see the picture
http://s13.postimage.org/6poqj1ktz/4354364554765765.gif

Chris Brown
November 9, 2012, 10:06 PM
I had the same done as i only haveone currency on my site, i would submit a support ticket with your request

Viktor
November 13, 2012, 06:10 AM
Hello all,

You can change it yourself in ftp:>>templates>>your_template>>tpl>>blocks>>fields_search.tpl at line ~ 132

Find code:



<select title="{$lang.currency}" name="f[{$field.Key}][currency]" style="width: 70px;">
<option value="0">{$lang.any}</option>
{foreach from='currency'|df item='currency_item'}
<option value="{$currency_item.Key}" {if ($currency_item.Key == $fVal.$fKey.currency) || $currency_item.Default}selected="selected"{/if}>{$lang[$currency_item.pName]}</option>
{/foreach}
</select>


and replace to:



{assign var='currencies_count' value='currency'|df|@count}
<select title="{$lang.currency}" name="f[{$field.Key}][currency]" style="width: 70px; {if $currencies_count == 1}display: none;{/if}">
{if $currencies_count > 1}<option value="0">{$lang.any}</option>{/if}
{foreach from='currency'|df item='currency_item'}
<option value="{$currency_item.Key}" {if ($currency_item.Key == $fVal.$fKey.currency) || $currency_item.Default}selected="selected"{/if}>{$lang[$currency_item.pName]}</option>
{/foreach}
</select>

Hans
November 24, 2012, 07:26 AM
Hi,

I adjusted the field s_search.tpl file.
But I see it only works for rent on the quick search on the home page. But not for sale.

Do others have the same problem?

And in which files can I also adjusted for the quick and advanced files on the search page?

Thanks in advance!

Mike
November 29, 2012, 07:26 AM
Hello,

fields_search.tpl file is for all search forms of the website.

Simple way to hide it is just replace



<select title="{$lang.currency}" name="f[{$field.Key}][currency]" style="width: 70px;">
<option value="0">{$lang.any}</option>
{foreach from='currency'|df item='currency_item'}
<option value="{$currency_item.Key}" {if ($currency_item.Key == $fVal.$fKey.currency) || $currency_item.Default}selected="selected"{/if}>{$lang[$currency_item.pName]}</option>
{/foreach}
</select>


with



<input type="hidden" name="f[{$field.Key}][currency]" value="your_default_key" />


your_default_key you can get from the Admin Panel >> Data Entries >> Currency|manage >> your currency|edit

Hans
December 5, 2012, 01:40 PM
I replaced it with the new code.

But still shows the currency dropdownmenu.

shouldn't you also remove:

<td class="field">
<div>{$lang.currency}</div>
</td>

and

<select name="f[{$field.Key}][currency]" class="w80">
<option value="0">{$lang.any}</option>
{foreach from='currency'|df item='currency_item'}
<option value="{$currency_item.Key}" {if $currency_item.Key == $fVal.$fKey.currency}selected="selected"{/if}>{$lang[$currency_item.pName]}</option>
{/foreach}
</select>

Viktor
December 6, 2012, 03:34 AM
Hello Hans,

You can find this code:



<select title="{$lang.currency}" name="f[{$field.Key}][currency]" style="width: 70px;">
<option value="0">{$lang.any}</option>
{foreach from='currency'|df item='currency_item'}
<option value="{$currency_item.Key}" {if ($currency_item.Key == $fVal.$fKey.currency) || $currency_item.Default}selected="selected"{/if}>{$lang[$currency_item.pName]}</option>
{/foreach}
</select>


and replace to:



{assign var='currency_for_price' value='currency'|df}
{if $currency_for_price|@count > 1}
<select title="{$lang.currency}" name="f[{$field.Key}][currency]" style="width: 70px;">
<option value="0">{$lang.any}</option>
{foreach from='currency'|df item='currency_item'}
<option value="{$currency_item.Key}" {if ($currency_item.Key == $fVal.$fKey.currency) || $currency_item.Default}selected="selected"{/if}>{$lang[$currency_item.pName]}</option>
{/foreach}
</select>
{else}
<input type="hidden" name="f[{$field.Key}][currency]" value="{$currency_for_price.0.Key}" />
{/if}

Giuseppe Zappala
May 21, 2013, 12:22 PM
Hello Viktor,
I tried to make changes to the file fields_search.tpl you have indicated, but I do not delete the currency field!
I would like to delete it as I do?
Thanks in advance

Viktor
May 22, 2013, 03:44 AM
Hello Giuseppe Zappala,

Would you please send me ftp access details in PM I will check it on your site and solve ASAP.
Then I will write you what was wrong.

Viktor
May 22, 2013, 11:49 AM
Hello Giuseppe Zappala,

Code written above is correct but your site has 2 currencies and that's why system cannot hide currency field. Please remove 1 currency from admin panel >> data entries. and system hide currency field.

Giuseppe Zappala
May 22, 2013, 11:53 AM
Thank you very much!
The code was correct but I was 2 currencies.
Now it works perfectly

Wei Hong
January 18, 2014, 08:33 AM
Hi Viktor,
Is there anyway to instead of hiding the dropdown menu, can we only show the currency name/sign on the right? If I only have dollar in my currency data

Wei Hong
January 19, 2014, 08:43 AM
Already figured it out :D

Wei Hong
January 25, 2014, 08:53 PM
Hi Viktor,
How do I do the same thing with Mixed listing field if it only has 1 entry?

Mike
January 29, 2014, 06:25 AM
Hi Wei Hong,

Do you need for search form or add form?

for search edit template/blocks/fields_search.tpl



{elseif $field.Type == 'mixed'}
<input value="{if $fVal.$fKey.from}{$fVal.$fKey.from}{else}{$lang.fr om}{/if}" class="numeric w60 field_from" type="text" name="f[{$field.Key}][from]" maxlength="15" /><img alt="" src="{$rlTplBase}img/blank.gif" class="between" /><input value="{if $fVal.$fKey.to}{$fVal.$fKey.to}{else}{$lang.to}{/if}" class="numeric w60 field_to" type="text" name="f[{$field.Key}][to]" maxlength="15" />

{if !empty($field.Condition)}
{assign var='df_source' value=$field.Condition|df}
{else}
{assign var='df_source' value=$field.Values}
{/if}

{if $df_source|@count > 1}
<select name="f[{$field.Key}][df]" class="w80">
<option value="0">{$lang.any}</option>
{foreach from=$df_source item='df_item'}
<option value="{$df_item.Key}" {if $df_item.Key == $fVal.$fKey.df}selected="selected"{elseif $df_item.Default}selected="selected"{/if}>{$lang[$df_item.pName]}</option>
{/foreach}
</select>
{else}
{foreach from=$df_source item='df_item'}{$lang[$df_item.pName]}{/foreach}
{/if}


for add/edit similar changes should be done to template/blocks/field.tpl




{elseif $field.Type == 'mixed' || $field.Type == 'unit'}
<input class="numeric w80" type="text" name="f[{$field.Key}][value]" size="8" maxlength="15" {if $fVal.$fKey.value}value="{$fVal.$fKey.value}"{/if} />
{if !empty($field.Condition)}
{assign var='df_source' value=$field.Condition|df}
{else}
{assign var='df_source' value=$field.Values}
{/if}

{if $df_source|@count > 1}
<select name="f[{$field.Key}][df]" class="w60">
{foreach from=$df_source item='df_item' key='df_key'}
<option value="{$df_item.Key}" {if $fVal.$fKey.df}{if $df_item.Key == $fVal.$fKey.df}selected="selected"{/if}{else}{if ($df_key == $field.Default) || $df_item.Default}selected="selected"{/if}{/if}>{$lang[$df_item.pName]}</option>
{/foreach}
</select>
{else}
<input type="hidden" name="f[{$field.Key}][df]" value="{foreach from=$df_source item='df_item'}{$df_item.Key}{/foreach}" />
{foreach from=$df_source item='df_item'}{$lang[$df_item.pName]}{/foreach}
{/if}

Shlomit Steinitz
March 9, 2015, 01:18 AM
Hi, I have the same question as Wei Hong, thanks.


Is there anyway to instead of hiding the dropdown menu, can we only show the currency name/sign on the right? If I only have dollar in my currency data

Giuseppe Mollo
May 17, 2016, 08:29 AM
Hy! I have 2 currency on my site, but i want to hide the "-Any-" from select and make one of the currency to be selected. How can i do that? Ex: I have RON and EUR and i want to be selected RON. Thanks!
found here http://forum.flynax.com/showthread.php?2546-Currency-and-unit-selected-by-default-in-all-search-forms
:)