各位ECSHOP网店系统用户大家好,欢迎来到ECSHOP教程网图文教程,今天为大家详细解说一下ECSHOP网站商城首页显示商品库存数量。
ECSHOP教程网ECSHOP视频教程也再不断的完善与跟进,期待大家的关注!希望在ECSHOP的道路上,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‘]; |
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后台,清除一下缓存
时间: 2024-10-13 15:47:09