Page 1 of 1
Zero missing from Products price
Posted: Tue Aug 14, 2018 6:40 pm
by Smeleck
Using CMSMS Version 2.2.5 & Products 2.28.3
Can someone explain how I can display the correct price on frontend.
If you enter £12.99 it works but £12.50 displays £12.5
I would like the zero to be shown.
Thanks
Re: Zero missing from Products price
Posted: Tue Aug 14, 2018 6:50 pm
by DIGI3
I'm not sure if Products has anything specific for this, but you could use something like {$price|string_format:"%.2f"} or {$price|number_format:2}
Re: Zero missing from Products price
Posted: Wed Aug 15, 2018 5:31 am
by Smeleck
Hi
Can you tell me which files I should be looking at.
Thanks
Re: Zero missing from Products price
Posted: Wed Aug 15, 2018 2:23 pm
by DIGI3
You shouldn't have to edit any files, it would all be in templates. For example, you may have a Cart2::View Cart Form. I just checked mine on a site and have this for displaying the total price:
Code: Select all
{$currencysymbol}{$oneitem->unit_price|as_num:2}
So there's one more method to do it.
Re: Zero missing from Products price
Posted: Wed Aug 15, 2018 2:54 pm
by Smeleck
Hi Sorry
To bother you again but we are not using a cart feature, we just display the product with price and date, we are not actually selling the product direct.
We display the product using this code on a page:-
{Products category='Events' summarytemplate='Products List View Busca' sortby='sku'} Not sure how we arrived at this.
I can only fined template orig_summary_template in the file list.
Do I have to create a new template and what from?
Thanks for your help
Re: Zero missing from Products price
Posted: Wed Aug 15, 2018 3:51 pm
by DIGI3
You should have a template called 'Products List View Busca', otherwise you'd most likely be getting an error. Check that you don't have any filtering on in the Templates list, and that it isn't on another page if you have lots of templates.
Re: Zero missing from Products price
Posted: Thu Aug 16, 2018 9:21 am
by Smeleck
Hi again
I have done a detailed search of all the files on the server and cannot find 'Products List View Busca'? It is also not being called from within another file. Not sure how or why this was done?
Could an update remove the file?
As a test I removed the request for a template, so I now only have {Products category='Events' sortby='sku'} This is within a page.
And it still works just the same albiet still without the zero in the price, so I am now totally confused as to what template is being used to show the list. I cannot see any default template at least not named.
All the templates files within the proucts module are the originals installed with the module.
Help
Re: Zero missing from Products price
Posted: Thu Aug 16, 2018 9:51 pm
by DIGI3
They wouldn't be files, they would be templates within Design Manager. Look for any Products related templates that are marked as default, and try putting something at the top so you can see it in the frontend. Once you figure out which template you're using, you can start to make changes.
Re: Zero missing from Products price Solved
Posted: Fri Aug 17, 2018 1:20 pm
by Smeleck
Hi
Finally got there I was looking in the wrong place. Zero now showing plus Free if empty.
For anyone else is benefit we now have in the template, the following.
{if !empty($entry->price) AND ($entry->price > 0)} {$currency_symbol}{$entry->price|number_format:2}{else}FREE{/if}
If we leave the price empty then it displays as 'Free'
Thanks again for your help.