Skip Navigation

[Resolved] Thousand separator for custom field price

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 4 replies, has 2 voices.

Last updated by Minesh 1 year, 11 months ago.

Assisted by: Minesh.

Author
Posts
#2546815

Tell us what you are trying to do?

I need to be able to print my prices of a custom filed with a thousand separator.

I did achieve to do so following this thread: https://toolset.com/forums/topic/table-sorting-numbers-and-currency-not-working-properly/

It works well with legacy views, but now Im working with the blocks views, and even when I add a shortcode and use the same indicated the thread, the very same working properly on the legacy view, now the retrieving price is 0

Page is "my account" of hidden link (need to be logged in and have a property submitted to see the issue)
I can provide user and password if needed

Thanks in advance

#2546993

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Hello. Thank you for contacting the Toolset support.

Can you please share problem URL where you added that shortcode and let me check whats going wrong with your setup.

*** Please make a FULL BACKUP of your database and website.***
I would also eventually need to request temporary access (WP-Admin and FTP) to your site.

I have set the next reply to private which means only you and I have access to it.

#2550083

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

When I checked the view that displays the correct number format - I can see the price field is displayed using the shortcode:
[ts_format_number] shortcode as you can see follows:

<p class="property_price">$[ts_format_number][types field="price"][/types][/ts_format_number]</p>

To display correct thousand separator when using blocks wherever applicable or wherever you want to display correct thousands separator, you should add a "Fields and Text" block and add the above line of code and that should fix your issue.

#2550321
Captura de Pantalla 2023-02-08 a la(s) 12.47.52.png
Captura de Pantalla 2023-02-08 a la(s) 12.45.47.png

Hi Minesh

It didn't work as expected, and retrieving a price = 0

I'm attaching an image to expose my configuration, and it's visible on the first slider on home page

Hope to hear from you

#2550767

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Can you please check now: hidden link

I've added the following custom shortcode to "Custom Code" section offered by Toolset:
=> hidden link

add_shortcode( 'ts_format_number1', 'ts_format_number_func1');
function ts_format_number_func1( $atts, $content ) {
if($atts['price']!=0 or $atts['price']!='') {
  $int = $atts['price'];
 
  return number_format($int, 0);
}else{ 
   return 0; 
}
}

And within your view I've called the above shortcode as given under:

<p>$[ts_format_number1 price='[types field='price' output='raw'][/types]']</p>