Rows($sql); $co_id = $r[0]['co_id']; $subcat = trim($_REQUEST['subcat']); if($subcat != "") $WHERE = " AND subcategory_id=$subcat "; #-------------------------------------------------------------------------- #SEARCH if(isset($_REQUEST['keyword']) && trim($_REQUEST['keyword'])) { $keyword = trim($_REQUEST['keyword']); $WHERE.=" AND ((A1.pro_name like '%$keyword%') OR (A1.intro like '%$keyword%'))"; $strURL.='keyword='.$keyword."&"; } #-------------------------------------------------------------------------- $sql1 = "SELECT A1.*, date_format(A1.date_added,'%d-%m-%Y') as date_added, A2.main_name , A2.account , A3.mn_name FROM tbl_product as A1 left join tbl_company as A2 on A1.co_id = A2.co_id left join tbl_money as A3 on A1.mn_id = A3.mn_id WHERE A1.co_id = '$co_id' ".$WHERE." ORDER BY A1.date_added DESC "; $result1 = mysql_query($sql1) or die("Not query"); $total_records=@mysql_num_rows($result1); $record_per_page=10; $scroll=10; $page->set_qry_string($strURL); $page->set_page_data("e-store_product.php",$total_records,$record_per_page,$scroll,true,true,true); $r1 = $db->Rows($page->get_limit_query($sql1)); $showPage=$page->get_page_nav(); $total_page=$page->total_page; $fN = $n_page*$record_per_page + 1; $tN = ($n_page+1)*$record_per_page; if($tN > $total_records) $tN=$total_records; #--------Menu------------------------------------------------------------ $menu="select san_pham,backgrounb from tbl_menubg where co_id='$co_id'"; $row_menu=$db->Rows($menu); #-------------------------------------------------------------------------- $smarty->assign("r",$r); $smarty->assign("showPage",$showPage); $smarty->assign("total_page",$total_page); $smarty->assign("total_records",$total_records); $smarty->assign("fN",$fN); $smarty->assign("tN",$tN); $smarty->assign("ca_id",$ca_id); $smarty->assign("r1",$r1); $smarty->assign("company",$company); $smarty->assign("row_menu",$row_menu); #--------option------------------------------------------------------------ $ds = "SELECT * FROM tbl_option WHERE co_id='$co_id'"; $r8=$db->Rows($ds); #-------------------------------------------------------------------------- $sqltemp = "Select * From tbl_template a,tbl_company b where a.id_template = b.id_template AND co_id = $co_id"; $rtemp = $db->Rows($sqltemp); #-------------------------------------------------------------------------- $smarty->assign("rtemp",$rtemp); $smarty->assign("r8",$r8); $smarty->display($template_root.$rtemp[0]["url_template"].'/e-store_product.tpl'); ?>