国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 網站 > 建站經驗 > 正文

ecshop歷史瀏覽、購買了該商品的人還買了、相關聯產品模塊增加“市場價格”

2024-04-25 20:44:04
字體:
來源:轉載
供稿:網友

一、歷史瀏覽模塊增加市場價格:

打開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}

即可

以上就是本文章的內容,希望對大家有所幫助

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 丹江口市| 收藏| 长宁县| 利津县| 铁岭县| 普洱| 武夷山市| 沽源县| 元氏县| 抚宁县| 桂东县| 当涂县| 杂多县| 普宁市| 时尚| 龙岩市| 宜君县| 屯留县| 勃利县| 新巴尔虎左旗| 胶州市| 宁波市| 棋牌| 遂溪县| 浦江县| 赤水市| 焦作市| 荃湾区| 黄冈市| 盈江县| 大连市| 垫江县| 同心县| 福建省| 菏泽市| 新密市| 远安县| 阿巴嘎旗| 福海县| 东明县| 建始县|