$sql = 'SELECT g.goods_id, g.goods_name,g.goods_number, g.goods_name_style, g.market_price, g.is_new, g.is_best, g.is_hot, g.shop_price AS org_price, ' . ? "IFNULL(mp.user_price, g.shop_price * '$_SESSION[discount]') AS shop_price, g.promote_price, g.goods_type, " . ? 'g.promote_start_date, g.promote_end_date, g.goods_brief, g.goods_thumb , g.goods_img ' .? ? 'FROM ' . $GLOBALS['ecs']->table('goods') . ' AS g ' . ? ? ? ? ? ? 'LEFT JOIN ' . $GLOBALS['ecs']->table('member_price') . ' AS mp ' . ? "ON mp.goods_id = g.goods_id AND mp.user_rank = '$_SESSION[user_rank]' " . ? ? ? ? ? ? "WHERE $where $ext ORDER BY $sort $order";
在這里將檢索goods_number來在模板顯示商品庫存.將該字段放到數(shù)組中 $arr[$row['goods_id']]['goods_number'] = $row['goods_number'];
$sql = 'SELECT g.goods_id, g.goods_name, g.goods_name_style, g.market_price, g.is_new, g.is_best, g.is_hot, g.shop_price AS org_price, ' .
修改為
$sql = 'SELECT g.goods_id, g.goods_name, g.goods_name_style, g.market_price, g.is_new, g.is_best, g.is_hot, g.shop_price AS org_price,g.goods_number, ' .
繼續(xù)在
$arr[$row['goods_id']]['url'] = build_uri('goods', array('gid'=>$row['goods_id']), $row['goods_name']);
下面增加一行代碼
$arr[$row['goods_id']]['goods_number'] = $row['goods_number'];
2、打開 themes/模板文件夾/library/goods_list.lbi 文件
{$lang.btn_collect}
上面加入一行代碼版權(quán)聲明: 本站資源均來自互聯(lián)網(wǎng)或會員發(fā)布,如果侵犯了您的權(quán)益請與我們聯(lián)系,我們將在24小時內(nèi)刪除!謝謝!
轉(zhuǎn)載請注明: ecshop商品列表頁顯示商品庫存方法