prepare(); $tpl->assign("title",$CONFIG['site_name']); $config_path = "https://".$CONFIG["http_host"].$CONFIG["dir_path"]; $tpl->assignGlobal("config_path",$config_path); $tpl->assign("description",$CONFIG['site_description']); $tpl->assign("keyword",$CONFIG['site_keywords']); session_register('lang'); session_register('user_members'); if($_REQUEST['lang']=='en'){ $_SESSION['lang']='_eng'; } elseif($_REQUEST['lang']=='ja' ) { $_SESSION['lang']='_ja'; } elseif($_REQUEST['lang']=='fr' ) { $_SESSION['lang']='_fr'; } elseif($_REQUEST['lang']=='ru' ) { $_SESSION['lang']='_ru'; } elseif($_REQUEST['lang']=='vi' ) { $_SESSION['lang']=''; } if(!isset($_SESSION["REMOTE_ADDR"])){ session_register('REMOTE_ADDR'); $_SESSION["REMOTE_ADDR"] = $_SERVER['REMOTE_ADDR']; } $lang =""; $tpl->assign("hotrobanhang",$CONFIG['support']); $tpl->assign("face",$CONFIG['facebook']); $tpl->assign("google",$CONFIG['google']); $tpl->assign("youtube",$CONFIG['youtube']); include("lang/vn.php"); $act=$_GET['act']; $pid=intval($_GET['pid']); $id=intval($_GET['id']); $code=intval($_GET['code']); $color=intval($_GET['color']); $tpl->assign("trang_chu",_trang_chu); $tpl->assign("gioi_thieu",_gioi_thieu); $tpl->assign("san_pham",_san_pham); $tpl->assign("do_kiem",_do_kiem); $tpl->assign("van_ban",_van_ban); $tpl->assign("video",_video); $tpl->assign("tin_tuc",_tin_tuc); $tpl->assign("tuyen_dung",_tuyen_dung); $tpl->assign("lien_he",_lien_he); $tpl->assignGlobal("nhap_tu_khoa",_nhap_tu_khoa); //logo cong ty $slq_lg="SELECT * FROM logo WHERE active=1 AND id_catlg=38 ORDER BY thu_tu ASC, id_logo DESC LIMIT 1"; $rs_lg=$DB->query($slq_lg); if($r_lg = mysql_fetch_array($rs_lg)){ if($r_lg['image']){ $image_info = @getimagesize($CONFIG['upload_image_path'].$r_lg['image']); if (get_file_extension($r_lg['image'])=='swf' || get_file_extension($r_lg['image'])=='SWF'){ $info=' '; } else{ if($r_lg['link']) $info=""; else $info=""; } $tpl->assign("logo",$info); } } /////////////////////////// //// show support $sql_sp="SELECT * FROM yahoo WHERE active=1 ORDER BY thu_tu ASC, id_ym DESC"; $rs_sp=$DB->query($sql_sp); while($r_sp=mysql_fetch_array($rs_sp)){ $tpl->newBlock("support"); $tpl->assign("name",$r_sp['name']); $tpl->assign("phone",$r_sp['phone']); $tpl->assign("yahoo",$r_sp['nickym']); $tpl->assign("skype",$r_sp['nicksky']); } if($CONFIG['phone_tragop']){ $tpl->newBlock("muatragop"); $tpl->assign("muatragop",$CONFIG['phone_tragop']); } if($act=="home" || !$act){ $tpl->newBlock('home'); //banner cong ty if(!$act || $act == 'home'){ $tpl->newBlock("banner_home"); $slq_lg="SELECT * FROM logo WHERE active=1 AND id_catlg=27 ORDER BY thu_tu ASC, id_logo DESC"; $rs_lg=$DB->query($slq_lg); $i=0; while($r_lg = mysql_fetch_array($rs_lg)){ if($r_lg['image']){ $image_info = @getimagesize($CONFIG['upload_image_path'].$r_lg['image']); if (get_file_extension($r_lg['image'])=='swf' || get_file_extension($r_lg['image'])=='SWF'){ $info=' '; $info=""; } else{ $info=$r_lg['image']; } if($info){ $tpl->newBlock("banner"); if($r_lg['link']) $info=""; else $info=""; $tpl->assign("image",$info); $tpl->newBlock("thumb"); $i++; $tpl->assign("i",$i); } } } } } //san pham moi $slq="SELECT p.*, m.image AS img_mau FROM product AS p LEFT JOIN loaibds AS m ON p.id_bds = m.id WHERE p.active=1 AND p.home=1 ORDER BY p.thu_tu ASC, p.id_product DESC"; $rs=$DB->query($slq); while($r = mysql_fetch_array($rs)){ $tpl->newBlock("sphot"); $tpl->assign("link",$config_path."/pddetail/".remove_marks($r['name'])."-".$r['id_catpd']."-".$r['id_product'].".html"); if($r['image']){ $imgs = explode(", ", $r['image']); $tpl->assign("image",$imgs[0]); } elseif($r['img_mau']){ $imgs = explode(", ", $r['img_mau']); $tpl->assign("image",$imgs[0]); } $tpl->assign("name",$r['name']); if($r['sale']){ $sale = $r['price'] - $r['sale']; $tpl->assign("price",format_price($sale)); $tpl->assign("sale",'

'.format_price($r['price']).'đ

'); } else $tpl->assign("price",format_price($r['price'])); } //gio hang $_rs = $DB->query("SELECT sum(`quantity`) AS `items_total` FROM `cart` WHERE `username` = '".mysql_real_escape_string($_SESSION["REMOTE_ADDR"])."'"); $_r = $DB->fetch_row($_rs); if($_r['items_total']){ $tpl->newBlock(cart); $tpl->assign("cart",$_r["items_total"]); } else{ $tpl->newBlock(cart); $tpl->assign("cart","0"); } //////////////////////////////////// // Danh muc san pham $slq="SELECT * FROM cat WHERE active=1 AND parentid=76 ORDER BY thu_tu ASC, id_cat DESC"; $rs=$DB->query($slq); while($r = mysql_fetch_array($rs)){ $tpl->newBlock("catpd"); $tpl->assign("link",$config_path."/news/".remove_marks($r['name'])."-".$r['id_cat'].".html"); $tpl->assign("name",$r['name']); } // menu pd $sql="SELECT * FROM catpd WHERE active = 1 AND parentid = 0 ORDER BY thu_tu ASC, id_catpd DESC"; $rs=$DB->query($sql); while($r=$DB->fetch_row($rs)){ $tpl->newBlock("pd"); $link = $config_path."/product/".remove_marks($r['name'.$lang])."-".$r['id_catpd'].".html"; $tpl->assign("link", $link); $tpl->assign("name", $r['name'.$lang]); $_rs = $DB->query("SELECT * FROM catpd WHERE active = 1 AND parentid = ".$r['id_catpd']." ORDER BY thu_tu ASC, id_catpd DESC"); if(mysql_num_rows($_rs)){ while($_r=$DB->fetch_row($_rs)){ $tpl->newBlock("sub_danhmuc"); $link = $config_path."/product/".remove_marks($_r['name'.$lang])."-".$_r['id_catpd'].".html"; $tpl->assign("link", $link); $tpl->assign("name", $_r['name'.$lang]); } } } //san pham ua thich $slq="SELECT p.*, m.image AS img_mau FROM product AS p LEFT JOIN loaibds AS m ON p.id_bds = m.id WHERE p.active=1 AND p.dang_ve=1 ORDER BY p.thu_tu ASC, p.id_product DESC"; $rs=$DB->query($slq); while($r = mysql_fetch_array($rs)){ $tpl->newBlock("likepd"); $tpl->assign("link",$config_path."/pddetail/".remove_marks($r['name'])."-".$r['id_catpd']."-".$r['id_product'].".html"); if($r['image']){ $imgs = explode(", ", $r['image']); $tpl->assign("image",$imgs[0]); } elseif($r['img_mau']){ $imgs = explode(", ", $r['img_mau']); $tpl->assign("image",$imgs[0]); } $tpl->assign("name",$r['name']); $tpl->assign("price",format_price($r['price'])); } //////////////////////////////////// // Tu van $sql="SELECT * FROM news WHERE active=1 AND id_cat=58 ORDER BY thu_tu ASC, id_news DESC LIMIT 4"; $rs=$DB->query($sql); while($r=mysql_fetch_array($rs)){ $tpl->newBlock("tuvan"); $tpl->assign("image",$r['image']); $tpl->assign("link",$config_path."/newsdetail/".remove_marks($r['name'])."-".$r['id_cat']."-".$r['id_news'].".html"); $tpl->assign("name",$r['name']); } $tpl->printToScreen(); ?>