Thank you for the mod, but I can't seem to get it working. Here is the complete code that I currently have for categories.tpl (including your mod):
And here is the code I have currently for categories.php (including your mod). This was found in htdocs/admin. There wasn't a categories.php in the customer directory so I hope I modified the right one.
Code:
#
# $Id: categories.php,v 1.18.2.3 2004/03/09 09:13:26 svowl Exp $
#
require "./auth.php";
require $xcart_dir."/include/security.php";
require $xcart_dir."/include/categories.php";
if (empty($mode)) $mode = "";
#
# Counts products and subcategories
#
if (is_array(@$subcategories)) {
$smarty->assign("subcategories",$subcategories);
}
#
# Ajust category_location array
#
if (is_array(@$category_location)) {
reset($category_location);
while(list($key,$cat_loc) = each($category_location))
$category_location[$key][1] = str_replace("home.php","categories.php",$category_location[$key][1]);
if(!empty($current_category)) $location = $category_location;
}
# BCSE Begin
if(empty($subcategories))
{
$pos=strpos($current_category["category"],"/");
while(!$pos===false)
{
$previous_pos=$pos;
$pos=strpos($current_category["category"],"/",$pos+1);
}
$parent = substr($current_category["category"],0,($previous_pos+$pos));
if (!empty($parent))
$cur_dir_len = strlen($parent);
foreach($all_categories as $all_category)
{
$category=$all_category["category"];
if(!strstr($category,"/")) {
$categories[]=$all_category;
if(empty($parent)) {
$super_subcategories[]=$all_category;
}
}
if(!empty($parent) and substr($category,0,$cur_dir_len+1) == $parent."/" and $category!=$parent)
{
if(!strstr(substr($category,$cur_dir_len+1),"/"))
{
$all_category["category"]=ereg_replace("^.*/","",$all_category["category"]);
$super_subcategories[]=$all_category;
}
}
}
if(!empty($super_subcategories))
{
$smarty->assign("super_subcategory",$super_subcategories);
}
}
# BCSE End
# FEATURED PRODUCTS
$f_cat = (empty ($cat) ? "0" : $cat);
if ($REQUEST_METHOD=="POST") {
while(list($key,$val)=each($HTTP_POST_VARS)) {
if (strstr($key,"-")) {
list($field,$productid)=split("-",$key);
if ($field=="avail")
$val="Y";
db_query("update $sql_tbl[featured_products] set avail='N', $field='$val' where productid='$productid' AND categoryid='$f_cat'");
}
}
if ($newproductid!="") {
$newavail=($newavail=="on" ? "Y" : "N");
if ($neworder=="") {
$maxorder = array_pop(func_query_first("select max(product_order) from $sql_tbl[featured_products] WHERE categoryid='$f_cat'"));
$neworder=$maxorder+1;
}
if (func_query_first("select productid from $sql_tbl[products] where productid='$newproductid'") and array_pop(func_query_first("SELECT COUNT(*) FROM $sql_tbl[featured_products] WHERE productid='$newproductid' AND categoryid='$f_cat'")) == 0)
db_query("insert into $sql_tbl[featured_products] (productid, product_order, avail, categoryid) values ('$newproductid','$neworder','$newavail', '$f_cat')");
}
func_header_location("categories.php?cat=$cat");
}
if ($mode == "delete") {
db_query ("DELETE FROM $sql_tbl[featured_products] WHERE productid='$productid' AND categoryid='$f_cat'");
func_header_location("categories.php?cat=$cat");
}
$products = func_query ("SELECT $sql_tbl[featured_products].productid, $sql_tbl[products].product, $sql_tbl[featured_products].product_order, $sql_tbl[featured_products].avail from $sql_tbl[featured_products], $sql_tbl[products] where $sql_tbl[featured_products].productid=$sql_tbl[products].productid AND $sql_tbl[featured_products].categoryid='$f_cat' order by $sql_tbl[featured_products].product_order");
$smarty->assign ("products", $products);
$smarty->assign ("f_cat", $f_cat);
$smarty->assign("location",@$location);
$smarty->assign("main","categories");
@include $xcart_dir."/modules/gold_display.php";
$smarty->display("admin/home.tpl");
?>