Multiple Categories

3 posts by 2 authors in: Forums > CMS Builder
Last Post: August 6, 2009   (RSS)

Re: [andycal] Multiple Categories

By Chris - August 5, 2009 - edited: August 6, 2009

Hi andycal,

Yes, this is certainly possible! I did this by adding a "category" field to my Products section. I set it to Field Type = "List", Display As = "pulldown (multi value)", List Options = "Get options from database (advanced)", Section Tablename = "category", Use this field for option values = "num", Use this field for option labels = "breadcrumb".

Then, in my category detail Viewer, I got a list of products which belong to the selected category with a where clause:

list($productsRecords, $productsMetaData) = getRecords(array(
'tableName' => 'products',
'where' => "category LIKE '%\t{$categoryRecord['num']}\t%'",
));


Is this what you were after? Please let me know if you have any questions!

EDIT: changed to use simpler LIKE \t where clause instead of REGEXP [[:<:]]
All the best,
Chris

Re: [chris] Multiple Categories

By andycal - August 6, 2009

Thanks Chris, I'll go give it a try...