“在ECSHOP首頁顯示商品庫存的方法”, 下面是修改方法
1、
打開 /includes/lib_goods.php 檔案(建議使用editplus)
找到下面代碼(大概在287行左右)
//取出所有符合條件的商品資料,并将結果存入對應的推薦類型數組中
$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, ".
修改為
//取出所有符合條件的商品資料,并将結果存入對應的推薦類型數組中
$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、
接着,繼續向下找到
if (in_array($row['goods_id'], $type_array['best']))
在它上面增加一行代碼
$goods[$idx]['goods_number'] = $row['goods_number'];
yzzmf.com-->
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背景,清除一下緩存
版權聲明:本文為CSDN部落客「weixin_33913377」的原創文章,遵循CC 4.0 BY-SA版權協定,轉載請附上原文出處連結及本聲明。
原文連結:https://blog.csdn.net/weixin_33913377/article/details/92544345