• twitter image
  • facebook image
  • youtube image
  • linkedin image
Language: CMS Made Simple Czech CMS Made Simple France CMS Made Simple Spain CMS Made Simple Hungary CMS Made Simple Russia CMS Made Simple Netherlands

All times are UTC




Post new topic Reply to topic  [ 4 posts ] 
Author Message
 Post subject: [SOLVED] Products module - show icons if selected option is 'true'
PostPosted: Thu May 07, 2009 8:28 am 
Offline
Forum Members
Forum Members

Joined: Wed Apr 04, 2007 9:54 am
Posts: 72
Hi there,

I am using the products module to build a database of campsites that allow campfiers in the UK.  You can see it here:
http://www.campfires-allowed.co.uk

I have a set of custom fields set up as check boxes which I want to use to show an icon on the products page if it is set to true.

The code below shows what I have done for this, but it isn't working quite right.  Basically the code below shows the icon if there is ANY value in the checkbox - true or false.

How would I have it only display the icon when the value is 'true'?

\$1:
{if $entry->fields.CaravansAllowed->value}
<div class="icon">
<img src="uploads/images/iconCaravan.png" alt="Caravans Allowed" width="38" height="38" />
</div>
{/if}


Thanks in advance people.:)


Last edited by ukmgranger on Thu May 07, 2009 3:56 pm, edited 1 time in total.

Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: Products module - show icons if selected option is 'true'
PostPosted: Thu May 07, 2009 2:16 pm 
Offline
Power Poster
Power Poster

Joined: Mon Jun 12, 2006 9:02 pm
Posts: 1900
ukmgranger \ukmgranger:
Hi there,

I am using the products module to build a database of campsites that allow campfiers in the UK.  You can see it here:
http://www.campfires-allowed.co.uk

I have a set of custom fields set up as check boxes which I want to use to show an icon on the products page if it is set to true.

The code below shows what I have done for this, but it isn't working quite right.  Basically the code below shows the icon if there is ANY value in the checkbox - true or false.

How would I have it only display the icon when the value is 'true'?

\$1:
{if $entry->fields.CaravansAllowed->value}
<div class="icon">
<img src="uploads/images/iconCaravan.png" alt="Caravans Allowed" width="38" height="38" />
</div>
{/if}


Thanks in advance people.:)


Just a guess (untested):
\$1:
{if $entry->fields.CaravansAllowed->value == "1"}
<div class="icon">
<img src="uploads/images/iconCaravan.png" alt="Caravans Allowed" width="38" height="38" />
</div>
{/if}


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: [SOLVED] Products module - show icons if selected option is 'true'
PostPosted: Thu May 07, 2009 3:58 pm 
Offline
Forum Members
Forum Members

Joined: Wed Apr 04, 2007 9:54 am
Posts: 72
Thanks jmcgin51! :)

Your solution was close enough - it is the syntax that I don't understand yet.  The solution for me was:
\$1:
{if $entry->fields.CaravansAllowed->value == "true"}
<div class="icon">
<img src="uploads/images/iconCaravan.png" alt="Caravans Allowed" width="38" height="38" />
</div>
{/if}


I just had to replace "1" for "true".

Thanks again


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
 Post subject: Re: [SOLVED] Products module - show icons if selected option is 'true'
PostPosted: Thu May 07, 2009 4:01 pm 
Offline
Power Poster
Power Poster

Joined: Mon Jun 12, 2006 9:02 pm
Posts: 1900
great!  I almost wrote "true", but decided you could probably substitute "1".  Now that I'm thinking about it, I think removing the quotes around the "1" would make it work that way.

Anyway, glad to help!


Top
  Profile  
 
Share On:
Share on Facebook Share on Twitter Share on Google+
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 4 posts ] 

All times are UTC


Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Hosting Nation - Managed CMSMS Hosting