I got it!!! Funky, I was looking at the advanced_search.tpl code you had and decided to try using $allcategories for the second level categories.
Machnhed1, I had replaced the whole drop down code with the $allcategories code that you had me put in before instead of only the 2nd level part. If I messed up there and was supposed to do it for just the 2nd level section, I apologize profusely for wasting your time.
Thank you both for helping me work this out!!!!!!!
So, for those who have made it this far through this thread and are using 3.3.x , here is what you need to do:
Store/include/categories.php
Before the lines for # Assign Smarty variables, add this code:
Quote:
#
# Mod: Get all main categories and level 1 subcatgories and store them in an array
#
$categories_data1 = func_query("select * from $sql_tbl[categories] where category NOT LIKE '%/%' and avail='Y' group by $sql_tbl[categories].categoryid order by order_by");
foreach ($categories_data1 as $key=>$value) {
$categories_data2[$key][] = func_query("select $sql_tbl[categories].*, SUBSTRING_INDEX($sql_tbl[categories].category, '\/', -1) as category_name from $sql_tbl[categories] where category LIKE '".$value[category]."/%' and category NOT LIKE '".$value[category]."/%/%' and avail='Y' group by $sql_tbl[categories].categoryid order by order_by");
}
|
at the end of the file, add these lines:
Quote:
$smarty->assign("categories_level_1",$categories_data1);
$smarty->assign("categories_level_2",$categories_data2);
|
/store/skin1/customer/main/advanced_search.tpl
replace <select name="in_category">
<option value="">All</option>
{section name=cat_num loop=$categories}
<option value="{ $categories[cat_num].categoryid}" {if $smarty.get.in_category eq $categories[cat_num].categoryid or $cat eq $categories[cat_num].categoryid}selected{/if}>{$categories[cat_num].category|escape}</option>
{/section}
</select>
with this:
Quote:
<select name="in_category">
<option value="">All</option>
{section name=cat_num loop=$categories_level_1}
<option value="{ $categories_level_1[cat_num].categoryid}" {if $smarty.get.in_category eq $categories_level_1[cat_num].categoryid or $cat eq $categories_level_1[cat_num].categoryid}selected{/if}>
{$categories_level_1[cat_num].category|escape}
</option>
{section name=cat_num1 loop=$allcategories}
{if $categories_level_2[cat_num][0][cat_num1].categoryid ne ""}<option value="{ $categories_level_2[cat_num][0][cat_num1].categoryid}" {if $smarty.get.in_category eq $categories_level_2[cat_num][0][cat_num1].categoryid or $cat eq $categories_level_2[cat_num][0][cat_num1].categoryid}selected{/if}>
{$categories_level_2[cat_num][0][cat_num1].category_name|escape}
</option>{/if}
{/section}
{/section}
</select>
|