Search for an item number in the S-Mart database script

greenspun.com : LUSENET : S-Mart Shopping Cart : One Thread

Need to search for an item ID number?

Try using this script.

On hyperlink searches, the http:// is as follows:

http://www.yourdomainname.com/cgi-bin/S-Mart.cgi?command=listitems&type=id&pos=366

Insert this scripting into the top of the S-Mart script where it identifies the type of searches to be performed in the sub gen_page routine.

Hope this helps someone....!!

################################ if ($type eq 'id') { my($max) = $pos; if ($max > $SIZE) { $max = $SIZE; } for ($i=($pos-1);$i<$max;$i++) { $_=$LINES[$i]; ($itemid, $name, $price, $descrip, $image, $weight, $group, ) = split(/\|/,$_); &print_item; } print "1 Item Found on 1 Page\n"; } #################################

-- William Kolln (wkolln@cia.com.au), September 22, 1998

Answers

Hi William,

I have been trying to get your amendment to work but am a little confused as to how it's actually meant to function. Inserting the newlines into the scripts, i just get the headere, footer and "1 item Found on Page 1" come up.

I actually want to use it to perform a slightly differnt search, so was wondering which part of trhe script specifies that it is the id field that is searched.

I also tried just adding a print table line afterward but to no effect.

Can you help at all? Thanks

Rufus

-- Rufus Biggs (rufus.biggs@themcorporation.com), July 13, 2000.


Moderation questions? read the FAQ