[Yams-discuss] Re: Search feature
Brought to you by:
modred
From: Garth S. <ga...@ap...> - 2000-03-15 13:45:30
|
On Wed, 15 Mar 2000, Gaelyne Gasson wrote: > Yes, I'm using an include for header and footer on the index page. These > work fine. I tried adding in the toplevel.pl?type=department include, but > this resulted in another "error processing this directive" from Apache. > > To further test, I have a cgi-bin perl script that displays random text > and is an include. I tried it on the shop page as both: > <!--#include virtual="blah" --> and <!--#exec cgi="blah"--> and it worked > OK both times. Feeling experimental, I changed the Yams include > statements to <!--#exec cgi=".."--> and had the "error processing this > directive" error from Apache. It was worth a try. > > > > Is it running as a cgi script or as an Apache::Registry script? > > cgi script. > > > Are you using the latest version of cart.pl? > > Yes. > > Pat asked me to try cart.pl from the command line and report the > results. Here it is - this is the result **AFTER** changing line 1893: > > ---------------------------- > [shop] # cart.pl > (offline mode: enter name=value pairs on standard input) > action=print_search > <FORM METHOD="POST" ACTION="/cgi-bin/commerce4/shop/cart.pl" ENCTYPE="application/x-www-form-urlencoded"> > <INPUT TYPE="text" NAME="search_terms" SIZE=15 MAXLENGTH=50><SELECT NAME="where"> > <OPTION VALUE="Name">Name > <OPTION VALUE="Description">Description > </SELECT> > <INPUT TYPE="submit" NAME=".submit"><INPUT TYPE="hidden" NAME="action" VALUE="search"><INPUT TYPE="hidden" NAME="session_id" VALUE="8O69g43o0cuU0lWfxnnNRgJp"></FORM>Wed Mar 15 23:12:10 > [shop] # > ---------------------------- > > Here's the log file result **AFTER** changing line 1893, and I've > included the toplevel.pl one for measure. This isn't an option that I > normally use though. > > [error] malformed header from script. Bad header=<FORM METHOD="POST" ACTION="/c: /cgi-bin/commerce4/shop/cart.pl > [error] unable to include "/cgi-bin/commerce4/shop/cart.pl?action=print_search" in parsed file /commerce/shop/index.html > toplevel.pl: Use of uninitialized value at (eval 14) line 27. > [error] malformed header from script. Bad header=<H2>Choose Department</H2><FOR: /cgi-bin/commerce4/shop/toplevel.pl > [error] unable to include "/cgi-bin/commerce4/shop/toplevel.pl?type=department" in parsed file /commerce/shop/index.html It looks like apache is expecting the header from the script. Do the includes that work print $CGI->header (or its equivalent)? On my system if I print out the $CGI->header in the includes, I get multiple headers left in the html page - your setup may need to print the header to allow the includes to added to file. > > > > As a short term solution, the following HTML code should create the > > desired form (with the updated path to the cart.pl script): > > > > <FORM METHOD="POST" ACTION="/registry/commerce/shop/cart.pl" > > ENCTYPE="application/x-www-form-urlencoded"> > > <INPUT TYPE="text" NAME="search_terms" SIZE=15 MAXLENGTH=50> > > <SELECT NAME="where"> > > <OPTION VALUE="Name">Name > > <OPTION VALUE="Description">Description > > </SELECT> > > <INPUT TYPE="hidden" NAME="action" VALUE="search"> > > <INPUT TYPE="submit"> > > </FORM> > > Thanks, Garth. This DOES work for the item name. Which description is it > using? I tried a couple of tests for the description using words that are > in the shop item descriptions but each time it didn't come up with a match > when it should have. Doh. This was not a good release for me. The table that is used for searching descriptions needs to be backfilled for existing products. The following script should take care of that. #!/usr/bin/perl -w # quick script to populate the product_description_search table use strict; use Yams::DBWrap; use Yams::YamsGlobals; my($DBH) = &dbconnect(\%config); my($sql, $sth); $sql = "SELECT sku, short_description, long_description, other_text FROM products"; my($sku, $short_description, $long_description, $other_text); $sth = &dbsql($DBH, $sql); while(($sku, $short_description, $long_description, $other_text) = $sth->fetchrow_array) { my($description) = lc($short_description) . "\n" . lc($long_description) . "\n" . lc($other_text); $description = $DBH->quote($description); my($q_sku) = $DBH->quote($sku); $sql = "INSERT INTO product_description_search VALUES($q_sku, $description)"; my($sth2) = &dbsql($DBH, $sql); $sth2->finish if($sth2); } $sth->finish if($sth); $DBH->disconnect; Garth > > > Cheers, > Gaelyne > > > |