Hi,
Although this is not a "Wheels" question (sorry about this), this is
where I get the best support :) I am trying to make a Catalog of
Products where there are "tags" attached to each one of the
products... now I would like to do the same
/products/[tag1]
Will filter all products tagged with [tag1]
/products/[tag1]/[tag2]
Will filter all products tagged with [tag1] AND [tag2], currently I
can get all products tagged with [tag1] OR [tag2].. any ideas how the
SQL would work for this? (I don't care if the ORM won't do)
My current code looks like this:
<cfset loc.tagsId = model("Tag").findAll(select="id", where="name =
'#humanize(params.tag1)#' OR name = '#humanize(params.tag2)#'")>
<!--- Find all the products for the given tags --->
<cfset products = model("Product").findAll(distinct=true,
select="products.*", where="tagId IN (#ValueList(
loc.tagsId.id)#)",
include="producttags", order="price DESC")>
Of course, if there is a better way :) show me the light hehe