Zero missing from Products price

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Locked
Smeleck
Forum Members
Forum Members
Posts: 19
Joined: Tue Aug 14, 2018 6:35 pm

Zero missing from Products price

Post 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
User avatar
DIGI3
Dev Team Member
Dev Team Member
Posts: 1629
Joined: Wed Feb 25, 2009 4:25 am
Location: Victoria, BC

Re: Zero missing from Products price

Post 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}
Not getting the answer you need? CMSMS support options
Smeleck
Forum Members
Forum Members
Posts: 19
Joined: Tue Aug 14, 2018 6:35 pm

Re: Zero missing from Products price

Post by Smeleck »

Hi
Can you tell me which files I should be looking at.

Thanks
User avatar
DIGI3
Dev Team Member
Dev Team Member
Posts: 1629
Joined: Wed Feb 25, 2009 4:25 am
Location: Victoria, BC

Re: Zero missing from Products price

Post 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.
Not getting the answer you need? CMSMS support options
Smeleck
Forum Members
Forum Members
Posts: 19
Joined: Tue Aug 14, 2018 6:35 pm

Re: Zero missing from Products price

Post 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
User avatar
DIGI3
Dev Team Member
Dev Team Member
Posts: 1629
Joined: Wed Feb 25, 2009 4:25 am
Location: Victoria, BC

Re: Zero missing from Products price

Post 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.
Not getting the answer you need? CMSMS support options
Smeleck
Forum Members
Forum Members
Posts: 19
Joined: Tue Aug 14, 2018 6:35 pm

Re: Zero missing from Products price

Post 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
User avatar
DIGI3
Dev Team Member
Dev Team Member
Posts: 1629
Joined: Wed Feb 25, 2009 4:25 am
Location: Victoria, BC

Re: Zero missing from Products price

Post 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.
Not getting the answer you need? CMSMS support options
Smeleck
Forum Members
Forum Members
Posts: 19
Joined: Tue Aug 14, 2018 6:35 pm

Re: Zero missing from Products price Solved

Post 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.
Locked

Return to “Modules/Add-Ons”