<?php

if (!defined('IN_HANFOX')) exit('Access Denied');



$pagename = '商品详情';

$pageurl = '?mod=item';

$tempfile = 'item.html';

$table = $DB->table('shop');



$shop_id = intval($_GET['wid']);

$cache_id = $shop_id;


	

if (!$smarty->isCached($tempfile, $cache_id)) {

	$where = "w.shop_status=3 AND w.shop_id=$shop_id";

	$shop = get_one_shop($where);
   
	if (!$shop) {

		unset($shop);

		redirect('./?mod=index');

	}
		


	

	$DB->query("UPDATE $table SET shop_views=shop_views+1 WHERE shop_id=".$shop['shop_id']." LIMIT 1");

	

	$cate = get_one_category($shop['cate_id']);
	

	$user = get_one_user($shop['user_id']);

	

	$smarty->assign('site_title', $shop['shop_name'].' - '.$cate['cate_name'].' - '.$options['site_name']);

	$smarty->assign('site_keywords', !empty($shop['shop_tags']) ? $shop['shop_tags'] : $options['site_keywords']);

	$smarty->assign('site_description', !empty($shop['shop_intro']) ? $shop['shop_intro'] : $options['site_description']);

	$smarty->assign('site_path', get_sitepath($cate['cate_mod'], $shop['cate_id']).' &raquo; '.$pagename);
	
	$smarty->assign('site_cate', get_sitecate($cate['cate_mod'], $shop['cate_id']));
	
	$smarty->assign('site_area', get_sitearea($area['area_mod'], $area['area_id']));

	$smarty->assign('site_rss', get_rssfeed($cate['cate_mod'], $shop['cate_id']));

	

	$smarty->assign('cate_id', $cate['cate_id']);
    $smarty->assign('area_id', $area['area_id']);
	$smarty->assign('cate_name', $cate['cate_name']);
    $smarty->assign('area_name', $area['area_name']);
	$smarty->assign('cate_keywords', $cate['cate_keywords']);

	$smarty->assign('cate_description', $cate['cate_description']);
	
	
	
	$shop['shop_content'] = str_replace('[upload_dir]', $options['site_root'].$options['upload_dir'].'/', $shop['shop_content']);

	$shop['shop_furl'] = format_url($shop['shop_id']);

	$shop['shop_pic'] = get_webthumb($shop['shop_pic'],$shop['shop_id']);



	$shop['shop_ctime'] = date('Y-m-d', $shop['shop_ctime']);


	

	/** tags */

	$shop_tags = get_format_tags($shop['shop_tags']);

	$smarty->assign('shop_tags', $shop_tags);

	

    $smarty->assign('shop', $shop);

	$smarty->assign('user', $user);

	$smarty->assign('related_shop', get_shop($shop['cate_id'], 10, false, false, 'ctime'));

}


		

smarty_output($tempfile, $cache_id);


?>