Show only "active" products

2 posts by 2 authors in: Forums > CMS Builder
Last Post: June 20, 2008   (RSS)

By IronVictory - June 20, 2008

I have set up a checkbox called "Active" and I don't want to display any items that are not checked. I could put it in the URL like this:
viewer.php?category=tents&active=1, but I don't want to show the active=1 in the URL as users could easily change it to active=0 to see all the inactive items. If I remove it from the URL and use 'where' => 'active ="1"'; I believe it will override the category=tents as well. Is there a way to still use ?category=tents in the URL but "hide" the active variable?

Re: [IronVictory] Show only "active" products

By Dave - June 20, 2008

Hi IronVictory,

You're on the right track. The old viewer code worked like that - when you had a 'where' field it would ignore the search fields. The new viewer code doesn't. You can tell the difference by the style of code:

// old code style:
$options['where'] = 'active ="1"';

// new code style:
'where' => 'active ="1"',

Try adding the where as you suggested, it should do the job. Also, for a list and description of all the viewer options see this page: http://www.interactivetools.com/docs/cmsbuilder/viewer_options.html.

With the new system searching is always enabled unless you disable it with: allowSearch => false,

Hope that helps!
Dave Edis - Senior Developer
interactivetools.com