Page 1 of 1

Products Module - only show products with custum field checkbox tick

Posted: Wed Jul 28, 2010 11:28 am
by ukmgranger
Hi - again!

As the title says really,

I want to show a list of products, but only show the products that have got a custom field tickbox (with a tick in it).

For example - only show campsites that allow campfires.

Any ideas?

Re: Products Module - only show products with custum field checkbox tick

Posted: Wed Jul 28, 2010 4:13 pm
by tyman00
Use {get_template_vars} in your summary or hierarchy template to see what variables are available. To you in that mode. I think your checkbox should be there.

Then inside of your foreach loop you can do something like this:

Code: Select all

{if $checkboxVariable == "checkedValue}
Display product information
{/if}
That's a really rough draft on how to do it. But this could get you some great direction on where to go.

You can also check out Calguy's blog post on custom templating here: http://calguy1000.com/Blogs/12/60/basic ... kills.html

There is also good information here: http://forum.cmsmadesimple.org/index.ph ... 689.0.html

You can take the information from both articles and use it to work your way through your setup.

Re: Products Module - only show products with custum field checkbox tick

Posted: Wed Jul 28, 2010 9:18 pm
by Peciura
Could be easier if you set similar category "campfires"

Re: Products Module - only show products with custum field checkbox tick

Posted: Wed Jul 28, 2010 9:21 pm
by tyman00
That's actually a very good suggestion. It passed through my mind while I was responding and forgot to address it.

It will still allow for campfires to be selected with a checkbox and you can just the categorylist option to display all campsites that have that box checked.