Welcome, Guest ( Customer Panel | Login )




 All Forums
 VPCart Forum
 Customization
 search by manufacturer down
 New Topic  Reply to Topic
 Printer Friendly
Next Page
Author Previous Topic Topic Next Topic
Page: of 2

Questar
Starting Member

Canada
26 Posts

Posted - February 07 2007 :  07:37:49  Show Profile  Visit Questar's Homepage  Reply with Quote
I'm wondering if anyone is using a drop down list to allow customers to search by manufacturer, that they would share? (Compatible with version 6) I'm looking to use this in addition to the regular category box. I'd like to list about 8 manufacturers/suppliers in a drop-down list. I thought I had come across this is an older posting, but cannot locate it now. Also, it was a couple of years old and may not be compatible with version 6. Thanks for any help.

elammers
VP-CART Super User

USA
256 Posts

Posted - February 07 2007 :  08:18:55  Show Profile  Visit elammers's Homepage  Reply with Quote
We did something very similar. I was in a rush and couldn't get the dynamic code to work so here's the static. Client wanted a dropdown that listed all products by catalog section. Each section of the catalog started with a unique number and was the page number (100, 108, 200, 204, etc) and was stored in POTHER3. So we just had to use the query code against the first character in POTHER3.

<option value="">Select a Section</option>
<option value="shopquery.asp?pother3=1&queryprefix=No">A-1 Yard & Garden</option>
<option value="shopquery.asp?pother3=2&queryprefix=No">B-2 Seeds</option>

So if you have the MFG field populated, I imagine you could just alter the code above and probably drop the queryprefix part. If you have too many to handcode, I look forward to someone replying with a dynamic solution.


Regards,

Eric in Maine
Go to Top of Page

rustytec
VP-CART New User

Australia
113 Posts

Posted - February 09 2007 :  00:14:57  Show Profile  Reply with Quote
Hi Questar,

I'm not sure if this is what you are looking for, but it creates a supplier drop down box, based on distinct mfg in the products table.


 <!-- get mfg from products-->
		 
		 <%
			Dim Mfgset,sqlstr,myconn,strMfgline,rs
			ShopOpenDatabaseP myconn
			Set rs = myconn.Execute("SELECT distinct ucase(mfg)as mfg from products where mfg > ' ' ")  'ucase for access
			%> </font></font> <font size="1" face="Verdana, Arial, Helvetica, sans-serif"> 
			<form name="form1">
			<select name="menu1" onChange="MM_jumpMenu('parent',this,0)" style="font-size:8pt">
			<OPTION VALUE="Select Manufacturer" selected>Select Brand</option>
			<% Do While Not rs.EOF
				if rs("mfg")<>"" then %>
					<OPTION VALUE="shopquery.asp?mfg=<%= rs("mfg") %>"><%= rs("mfg") %></option>
				<% end if
				rs.MoveNext %>
			<% Loop %>
			</SELECT>
			</form>
			</font> 
			<%rs.Close
			conn.Close
			Set rs = Nothing
			Set conn = Nothing
		%>


It works well for me.

Best of luck.

Russ


rustytec
Go to Top of Page

Mark Priest
VP-CART Expert

United Kingdom
580 Posts

Posted - February 13 2007 :  19:20:40  Show Profile  Reply with Quote
Hi Russ,

Where should i add your code so I can call it the header or footer template.

Regards,

Mark
http://www.fireworkcrazy.com
Go to Top of Page

devshb
Senior Member

United Kingdom
1904 Posts

Posted - February 13 2007 :  19:37:58  Show Profile  Visit devshb's Homepage  Reply with Quote
if you only want to call/show it in one place, you'd simply paste russ' code straight into the relevant bit in shoppage_header.htm or shoppage_trailer.htm

if you wanted to call it from multiple places, then you'd wrap it inside a function and then call that function, eg...

add this to shop$db.asp at the bottom, before the last %> tag:


Sub ShowManufacturers
' All russ's code starts here:
Dim Mfgset,sqlstr,myconn,strMfgline,rs
ShopOpenDatabaseP myconn
Set rs = myconn.Execute("SELECT distinct ucase(mfg) as mfg from products where mfg is not null order by ucase(mfg)") 'ucase for access
%> </font></font> <font size="1" face="Verdana, Arial, Helvetica, sans-serif">
<form name="form1">
<select name="menu1" onChange="MM_jumpMenu('parent',this,0)" style="font-size:8pt">
<OPTION VALUE="Select Manufacturer" selected>Select Brand</option>
<% Do While Not rs.EOF
if rs("mfg")<>"" then %>
<OPTION VALUE="shopquery.asp?mfg=<%= rs("mfg") %>"><%= rs("mfg") %></option>
<% end if

rs.MoveNext %>
<% Loop %>
</SELECT>
</form>
</font>
<%rs.Close
conn.Close
Set rs = Nothing
Set conn = Nothing
' all russ's code ends here
End Sub



and then put this in your shoppage_header/trailer.htm file wherever you want to show it:


<% ShowManufacturers %>


(use "ucase" for access, or "upper" for mysql/sqlserver in the above sql)

Simon Barnaby
Developer
[email protected]
www.BigYellowZone.com
Web Design, Online Marketing and VPASP addons

Edited by - devshb on February 13 2007 19:44:04
Go to Top of Page

Mark Priest
VP-CART Expert

United Kingdom
580 Posts

Posted - February 14 2007 :  12:24:53  Show Profile  Reply with Quote
mmm.

OK, well the code appears to work, when i insert it into a template, howevever, the page stops generating HTML right after the drop down box?

Is there some javascript missing somewhere (MM_jumpMenu)?


Regards,

Mark
http://www.fireworkcrazy.com
Go to Top of Page

Mark Priest
VP-CART Expert

United Kingdom
580 Posts

Posted - February 14 2007 :  12:38:10  Show Profile  Reply with Quote
OK.

I've added the following javascript to get the menu to work, but the template is still refusing to publish anyhing after the tag in the browser.

<script type="text/JavaScript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}

function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_jumpMenuGo(selName,targ,restore){ //v3.0
var selObj = MM_findObj(selName); if (selObj) MM_jumpMenu(targ,selObj,restore);
}
//-->
</script>

Regards,

Mark
http://www.fireworkcrazy.com
Go to Top of Page

rustytec
VP-CART New User

Australia
113 Posts

Posted - February 14 2007 :  15:19:46  Show Profile  Reply with Quote
Hi Mark,

Yes, sorry left the js out it is in my header include. I use the following;

function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}


Which is in what you have noted.

I use the code in my left include, at the position where I wanted it and it works fine.

I've quickly tested it in the demo and it works fine. I added the js into the shoppageheader.htm file, created the function to call (see Simons' post) then placed the <% ShowManufacturers %> further down in shoppageheader.htm and got it showing in the left column after the top10 sellers.

I'm not sure where you are putting it.

This is the snippet from shoppageheader.htm:



<tr>
            <td><table width="100%"  border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td class=menuhdr>Brands</td>
              </tr>
              <tr>
                <td><table width="100%"  border="0" cellspacing="0" cellpadding="0" class="dashed">
                    <tr>
                      <td><% ShowManufacturers %></td>
					  
                    </tr>
                </table></td>
              </tr>
            </table></td>
          </tr>


Perhaps you can let me know where you are putting it exactly, I might be able to assist.

best of luck

regards

Russ

PS > Thanks Simon (devshb) for the enhancement note on making it a function wrapper.



rustytec
Go to Top of Page

Questar
Starting Member

Canada
26 Posts

Posted - February 20 2007 :  08:59:22  Show Profile  Visit Questar's Homepage  Reply with Quote
I'm still a little confused. I want the drop down to appear only in my shoppage_header, just above the "categories". Do I add Russ's js (below) in the <head> section, and the other html coding into the shoppage_header where I want it to appear? Anything else required? Thanks.

Go to Top of Page

rustytec
VP-CART New User

Australia
113 Posts

Posted - February 20 2007 :  20:43:24  Show Profile  Reply with Quote
quote:
Originally posted by Questar

I'm still a little confused. I want the drop down to appear only in my shoppage_header, just above the "categories". Do I add Russ's js (below) in the <head> section, and the other html coding into the shoppage_header where I want it to appear? Anything else required? Thanks.



Hi Questar,

Yes, do the following:

  • add the javascript into your <head> area

  • make the sub - Sub ShowManufacturers
    as noted by devshb

  • then that should enable you to put the - <td><% ShowManufacturers %></td>
    wherever you want it.



that works for me in the demo site, hopefulli it will for you too.

regards

Russ


rustytec
Go to Top of Page

Kidd
VP-CART Super User

Australia
373 Posts

Posted - February 20 2007 :  20:52:21  Show Profile  Reply with Quote
Questar, on your shoppage_header file locate

<!--END OF SEARCH BOX-->
<!--START OF CATEGORY BOX-->

place the code to call ShowManufacturers under <!--END OF SEARCH BOX--> line
Go to Top of Page

Questar
Starting Member

Canada
26 Posts

Posted - February 27 2007 :  12:23:26  Show Profile  Visit Questar's Homepage  Reply with Quote
I am still getting error messages with this. I'm sure it's something I'm doing wrong, but no idea what. I am not experienced with js and sql coding, so I really appreciate everyone's patience and help.

The "Brand" heading appears as well as the drop down box, but then the following error message and nothing displays on the screen after this:

Microsoft VBScript runtime error '800a01a8'

Object required: ''

/shopping/shop$db.asp, line 2674


I have added Russ's coding to call the function to my shoppage_header, right under the <!--END OF SEARCH BOX--> line, and have added the following to the <head> section:

function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}

I have copied & pasted Simon's code to shop$db.asp, at the bottom before the last %> tag, changing "ucase" to "upper" for mysql, as I believe was instructed. Below is my coding for the last section of shop$db.asp. " end function %> " was previously the last line, so I've literally added the new code before the "%>":

end function

Sub ShowManufacturers
' All russ's code starts here:
Dim Mfgset,sqlstr,myconn,strMfgline,rs
ShopOpenDatabaseP myconn
Set rs = myconn.Execute("SELECT distinct upper(mfg) as mfg from products where mfg is not null order by upper(mfg)") 'upper for mysql
%> </font></font> <font size="1" face="Verdana, Arial, Helvetica, sans-serif">
<form name="form1">
<select name="menu1" onChange="MM_jumpMenu('parent',this,0)" style="font-size:8pt">
<OPTION VALUE="Select Manufacturer" selected>Select Brand</option>
<% Do While Not rs.EOF
if rs("mfg")<>"" then %>
<OPTION VALUE="shopquery.asp?mfg=<%= rs("mfg") %>"><%= rs("mfg") %></option>
<% end if

rs.MoveNext %>
<% Loop %>
</SELECT>
</form>
</font>
<%rs.Close
conn.Close
Set rs = Nothing
Set conn = Nothing
' all russ's code ends here
End Sub
%>

Hopefully someone can easily determine my error from the error message, or the info I've included above. Thanks in advance.
Go to Top of Page

rustytec
VP-CART New User

Australia
113 Posts

Posted - February 28 2007 :  04:34:04  Show Profile  Reply with Quote
Hi Questar,

I'm sorry you are still having trouble.

Why not test each stage a piece at a time.

1. make sure the following is in place:
function MM_jumpMenu(targ,selObj,restore){ //v3.0
eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
if (restore) selObj.selectedIndex=0;
}

Ensure it is enveloped inside <script type="text/JavaScript"> and </script>.

2. remove the <% ShowManufacturers %>. and see if the page loads ok.

3. If it loads ok then try changing the SQL statement to exclude the upper........

SELECT distinct mfg as mfg from products order by mfg


see if you get a better response from that.

best of luck

Russ





rustytec
Go to Top of Page

Questar
Starting Member

Canada
26 Posts

Posted - February 28 2007 :  13:45:28  Show Profile  Visit Questar's Homepage  Reply with Quote
Thanks for your help, but unfortunately I am still getting the same error message. I've followed the steps you suggested and tried changing the SQL statement, but the same error message appears, referring to line 2674 which is " Set conn = Nothing "

I was really hoping it was something simple that I was doing wrong, like adding the SQL code in the wrong place.

We have made small changes to the site including add-ons, so perhaps that is the root of the problem. Also, I still have another database problem to fix (separate posting) and perhaps this drop down will work properly once the other issue has been resolved.

Thanks again. Really appreciate the help.

Go to Top of Page

rustytec
VP-CART New User

Australia
113 Posts

Posted - February 28 2007 :  15:00:25  Show Profile  Reply with Quote
Hi Questar,

I think I see your error. In the new sub "showmanufacturers" at the end when setting rs=nothing and myconn = nothing......

You have conn = nothing and conn is not defined in this sub, change it to myconn=nothing (a typo from my original post).

That should then be your problem, based on the error you are getting.

Russ


rustytec
Go to Top of Page

Questar
Starting Member

Canada
26 Posts

Posted - March 01 2007 :  17:55:12  Show Profile  Visit Questar's Homepage  Reply with Quote
Thanks! I changed "conn" to "myconn" in a couple of places and it works perfectly now.
Go to Top of Page
Page: of 2
Previous Topic Topic Next Topic  
Next Page
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
Snitz Forums 2000
0 Item(s)
$0.00