SOLVED thanks to this post -
http://forum.x-cart.com/showthread.php?p=320214#post320214
Here's how I did it:
In subcategories.tpl:
HTML Code:
{include file="customer/main/subcategories_dropdown.tpl"}
In subcategories_dropdown.tpl:
HTML Code:
{php}
$t = $this->get_template_vars('cat');
$result=mysql_query("select * from xcart_categories where categoryid=$t");
while($row=mysql_fetch_array($result))
{
$cid=$row['categoryid'];
$pid=$row['parentid'];
$cat=$row['category'];
}
{/php}
<select name="mySelect" class="gender-select" onchange="if(this.options[this.selectedIndex].value != '')window.top.location.href=this.options[this.selectedIndex].value">
<option value="Select A Gender">mens/womens/youth</option>
{php}
if($pid==0){
$res=mysql_query("select * from xcart_categories where parentid=$t");
while($row1=mysql_fetch_array($res))
{
$cat12=$row1['category'];
$cid12=$row1['categoryid'];
{/php}
<option value="home.php?cat={php}echo $cid12; {/php}">{php}echo $cat12;{/php}</option>
{php}
}
}else {
$res=mysql_query("select * from xcart_categories where parentid=$pid");
while($row1=mysql_fetch_array($res))
{
$cat12=$row1['category'];
$cid12=$row1['categoryid'];
{/php}
<option value="home.php?cat={php}echo $cid12; {/php}">{php}echo $cat12;{/php}</option>
{php}
}
}
{/php}
</select>
Works perfectly!