// 积分购,vip购 $smarty->assign('image_width', $_CFG['image_width']); $smarty->assign('image_height', $_CFG['image_height']); $smarty->assign('helps', get_shop_help()); // 网店帮助 $smarty->assign('id', $goods_id); $smarty->assign('type', 0); $smarty->assign('cfg', $_CFG); $smarty->assign('promotion', get_promotion_info($goods_id)); //促销信息 $smarty->assign('promotion_info', get_promotion_info()); $smarty->assign('comment_percent', comment_percent($goods_id)); //获取评分 $smarty->assign('top_goods', get_top10()); // 销售排行 $smarty->assign('new_comment', get_new_comment($goods_id, 1)); //获取最新一条评论信息 /* 获得商品的信息 */ $goods = get_goods_info($goods_id); if ($goods === false) { /* 如果没有找到任何记录则跳回到首页 */ ecs_header("Location: ./\n"); exit; } else { if ($goods['brand_id'] > 0) { $goods['goods_brand_url'] = build_uri('brand', array('bid' => $goods['brand_id']), $goods['goods_brand']); } $shop_price = $goods['shop_price']; $linked_goods = get_linked_goods($goods_id); foreach ($linked_goods as $kLinkGood => $vGood) { $linked_goods[$kLinkGood]['url'] = build_uri('goods', array('gid' => $linked_goods[$kLinkGood]['goods_id']), $linked_goods[$kLinkGood]['goods_name']);
$json = new JSON(); $res = array('err_msg' => '', 'result' => '', 'goods_img' => ''); $goods_id = $_REQUEST['id']; if (!empty($goods_id)) { /* 获得商品的信息 */ $goods = get_goods_info($goods_id); $res['result'] = $goods; $res['short_name'] = $GLOBALS['_CFG']['goods_name_length'] > 0 ? sub_str($goods['goods_name'], $GLOBALS['_CFG']['goods_name_length']) : $goods['goods_name']; $res['goods_name'] = $goods['goods_name']; $res['goods_img'] = $goods['goods_img']; $res['goods_sn'] = sprintf($GLOBALS['_LANG']['quick_goods_sn'], $goods['goods_sn']); $res['shop_price'] = sprintf($GLOBALS['_LANG']['quick_shop_pirce'], price_format($goods['shop_price'])); $res['market_price'] = sprintf($GLOBALS['_LANG']['quick_market_pirce'], $goods['market_price']); $comment_percent = comment_percent($goods_id); $res['haoping_percent'] = $comment_percent['haoping_percent'] . '%'; $new_comment = get_new_comment($goods_id, 5); $res['new_comment'] = '<div class="bd"><ul>'; foreach ($new_comment as $key => $value) { $value['user_name'] = $value['user_name'] ? $value['user_name'] : '匿名用户'; $res['new_comment'] .= '<li style="height:36px;word-wrap:break-word;overflow:hidden;">' . $value['user_name'] . ':' . sub_str($value['content'], 34) . '</li>'; } $res['new_comment'] .= '</ul></div>'; } else { $res['err_msg'] = $_LANG['err_change_attr']; } die($json->encode($res)); } /* 修改 end by zhouH*/ /*------------------------------------------------------ */ //-- 商品购买记录ajax处理 /*------------------------------------------------------ */
function get_new_comment_30($type) { return get_new_comment($type, 30); }