assign("category_rows",$rows);
unset($cachesorts,$rows);
//Recommended Products List Data
$qry="SELECT id,retailcost,name,comments,addtime,image,tradeprice,goodsid FROM product WHERE istop='y' ORDER BY addtime DESC LIMIT 0,$recmded_qty";
$id=$db->get_col($qry,0);
$retailcost=$db->get_col(null,1);
$name=$db->get_col(null,2);
$comments=$db->get_col(null,3);
$addtime=$db->get_col(null,4);
$image=$db->get_col(null,5);
$tradeprice=$db->get_col(null,6);
$goodsid=$db->get_col(null,7);
//if(is_array($addtime)) foreach($addtime as $key=>$result) $addtime[$key]=date("m/d/Y",$result);
if(is_array($image)) foreach($image as $key=>$result) {
if($result && !file_exists($thumb_dir.'big_'.$result)) {
resizeimg($product_img_dir.$result,$thumb_dir.'big_'.$result,120,100);
}
}
$tpl->assign("product_id",$id);
$tpl->assign("retailcost",$retailcost);
$tpl->assign("product_name",$name);
$tpl->assign("comments",$comments);
//$tpl->assign("addtime",$addtime);
$tpl->assign("product_image",$image);
$tpl->assign("tradeprice",$tradeprice);
$tpl->assign("goodsid",$goodsid);
//Newest Products List Data
$qry="SELECT id,name,addtime,image,tradeprice FROM product ORDER BY addtime DESC LIMIT 0,$newest_qty";
$id=$db->get_col($qry,0);
$name=$db->get_col(null,1);
$addtime=$db->get_col(null,2);
$image=$db->get_col(null,3);
$tradeprice=$db->get_col(null,4);
if(is_array($comments)) foreach($comments as $key=>$result) $comments[$key]=substr($result,0,30);
if(is_array($addtime)) foreach($addtime as $key=>$result) $addtime[$key]=date("m/d/Y",$result);
if(is_array($image)) foreach($image as $key=>$result) {
if($result && !file_exists($thumb_dir.$result)) {
resizeimg($product_img_dir.$result,$thumb_dir.$result,80,80);
}
}
$tpl->assign("N_product_id",$id);
$tpl->assign("N_product_name",$name);
$tpl->assign("N_addtime",$addtime);
$tpl->assign("N_product_image",$image);
$tpl->assign("N_tradeprice",$tradeprice);
unset($id,$cateid,$name,$comments,$addtime,$image,$tradeprice,$result);
//HOT Products List Data
$qry="SELECT id,name,tradeprice,view FROM product ORDER BY view DESC LIMIT 0,$hot_qty";
$hot_id=$db->get_col($qry,0);
$hot_name=$db->get_col(null,1);
$hot_price=$db->get_col(null,2);
$hot_view=$db->get_col(null,3);
$tpl->assign("hot_id",$hot_id);
$tpl->assign("hot_name",$hot_name);
$tpl->assign("hot_price",$hot_price);
$tpl->assign("hot_view",$hot_view);
unset($hot_id,$hot_name,$hot_price,$hot_view);
//Special Price
$qry="SELECT id,name,specialcost FROM product WHERE specialcost != '0.00' ORDER BY addtime DESC LIMIT 0,$special_qty";
$sp_id=$db->get_col($qry,0);
$sp_name=$db->get_col(null,1);
$sp_price=$db->get_col(null,2);
$tpl->assign("sp_id",$sp_id);
$tpl->assign("sp_name",$sp_name);
$tpl->assign("sp_price",$sp_price);
unset($sp_id,$sp_name,$sp_price);
//Best Sellers
$qry="SELECT o.product_id, o.product_name, COUNT(*) as total FROM orderinfo as o INNER JOIN product as p on (p.goodsid=o.product_id) GROUP BY product_id ORDER BY total DESC LIMIT 0,$bestsell_qty";
$best_id=$db->get_col($qry,0);
$best_name=$db->get_col(null,1);
//$best_price=$db->get_col(null,2);
$tpl->assign("best_id",$best_id);
$tpl->assign("best_name",$best_name);
//$tpl->assign("best_price",$best_price);
unset($best_id,$best_name,$best_price);
//News
$qry="SELECT id,date,title FROM company_news WHERE class='news' ORDER BY date DESC LIMIT 0,$news_qty";
$news_id=$db->get_col($qry,0);
$news_date=$db->get_col(null,1);
$news_title=$db->get_col(null,2);
if(is_array($news_date)) foreach($news_date as $key=>$col) $news_date[$key]=date("d-M-Y",$col);
$tpl->assign("news_id",$news_id);
$tpl->assign("news_date",$news_date);
$tpl->assign("news_title",$news_title);
unset($news_id,$news_date,$news_title);
//FAQ
$qry="SELECT id,title FROM company_news WHERE class='faq' ORDER BY date DESC LIMIT 0,$news_qty";
$news_id=$db->get_col($qry,0);
$news_title=$db->get_col(null,1);
$tpl->assign("faq_id",$news_id);
$tpl->assign("faq_title",$news_title);
unset($news_id,$news_title);
//Right Column Data :specials & Adcolumn
right_col(0);
//Banner
$banner=$db->get_row("SELECT banner,use_flash_banner FROM siteinfo",0,ARRAY_N);
$banners=$banner[0];
$use_flash_banner=$banner[1];
$banners=explode("|",$banners);
$banid=array_rand($banners);
$tpl->assign("use_flash_banner",$use_flash_banner);
$tpl->assign("banner",$banners[$banid]);
/*
$tpl_vars = $tpl->get_template_vars();
print_rr($tpl_vars);
*/
$output=$tpl->fetch("default_,ahp2004.htm");
echo str_replace($tpl_imgdir_name, $tpl->template_dir.$tpl_imgdir_name,$output);
?>