近幾日論壇里有人問到“在ECSHOP首頁顯示商品庫存的方法”, 下面是修改方法
1、
打開 /includes/lib_goods.php 文件(建議使用editplus)
找到下面代碼(大概在287行左右)
//取出所有符合條件的商品數(shù)據(jù),并將結果存入對應的推薦類型數(shù)組中
$sql = 'SELECT g.goods_id, g.goods_name, g.goods_name_style, g.market_price, g.shop_price AS org_price, g.promote_price, ' .
"IFNULL(mp.user_price, g.shop_price * '$_SESSION[discount]') AS shop_price, ".
修改為
//取出所有符合條件的商品數(shù)據(jù),并將結果存入對應的推薦類型數(shù)組中
$sql = 'SELECT g.goods_id, g.goods_name, g.goods_name_style, g.market_price, g.shop_price AS org_price, g.promote_price, ' .
"IFNULL(mp.user_price, g.shop_price * '$_SESSION[discount]') AS shop_price, g.goods_number,".
2、
接著,繼續(xù)向下找到
if (in_array($row['goods_id'], $type_array['best']))
在它上面增加一行代碼
$goods[$idx]['goods_number'] = $row['goods_number'];
3、然后再修改模板文件 /themes/模板文件夾/library/recommend_hot.lbi ,/themes/模板文件夾/library/recommend_new.lbi , /themes/模板文件夾/library/recommend_best.lbi
在
<font class="f1">
<!-- {if $goods.promote_price neq ""} -->
{$goods.promote_price}
<!-- {else}-->
{$goods.shop_price}
<!--{/if}-->
</font>
下面增加代碼
<br>
<!-- {if $goods.goods_number eq 0} -->
<strong>{$lang.goods_number}</strong>
<font color='red'>{$lang.stock_up}</font>
<!-- {else} -->
<strong>{$lang.goods_number}</strong>
{$goods.goods_number} {$goods.measure_unit}
<!-- {/if} -->
3、最后一步記得去ECSHOP后臺,清除一下緩存
|
新聞熱點
疑難解答
圖片精選