分类分类
更新时间:2026-07-14 12:43:55作者:fang
一、历史浏览模块增加市场价格:
打开include/lin_insert.php 直接替换下面这段函数
/**
* 调用浏览历史
*
* @access public
* @return string
*/
function insert_history()
{
$str = '';
if (!empty($_COOKIE['ECS']['history']))
{
$where = db_create_in($_COOKIE['ECS']['history'], 'goods_id');
$sql = 'SELECT goods_id, goods_name, goods_thumb, shop_price, market_price FROM ' . $GLOBALS['ecs']->table('goods') .
" WHERE $where AND is_on_sale = 1 AND is_alone_sale = 1 AND is_delete = 0";
$query = $GLOBALS['db']->query($sql);
$res = array();
while ($row = $GLOBALS['db']->fetch_array($query))
{
$goods['goods_id'] = $row['goods_id'];
$goods['goods_name'] = $row['goods_name'];
$goods['short_name'] = $GLOBALS['_CFG']['goods_name_length'] > 0 ? sub_str($row['goods_name'], $GLOBALS['_CFG']['goods_name_length']) : $row['goods_name'];
$goods['goods_thumb'] = get_image_path($row['goods_id'], $row['goods_thumb'], true);
$goods['shop_price'] = price_format($row['shop_price']);
$goods['market_price'] = price_format($row['market_price']);
$goods['url'] = build_uri('goods', array('gid'=>$row['goods_id']), $row['goods_name']);
$str.='<ul class="clearfix"><li class="goodsimg"><a href="'.$goods['url'].'" target="_blank"><img src="'.$goods['goods_thumb'].'" alt="'.$goods['goods_name'].'" class="B_blue" /></a></li><li><a href="'.$goods['url'].'" target="_blank" title="'.$goods['goods_name'].'">'.$goods['short_name'].'</a><br />'.原价:.$goods['market_price'].'<br />'.现价:.'<font class="f1">'.$goods['shop_price'].'</font><br /></li></ul>';
}
$str .= '<ul id="clear_history"><a onclick="clear_history()">' . $GLOBALS['_LANG']['clear_history'] . '</a></ul>';
}
return $str;
}
二、购买过该商品的朋友还购买了模块增加市场价格:
打开goods.php 直接替换以下函数
/**
* 获得购买过该商品的人还买过的商品
*
* @access public
* @param integer $goods_id
* @return array
*/
function get_also_bought($goods_id)
{
$sql = 'SELECT COUNT(b.goods_id ) AS num, g.goods_id, g.goods_name, g.goods_thumb, g.goods_img, g.shop_price, g.market_price, g.promote_price, g.promote_start_date, g.promote_end_date ' .
'FROM ' . $GLOBALS['ecs']->table('order_goods') . ' AS a ' .
'LEFT JOIN ' . $GLOBALS['ecs']->table('order_goods') . ' AS b ON b.order_id = a.order_id ' .
'LEFT JOIN ' . $GLOBALS['ecs']->table('goods') . ' AS g ON g.goods_id = b.goods_id ' .
"WHERE a.goods_id = '$goods_id' AND b.goods_id <> '$goods_id' AND g.is_on_sale = 1 AND g.is_alone_sale = 1 AND g.is_delete = 0 " .
'GROUP BY b.goods_id ' .
'ORDER BY num DESC ' .
'LIMIT ' . $GLOBALS['_CFG']['bought_goods'];
$res = $GLOBALS['db']->query($sql);
$key = 0;
$arr = array();
while ($row = $GLOBALS['db']->fetchRow($res))
{
$arr[$key]['goods_id'] = $row['goods_id'];
$arr[$key]['goods_name'] = $row['goods_name'];
$arr[$key]['short_name'] = $GLOBALS['_CFG']['goods_name_length'] > 0 ?
sub_str($row['goods_name'], $GLOBALS['_CFG']['goods_name_length']) : $row['goods_name'];
$arr[$key]['goods_thumb'] = get_image_path($row['goods_id'], $row['goods_thumb'], true);
$arr[$key]['goods_img'] = get_image_path($row['goods_id'], $row['goods_img']);
$arr[$key]['shop_price'] = price_format($row['shop_price']);
$arr[$key]['market_price'] = price_format($row['market_price']);
$arr[$key]['url'] = build_uri('goods', array('gid'=>$row['goods_id']), $row['goods_name']);
if ($row['promote_price'] > 0)
{
$arr[$key]['promote_price'] = bargain_price($row['promote_price'], $row['promote_start_date'], $row['promote_end_date']);
$arr[$key]['formated_promote_price'] = price_format($arr[$key]['promote_price']);
}
else
{
$arr[$key]['promote_price'] = 0;
}
$key++;
}
return $arr;
}
然后再模板文件bought_goods.lbi 中加上
原价:{$bought_goods_data.market_price}
三、相关联商品模块增加市场价格:
直接打开模板文件goods_related.lbi
插入:
原价:{$releated_goods_data.market_price}
即可
以上就是本文章的内容,希望对大家有所帮助
相关
喜气冲冲2026最新版本生活服务41.8 MBv1.6.0.92026-07-14
下载高超地图导航(导航打卡应用)生活服务108.6 MBv1.0.02026-07-14
下载365浏览器大全2026最新版本资讯阅读99.9 MBv1.0.22026-07-14
下载瞬时清理垃圾(健康数据记录)生活服务62.6 MBv1.0.22026-07-14
下载准橙三力(老年三力测试软件)学习办公34.1 MBv1.1.72026-07-14
下载云图探界(位置跟踪应用)生活服务135.6 MBv1.0.12026-07-14
下载手机免费注册邮箱最新安卓版生活服务59.3 MBv1.0.22026-07-14
下载充电桩附近查询最新安卓版生活服务75.8 MBv1.0.12026-07-14
下载华施达(社区生活平台)生活服务93.9 MBv5.3.02026-07-14
下载外卖优惠点餐(点餐省钱平台)生活服务64.9 MBv1.0.02026-07-14
下载家庭维修服务平台商家端最新手机版生活服务36.9 MBv1.0.22026-07-14
下载火力掩护无限生命金币动作射击758.3 MBv1.33.172026-07-14
下载










