[ic] OR search on subcategories

Mike Heins mikeh@minivend.com
Sat, 2 Dec 2000 00:30:13 -0500


Quoting John Nealy (jnealy@symetrek.com):
> I want to do an OR search of this sort:
> An accessory item may have a subcategory of All if it is common to all
> product lines, or a specific name (e.g. Motorola) if it is for only a
> specific line.  I am trying to code the complex search so that when I
> click a Motorola link on the page I do a search for items in the
> accessories category whose subcategory is either All or Specific.  I
> have played with combinations of the os=yes tag, but I'm not getting
> things quite right.
> I never used Minivend so I'm just now learning the tags.

Two ways to do it:

1. Using SQL, formulate a SQL query and use the [query] tag.

  [query list=1
    sql="select * from products
	 where subcategory = 'All'
	 or subcategory like 'Motorola'
	"] [sql-code] [/query]

2. Use Minivend search terms in the text search.

[loop search="
	fi=products.txt
	co=yes
	sf=subcategory
	se=All
	op=eq

	sf=subcategory
	se=Motorola
	op=rm

	rf=*
	"] [loop-code] [/loop]

In fact, if you do:

[loop search="
    sq=select * from products where subcategory = 'All' or subcategory like 'Motorola'
	"] [/loop-code] [/loop]

it will translate exactly to the above.

Currently, the DbSearch has some bugs that are in the 4.6.0 release but
are resolved in CVS. They would prevent the above from working with st=db.

-- 
Akopia, Inc., 131 Willow Lane, Floor 2, Oxford, OH  45056
phone +1.513.523.7621 fax 7501 <heins@akopia.com>

Light travels faster than sound. This is why some people appear bright
until you hear them speak. -- unknown