欢迎光临景诺科技软件开发淘宝店

进店请收藏,谢谢

让ecshop搜索结果显示库存。

在search.php里面找到:

/* 查询商品 */

    $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";

在$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}

更多

本文固定链接: http://shanmao.me/web-system/rang-ecshop-sou-suo-jie-guo-xian-shi-ku-cun | 山猫的博客

该日志由 admin 于2013年01月06日发表在 ECSHOP二次开发, 开源系统 分类下, 你可以发表评论,并在保留原文地址及作者的情况下引用到你的网站或博客。
原创文章转载请注明: 让ecshop搜索结果显示库存。 | 山猫的博客
关键字: , , ,