prepare(); $config_path = "http://".$CONFIG["http_host"].$CONFIG["dir_path"]; $tpl->assignGlobal("config_path",$config_path); $txtsearch = $_REQUEST['txtsearch']; $catpd2 = intval($_REQUEST['catpd2']); $id_catpj = intval($_REQUEST['id_catpj']); $namsx = intval($_REQUEST['namsx']); $km = intval($_REQUEST['km']); $nhien_lieu = intval($_REQUEST['nhien_lieu']); $price = $_REQUEST['price']; $xemoi = intval($_REQUEST['xemoi']); $link = $config_path."/tim-kiem.html/txt-$txtsearch/price-$price"; $dksearch = "p.active = 1"; if($txtsearch){ if($txtsearch != "Nhập từ khóa"){ $dksearch .= " AND (p.name LIKE '%".$txtsearch."%'"; $dksearch .= " OR p.gioi_thieu LIKE '%".$txtsearch."%'"; $dksearch .= " OR p.noi_dung LIKE '%".$txtsearch."%')"; } } if($price){ if($price==1) $dksearch .=" AND p.price <= 10000000"; elseif($price == 2) $dksearch .=" AND p.price > 10000000 AND p.price<=15000000"; elseif($price == 3) $dksearch .=" AND p.price > 15000000 AND p.price<=20000000"; else $dksearch .=" AND p.price > 20000000"; } //tieu de $tpl->assign("name_cat",_tim_kiem); $sql = "SELECT p.*, mau.image AS img_mau FROM product AS p" ." LEFT JOIN loaibds AS mau ON p.id_bds = mau.id" ." WHERE ".$dksearch." ORDER BY p.thu_tu ASC,p.id_product DESC"; $count = mysql_num_rows($DB->query($sql)); //$link="?act=search&txtsearch=".$txtsearch."&price=".$price; $maxp=10; include('lib/pagination-seo.php'); if($kgPagerOBJ -> total_pages > 1){ $tpl->newBlock("phan_trang"); $tpl->assign("cac_trang", $str); } if(!$count){ $tpl->newBlock("notnews"); $tpl->assign("text","Không có sản phẩm"); } else{ $tpl->newBlock("lists"); while($r=mysql_fetch_array($rs_list)){ $tpl->newBlock("row-list"); if($r['xuat_xu']) $tpl->assign("xuat_xu",$r['xuat_xu']); else $tpl->assign("xuat_xu","Lắp ráp trong nước"); $tpl->assign("link","?act=productdetail&pid=".$r['id_catpd']."&id=".$r['id_product'].""); $namecat = hangsx($r['id_catpd']); $tpl->assign("hangsx",$namecat['name']); $tpl->assign("dong_xe",$r['dong_xe']); $img = ''; if($r['image']){ $imgs = explode(", ", $r['image']); $link = $config_path."/pddetail/".remove_marks($r['name'])."-".$r['id_catpd']."-".$r['id_product'].".html"; // $tpl->assign("link","?act=productdetail&pid=".$_r['id_catpd']."&id=".$_r['id_product'].""); $img = ""; } elseif($r['img_mau']){ $imgs = explode(", ", $r['img_mau']); $link=$config_path."/pddetail/".remove_marks($r['name'])."-".$r['id_catpd']."-".$r['id_product'].".html"; // $tpl->assign("link","?act=productdetail&pid=".$_r['id_catpd']."&id=".$_r['id_product'].""); $img = ""; } $tpl->assign("image",$img); $tpl->assign("mau",$r['mau']); $tpl->assign("price",format_price($r['price']).' vnđ'); } } function hangsx($id,&$r=array()){ global $DB; $sql="SELECT id_catpd,name,parentid FROM catpd WHERE id_catpd = ".$id; $rs = $DB->query($sql); $r = $DB->fetch_row($rs); if ($r['parentid'] != 0){ hangsx($r['parentid'],$r); } return $r; } $tpl->printToScreen(); ?>