hi everyone i was hoping someone could give me a quick hand.
i use zen cart and im trying to add a double drop down menu to a sidebox. but the categories and sub cats are not populating. the drop down works fine on my computer i can choose the cat and the sub cats will open, but once uploaded to my site it doesn't work. this is how this drop down works when you click on the categories it opens the sub cats for that category. and when you click on a sub cat it will bring you to that page. now i noticed in the php code below it says
<FORM name="drop_list" action="yourpage.php" method="POST" >
what would i put for the action="yourpage.php" since i want the page to change for each subcat?
maybe im going about this all wrong.
here is all the code.
This is the actuall sidebox code for the page
PHP Code:
<?php
//
// Blank Sidebox Mod
// includes/templates/templates_default/sideboxes/tpl_blank_sidebox.php
//
// --------------------------------------------------
// http://www.MommaMuse.com mod Zen-Cart - by Judi Cox
// --------------------------------------------------
// zen-cart Open Source E-commerce
// Copyright (c) 2003-2006 The zen-cart developers
// http://www.zen-cart.com/index.php
// Portions Copyright (c) 2003 osCommerce
// --------------------------------------------------
// This source file is subject to version 2.0 of the GPL license,
// that is bundled with this package in the file LICENSE, and is
// available through the world-wide-web at the following url:
// http://www.zen-cart.com/license/2_0.txt.
// If you did not receive a copy of the zen-cart license and are unable
// to obtain it through the world-wide-web, please send a note to
// license@zen-cart.com so we can mail you a copy immediately.
// --------------------------------------------------
//
// $Id: tpl_blank_sidebox.php,v 1.0 6/24/2006
// Original modification by Carter Harris charris@technettn.net based on the tpl_featured.php file
// Additionally modified by Judi Cox http://www.mommamuse.com
$content = '';
$content .= '<div id="' . str_replace('_', '-', $box_id . 'Content') . '" class="sideBoxContent">';
$content .= '
<html>
<head>
<title>Ailments List</title>
<script language="javascript" src="http://www.tonoend.com/list.js"></script>
</head>
<body bgcolor="#ffffff" text="#000000" link="#0000ff" vlink="#800080" alink="#ff0000" onload="fillCategory();">
<FORM name="drop_list" action="yourpage.php" method="POST" >
<SELECT NAME="Category" onChange="SelectSubCat();" >
<Option value="">Ailment</option>
</SELECT> <br>
<SELECT id="SubCat" NAME="SubCat" onchange="location.href=this.value">
<Option value="">Cure</option>
</SELECT>
</form>
</body>
</html>
';
$content .= '</div>';
?>
and this is the js file it calls
Code:
function fillCategory(){
// this function is used to fill the category list on load
addOption(document.drop_list.Category, "Abdominal","Abdominal", "");
addOption(document.drop_list.Category, "Abrasions","Abrasions", "");
addOption(document.drop_list.Category, "Abscess","Abscess", "");
addOption(document.drop_list.Category, "Acidity","Acidity", "");
addOption(document.drop_list.Category, "Acne Remedy","Acne Remedy", "");
addOption(document.drop_list.Category, "Yeast Infection","Yeast Infection", "");
}
function SelectSubCat(){
// ON selection of category this function will work
removeAllOptions(document.drop_list.SubCat);
addOption(document.drop_list.SubCat, "", "SubCat", "");
if(document.drop_list.Category.value == 'Fruits'){
addOption(document.drop_list.SubCat,"http://www.gothenaturalway.com", "Mango");
addOption(document.drop_list.SubCat,"Banana", "Banana");
addOption(document.drop_list.SubCat,"Orange", "Orange");
}
if(document.drop_list.Category.value == 'Games'){
addOption(document.drop_list.SubCat,"Cricket", "Cricket");
addOption(document.drop_list.SubCat,"Football", "Football");
addOption(document.drop_list.SubCat,"Polo", "Polo", "");
}
if(document.drop_list.Category.value == 'Scripts'){
addOption(document.drop_list.SubCat,"PHP", "PHP");
addOption(document.drop_list.SubCat,"ASP", "ASP");
addOption(document.drop_list.SubCat,"Perl", "Perl");
}
}
//////////////////
function removeAllOptions(selectbox)
{
var i;
for(i=selectbox.options.length-1;i>=0;i--)
{
//selectbox.options.remove(i);
selectbox.remove(i);
}
}
function addOption(selectbox, value, text )
{
var optn = document.createElement("OPTION");
optn.text = text;
optn.value = value;
selectbox.options.add(optn);
}
i removed alot of the
categories as there were so many and i didnt want to take up alot of space. also the subcats are not done and do not match the cats yet. but it should all work just the same.
i uploaded the list.js file right to the main directory
here is the page where i have it so you can see what is happeneing.
http://www.gothenaturalway.com
thanks so much in advance for any help anyone can offer.
Cara