Can anyone explain how I can hide the product price if the price field is empty or zero?
Or a method of changing the price to 'Free'
I have tried to hide the price with this code in the template but fails, although it works for other fields.
{if $entry->price->value != ""}
Price:- {$currency_symbol}{$entry->price}
{/if}
Thanks for any help.
A Products Price?
Re: A Products Price?
Try taking out the ->value part as you just checking to see if the price is empty...
Re: A Products Price?
Try
Code: Select all
{if !empty($entry->price)}{$entry->price|number_format:2}{else}FREE{/if}Re: A Products Price?
Additional bit to velden's code to check for price > 0 (untested):
Code: Select all
{if !empty($entry->price) AND ($entry->price > 0)}{$entry->price|number_format:2}{else}FREE{/if}To copy System Information to the forum:
https://docs.cmsmadesimple.org/troubles ... nformation
CMS Made Simple Geekmoots attended:
Nottingham, UK 2012 | Ghent, Belgium 2015 | Leicester, UK 2016
https://docs.cmsmadesimple.org/troubles ... nformation
CMS Made Simple Geekmoots attended:
Nottingham, UK 2012 | Ghent, Belgium 2015 | Leicester, UK 2016
Re: A Products Price?
Hi Both
Thanks for you help it works a treat.
Regards
Thanks for you help it works a treat.
Regards



