「在ECSHOP首頁顯示商品庫存的方法」, 下面是修改方法php
一、sql
打開 /includes/lib_goods.php 文件(建議使用editplus)數組
找到下面代碼(大概在287行左右)緩存
//取出全部符合條件的商品數據,並將結果存入對應的推薦類型數組中it
$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, ".class
修改成後臺
//取出全部符合條件的商品數據,並將結果存入對應的推薦類型數組中方法
$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,".
二、
接着,繼續向下找到
if (in_array($row['goods_id'], $type_array['best']))
在它上面增長一行代碼
$goods[$idx]['goods_number'] = $row['goods_number'];
yzzmf.com-->
三、而後再修改模板文件 /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} -->
三、最後一步記得去ECSHOP後臺,清除一下緩存