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");
$page = new page("main.tpl");
$page->sub_template("menu.tpl", "menu");
$page->assign("shop_link", "menu_selected");
//do the breadcrumbs
$count = 0;
function get_parent($catID) {
global $count;
$query = mysql_query("select parentID from shop_categories where categoryID = ".$catID.";");
$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"]);
}
$query = mysql_query("select categoryID, name from shop_products where productID = '".$_GET["productID"]."';");
$result = mysql_fetch_array($query);
$breadcrumbs = array(array("name" => $result["name"], "link" => ''));
$page->assign("title", $result["name"]." - Camping & Campsites Shop");
$page->assign("meta_description", "View information on ".$result["name"]." or buy ".$result["name"]);
$query = mysql_query("select name, categoryID from shop_categories where categoryID = ".$result["categoryID"].";");
$result = mysql_fetch_array($query);
array_unshift($breadcrumbs, array("name" => $result["name"], "link" => '/shop/category/'.$result["categoryID"].'/'.urlencode($result["name"]).'/'));
$bc_catID = $result["categoryID"];
while($parent = get_parent($bc_catID)) {
array_unshift($breadcrumbs, array("name" => $parent["name"], "link" => '/shop/category/'.$parent["categoryID"].'/'.urlencode($parent["name"]).'/'));
$bc_catID = $parent["categoryID"];
}
array_unshift($breadcrumbs, array("name" => 'Shop', "link" => '/shop/'));
$page->add_breadcrumbs($breadcrumbs);
$headers .= '';
$page->assign("headers", $headers);
$product = new product($_GET["productID"]);
$content .= $product->ft_product_detail();
$content .= '
';
$content .= '
';
//$control = new tf_control();
//$content .= $control->display();
$page->assign("content", $content);
$page->assign("rel_path", '/');
$page->display();
?>