session_start();
require_once("../includes/headers.php");
require_once("../classes/shop_category.php");
require_once("../classes/shop_product.php");
require_once("../classes/shop_brand.php");
//check validity
if(!$_GET["catID"]) {
header("Location: ./");
exit;
}
else {
$query = mysql_query("select count(*) from shop_categories where categoryID = ".mysql_real_escape_string($_GET["catID"]).";");
if(mysql_num_rows($query)==0) {
header("Location: ./");
exit;
}
/*
$query = mysql_query("select count(*) from tf_shop where categoryID = ".mysql_real_escape_string($_GET["catID"])." and valid = 1;");
if(mysql_num_rows($query)==0) {
header("Location: ./");
exit;
}
*/
}
$page = new page("main.tpl");
$page->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 .= '