PDA

View Full Version : Phone number not correct.



Oleg Aleksandrov
January 18, 2018, 07:07 AM
Good day.

I try to print the phone number in the listing.tpl template.

{$listing.phone_number}

On an output I receive
c: 7983 | a: 321 | n: 5599

How do I correctly do this.

Template: Escort Wide

Mustafa ilker Yonel
January 18, 2018, 08:45 AM
one way could be
{$listing.phone_number|replace:c:':' '|replace:'a: ':' '|replace:'n: ':' '|replace:'|':''}

Rudi
January 18, 2018, 09:15 AM
Hello,

You can get your value using this path: {$listing.fields.phone_number.value}

Oleg Aleksandrov
January 18, 2018, 09:26 AM
2 Rudi

How do I add in $listing.fields I have only the country and country2.

Rudi
January 18, 2018, 09:40 AM
You should go to Categories > Categories > your primary category or parent category > Build > Build Browse Form > add fields you need
and then use them: {$listing.fields.your_field_key.value}

but you should disable them for standard displaying:

find <li class = "fields"> and add your field to {if...} area like this:



{if ... || $listing.fields.your_field_key.value}
{continue}
{/if}

Oleg Aleksandrov
January 18, 2018, 09:49 AM
Yeeeehaaaaaaa Rudi very very thanks :wub: :))))))

Oleg Aleksandrov
January 18, 2018, 10:32 AM
2Rudi

Another question, perhaps when adding a new profile by default, set the country code when adding a phone.

Rudi
January 18, 2018, 08:37 PM
By default, there is no such feature
it can be implemented as a customization

but you can set a default value for 'code' section that will be always displayed on profile form:
for that you should go to templates > your template > tpl > blocks > field.tpl > find a row "{elseif $field.Type == 'phone'}" > in first "input' change a code

from:


{if $fVal.$fKey.code}value="{$fVal.$fKey.code}"{/if}


to:


value="your_default_value"



If you need to use multiple codes to allow user to select his code you can do the following:

go to Common > Data Entries > create an entry with necessary country codes
then go to Listings > Listing Fields > your phone field > Edit > Link to Data Entries > select your country codes entry
in 'Field format' uncheck 'Code' option > Save

And now the 'Area' part will be represented as 'Code' section with dropdown list on profile form

Nazzal
July 30, 2020, 12:03 AM
By default, there is no such feature
it can be implemented as a customization

but you can set a default value for 'code' section that will be always displayed on profile form:
for that you should go to templates > your template > tpl > blocks > field.tpl > find a row "{elseif $field.Type == 'phone'}" > in first "input' change a code

from:


{if $fVal.$fKey.code}value="{$fVal.$fKey.code}"{/if}


to:


value="your_default_value"



If you need to use multiple codes to allow user to select his code you can do the following:

go to Common > Data Entries > create an entry with necessary country codes
then go to Listings > Listing Fields > your phone field > Edit > Link to Data Entries > select your country codes entry
in 'Field format' uncheck 'Code' option > Save

And now the 'Area' part will be represented as 'Code' section with dropdown list on profile form

Hello Rudi,

The first solution is not worked with me, so I tried the second solution but the country code (999) replaced by Area code instead of Country code. 3822

Nazzal
July 30, 2020, 12:07 AM
3823 screenshot attached

Rudi
July 30, 2020, 11:37 AM
Hello,

What exactly do you need to achieve?

Nazzal
July 30, 2020, 11:45 AM
Hello,

What exactly do you need to achieve?

just to make the country code fixed, +123(fixed)-12-1234567

Rudi
July 30, 2020, 03:28 PM
Do you need to use the dropdown list for area code part?

It will require a customization

or follow the instructions below to set default country code value

Nazzal
July 30, 2020, 03:33 PM
Hello Rudi,

I followed the mentioned instructions but it doesn't work :unsure:

Nazzal
July 30, 2020, 07:46 PM
By default, there is no such feature
it can be implemented as a customization

but you can set a default value for 'code' section that will be always displayed on profile form:
for that you should go to templates > your template > tpl > blocks > field.tpl > find a row "{elseif $field.Type == 'phone'}" > in first "input' change a code

from:


{if $fVal.$fKey.code}value="{$fVal.$fKey.code}"{/if}


to:


value="your_default_value"



If you need to use multiple codes to allow user to select his code you can do the following:

go to Common > Data Entries > create an entry with necessary country codes
then go to Listings > Listing Fields > your phone field > Edit > Link to Data Entries > select your country codes entry
in 'Field format' uncheck 'Code' option > Save

And now the 'Area' part will be represented as 'Code' section with dropdown list on profile form

Now its work great, I change it from reg_account.tpl not from field.tpl :)

Thanks alot Rudi