This support ticket is created 2 years, 9 months ago. There's a good chance that you are reading advice that it now obsolete.
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.
No supporters are available to work today on Toolset forum. Feel free to create tickets and we will handle it as soon as we are online. Thank you for your understanding.
I have a views that shows items with a price. I would like to create a shortcode in toolset to retrieve the maximum and minimum price of the filtered items and show them in a text
Your View outputs a series of posts (which may have been filtered), and you want to display the the max and min prices from just those posts, yes?
This is a bit tricky and requires more than a simple shortcode.
I imagine two ways you may do this; choose whichever you are most comfortable with (and if you are not comfortable with either, you will need to recruit a developer to code this for you).
The first is to create two shortcodes.
One is added inside the loop. It doesn't output anything itself, but it uses static variables to keep track which is the min and max price so far (comparing the existing min and max with the current prices and updating where necessary).
When you get to the end of the loop those static variables will contain the min and max prices for all the posts iterated over.
You then have a second shortcode (or two separate shortcodes) which use this static value for min and for max and return them as strings. You would add the shortcode(s) after the closing /wpv-loop element but before the closing /wpv-items-found shortcode.
If you needed the prices to appear somewhere else, it may be possible (I'm not sure, I haven't tested it) to use the wpv_filter_query_post_process hook (which is triggered after the View query has been run but before the results are output) to loop over the results, get the prices, calculate the min and max, and then register some shortcode which simply outputs those min and max values. Include the shortcode itself in the output section of the View where you want it to appear.