Welcome, Guest ( Customer Panel | Login )




 All Forums
 VPCart Forum
 Customization
 Help with product down..
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

CierraRod
Starting Member

USA
18 Posts

Posted - September 27 2006 :  08:25:19  Show Profile  Visit CierraRod's Homepage  Reply with Quote
I was wondering if someone could help me a bit with this coding function. I have it setup to generate a dynamic list of school names for our products. The problem is, that for like named schools for example, Virginia, Virginia Tech or West Virginia. If you choose any of those it returns all products with "Virginia" in its name.

Here is the code:

Sub CatSubSchool
dim dbc, rs, sql
shopopendatabaseP dbc
%>
<form name='catnavForm'>
<select name="menu" onChange = "self.location = document.catnavForm.menu[document.catnavForm.menu.selectedIndex].value;" style="color: #000000; font-size: 8 pt; font-family: Verdana; font-weight: normal;" >
<option>Select School</option>
<%
sql="SELECT distinct pother1 from products where pother3='College'"
set rs=dbc.execute(sql)
Do While Not rs.EOF 
%>

<OPTION style="width: 100px;" VALUE="shopquery.asp?pother1=<%=rs("pother1") %>"><%= rs("pother1") %></option>
<%
rs.MoveNext
Loop 
response.write "</SELECT></form>"
Closerecordset rs
shopclosedatabase dbc
end sub



Thanks in advance.

support
Administrator

4679 Posts

Posted - October 04 2006 :  16:39:21  Show Profile  Visit support's Homepage  Reply with Quote
Hi,

Instead of calling shopquery.asp, you may want to look at calling shopsearch.asp

shopsearch.asp allows you to pass the querystring option "exact" which will search only for exact matches:

eg: shopsearch.asp?search=yes&exact=Chrome%20Bed

In the demo products provided with VPASP, this query searches for the exact phrase "Chrome Bed".

Hope this helps.

Regards,
Michael
VPASP SUPPORT
Go to Top of Page

CierraRod
Starting Member

USA
18 Posts

Posted - October 12 2006 :  09:23:39  Show Profile  Visit CierraRod's Homepage  Reply with Quote
I've tried pluging in the code you supplied, to use the shopsearch.asp, but still does not work. And what's even weireder is, if I go to the shopsearch.asp page directly and put in a word for an exact match, I get the same results. So, I don't think the problem is with the code itself. Is there a setting in the administration back-end that would affect searches? Because I haven't touched any of that code. So, I'm a little perplexed at why this will not work.

Here is the code I currently have:

Sub CatSubSchool
dim dbc, rs, sql
shopopendatabaseP dbc
%>
<form name='catnavForm'>
<select name="menu" onChange = "self.location = document.catnavForm.menu[document.catnavForm.menu.selectedIndex].value;" style="color: #000000; font-size: 8 pt; font-family: Verdana; font-weight: normal;" >
<option>Select School</option>
<%
sql="SELECT distinct pother1 from products where pother3='College'"
set rs=dbc.execute(sql)

Do While Not rs.EOF 
%>

<OPTION style="width: 100px;" VALUE="shopsearch.asp?search=yes&exact=<%=trim(rs("pother1"))%>"><%= rs("pother1") %></option>
<%
rs.MoveNext
Loop 
response.write "</SELECT></form>"
Closerecordset rs
shopclosedatabase dbc
end sub


Edit: I was digging through some other posts, and in one someone from support said, if you edit the code starting at line 734 in the shoproductscreatesql.asp file, that you could get an exact match. Here is that code:

if exactString <> ""  then
  SQL = SQL & whereok 
  SQL = SQL & "("
  Whereok="" 
  exactString=cleanchars(exactString)
    For j=0 to fieldcount
      If j> 0 then
         SQL = SQL & " OR "
      else
         'SQL=SQL & " ( "
      end if  
      
      SQL = SQL & "p." & searchfields(j) & " LIKE '%" & exactString & "%' "
    next
  SQL = SQL & ")"
  whereok=" AND "
end if


However, when I tried to change it I get no results. I always thought that if you used a LIKE statement it would act just like the results I'm currently getting. I.e. It will return anything containing that exactstring. Could someone please help me?

Edited by - CierraRod on October 12 2006 10:34:17
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Snitz Forums 2000
0 Item(s)
$0.00