sub_template("menu.tpl", "menu"); $page->assign("shop_link", "menu_selected"); $headers .= ''; $page->assign("headers", $headers); $count = 0; function get_parent($categoryID) { global $count; $query = mysql_query("select parentID from shop_categories where categoryID = ".$categoryID.";"); $result = mysql_fetch_array($query); if($count>5) { return 0; } $count++; $query = mysql_query("select categoryID, name from shop_categories where categoryID = ".$result["parentID"].";"); if(@mysql_num_rows($query)==0) { return 0; } $result = mysql_fetch_array($query); return array("name" => $result["name"], "categoryID" => $result["categoryID"]); } function get_brand($brandID) { $query = mysql_query("select name from shop_brands where brandID = ".intval($brandID).";"); $result = mysql_fetch_array($query); return $result['name']; } $query = mysql_query("select name from shop_categories where categoryID = ".mysql_real_escape_string($_GET["catID"]).";"); $result = mysql_fetch_array($query); $breadcrumbs = array(array("name" => $result["name"], "link" => '')); $bc_categoryID = $_GET["catID"]; while($parent = get_parent($bc_categoryID)) { array_unshift($breadcrumbs, array("name" => $parent["name"], "link" => "/shop/category/".$parent["categoryID"].'/'.urlencode($parent["name"]).'/')); $bc_categoryID = $parent["categoryID"]; } array_unshift($breadcrumbs, array("name" => 'Shop', "link" => '/shop/')); $page->assign("title", $result["name"]." - Camping & Campsites Shop "); $page->assign("meta_description", "Buy ".$result["name"]); $content .= '

'.$result["name"].'




'; $page->add_breadcrumbs($breadcrumbs); $query = mysql_query("select * from shop_categories where parentID = ".$_GET["catID"].";"); while($result = mysql_fetch_array($query)) { $cat = new category($result["categoryID"]); $content .= $cat->display(); //$content .= ''.$result["name"].'
'; } $product_count = 0; $query = mysql_query("select productID from shop_products where categoryID = ".mysql_real_escape_string($_GET["catID"]).";"); while($result = mysql_fetch_array($query)) { $product_count++; $product = new product($result["productID"]); $content .= $product->ft_product_list(); if(($product_count%4)==0) { $content .= '

'; } } $content .= '
'; $content .= '

'; //$control = new tf_control(); //$content .= $control->display(); $page->assign("content", $content); $page->assign("rel_path", '/'); $page->display(); ?>