sql_query("SELECT name,id FROM categories WHERE id=".$_GET["cat_id"]); $catname=$db->fetched_array(); $db->sql_query("SELECT * FROM products WHERE parent_level=1 AND parent_id=".$_GET["cat_id"]." ORDER BY position"); $products=$db->fetched_array(); if($products===false) { $db->sql_query("SELECT id FROM subcats WHERE cat_id=".$_GET["cat_id"]); $sub_id=$db->fetch(); header("Location: product.html?sub_id=".$sub_id['id']); exit(); } } elseif(isset($_GET["sub_id"])) { $db->sql_query("SELECT name,id,cat_id FROM subcats WHERE id=".$_GET["sub_id"]); $subname=$db->fetched_array(); $_GET["cat_id"]=$subname[0]['cat_id']; $db->sql_query("SELECT name,id FROM categories WHERE id=".$_GET["cat_id"]); $catname=$db->fetched_array(); $db->sql_query("SELECT name,id FROM subsubcats WHERE sub_id=".$_GET["sub_id"]." ORDER BY position LIMIT 1"); $subsubname=$db->fetched_array(); $db->sql_query("SELECT * FROM products WHERE parent_level=2 AND parent_id=".$_GET["sub_id"]." ORDER BY position"); $products=$db->fetched_array(); if(($products===false)&&($subsubname!==false)) { header("Location: product.html?subsub_id=".$subsubname[0]['id']); exit(); }else unset($subsubname); } elseif(isset($_GET["subsub_id"]) ) { $db->sql_query("SELECT name,sub_id,id FROM subsubcats WHERE id=".$_GET["subsub_id"]); $subsubname=$db->fetched_array(); /* $db->sql_query("SELECT * FROM products WHERE cat_id=".$_GET["cat_id"]." and sub_id=".$_GET["sub_id"]." and subsub_id=".$_GET["subsub_id"]." ORDER BY position"); $products=$db->fetched_array();*/ $_GET["sub_id"]=$subsubname[0]['sub_id']; $db->sql_query("SELECT name,cat_id,id FROM subcats WHERE id=".$_GET["sub_id"]); $subname=$db->fetched_array(); $_GET["cat_id"]=$subname[0]['cat_id']; $db->sql_query("SELECT name,id FROM categories WHERE id=".$_GET["cat_id"]); $catname=$db->fetched_array(); $db->sql_query("SELECT * FROM products WHERE parent_level=3 AND parent_id=".$_GET["subsub_id"]." ORDER BY position"); $products=$db->fetched_array(); } if(isset($_POST["textsearch"])){ $db->sql_query("SELECT p.* FROM products AS p LEFT JOIN categories AS c ON p.cat_id = c.id LEFT JOIN subcats AS sc ON p.sub_id = sc.id LEFT JOIN subsubcats AS ssc ON p.subsub_id = ssc.id WHERE p.name LIKE '%".$_POST["textsearch"]."%' OR c.name LIKE '%".$_POST["textsearch"]."%' OR sc.name LIKE '%".$_POST["textsearch"]."%' OR ssc.name LIKE '%".$_POST["textsearch"]."%'"); //$sql= "SELECT DISTINCT * FROM (". // "SELECT p.* FROM products AS p LEFT JOIN categories ON p.parent_id=categories.id WHERE p.parent_level=1 AND categories.name LIKE '%".$_POST["textsearch"]."%' ". //"UNION ". // "SELECT p.* FROM products AS p LEFT JOIN subcats ON p.parent_id=subcats.id WHERE p.parent_level=2 AND subcats.name LIKE '%".$_POST["textsearch"]."%' ". // "UNION " . // "SELECT p.* FROM products AS p LEFT JOIN subsubcats ON p.parent_id=subsubcats.id WHERE p.parent_level=3 AND subsubcats.name LIKE '%".$_POST["textsearch"]."%' " . // "UNION ". // "SELECT * FROM products WHERE products.name LIKE '%".$_POST["textsearch"]."%' " . // ") AS tbl"; // $db->sql_query($sql); $products=$db->fetched_array(); } //$smarty->clear_all_assign(); //$smarty->assign("picpath",IMAGE_PATH); //$smarty->assign("subsubcats",subsubname); //$smarty->assign("subsubcats",subsubname); //$smarty->assign("products",$products); //$smarty->display( TPL_NAME .".html"); ?> T&T Industrial Supplies Ltd.
51 Roysun Road, Unit 10 Woodbridge, Ontario, L4L 8P9
Tel: 905.851.4488
Fax: 905.851.4688
Search:

Product >" class="white"> > " class="white"> > " class="white">
Search >
sql_query("SELECT * FROM `categories` ORDER BY position"); $cats=$db->fetched_array(); if(!isset($_GET["cat_id"])) $_GET["cat_id"] = $cats[0]["id"]; ?>
sql_query("SELECT * FROM `subcats` WHERE cat_id=".$c["id"]." ORDER BY position"); $subcats=$db->fetched_array(); if($subcats!==false){ // if(!isset($_GET["sub_id"])) $_GET["sub_id"] = $subcats[0]["id"]; foreach($subcats as $s){ if($s["id"] == @$_GET["sub_id"]){ ?> sql_query("SELECT * FROM `subsubcats` WHERE sub_id=".$s["id"]." ORDER BY position"); $subsubcats=$db->fetched_array(); if($subsubcats!==false){ //if(!isset($_GET["subsub_id"])) $_GET["subsub_id"] = $subsubcats[0]["id"]; foreach($subsubcats as $ss){ if(@$_GET["subsub_id"] == $ss["id"]){ ?> " class="sssubmenua"> " class="sssubmenu"> " class="ssubmenu">
sql_query("SELECT * FROM `subcats` WHERE cat_id=".$c["id"]." ORDER BY position"); $subcats=$db->fetched_array(); ?> " class="submenu" onMouseOver="activate();" onMouseOut="deactivate();" >
sql_query("SELECT * FROM rangefiles WHERE pid=".$products[$i]["id"]); //$db->sql_query("SELECT * FROM products WHERE id=".$products[$i]["id"]); // $db->sql_query("SELECT * FROM products WHERE id=$id); //$images=$db->fetched_array(); if(($i % 2 == 0)&&($i!=0)&&($i!=(count($products)-0))){ //if(($i % 2 == 0)&&($i!=0)&&($i!=(count($products)-1))){ //if($i % 2 == 0){ ?>
" style="background-repeat: no-repeat; background-position: center;">">


" class="borange">Read More »
no products yet...
 
Copyright 2006 T&T Industrial Supplies ltd. Website Design by ITW Consulting Corp. Developed by ITW