让ecshop搜索结果显示库存。

在search.php里面找到:

[code]
/* 查询商品 */

$sql = "SELECT g.goods_id, g.goods_name, 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.promote_start_date, g.promote_end_date, g.goods_thumb, g.goods_img, g.goods_brief, g.goods_type ".

"FROM " .$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 g.is_delete = 0 AND g.is_on_sale = 1 AND g.is_alone_sale = 1 $attr_in ".

"AND (( 1 " . $categories . $keywords . $brand . $min_price . $max_price . $intro . $outstock . " ) ".$tag_where." ) " .

"ORDER BY $sort $order";
[/code]

在$sql 里面加上 g.goods_number。也就是:

$sql = “SELECT g.goods_id, g.goods_name, g.market_price,g.goods_number, g.is_new, g.is_best, g.is_hot, g.shop_price AS org_price, “.

在下面的 while循环里面:

找到:

$arr[$row[‘goods_id’]][‘type’] = $row[‘goods_type’];

在这行下面加上:

$arr[$row[‘goods_id’]][‘goods_number’]          = $row[‘goods_number’];

然后模板:

在模板上search.dwt: <!–{foreach name=goods_list from=$goods_list item=goods}–> 里面

加入:库存:{$goods.goods_number}