ecshop二次开发库存在列表显示

2010-03-31 23:31 来源:www.chinab4c.com 作者:admin

      ecshop网店在很多时候,需要将商品的库存在ecshop商品列表里面显示.ecshop商品列表无非是首页,ecshop分类列表页,ecshop搜索页面和品牌显示页面.下面我们将结合ecshop商品列表的程序,来演示ecshop商品列表中如何显示商品库存.

      首先,我们要知道ecshop数据库表goods里的goods_number为库存字段。我们将检索他出来就可以了。

     $sql = 'SELECT g.goods_id, g.goods_name,g.goods_number, g.goods_name_style, 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.goods_type, " .
                'g.promote_start_date, g.promote_end_date, g.goods_brief, g.goods_thumb , g.goods_img ' .
            'FROM ' . $GLOBALS['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 $where $ext ORDER BY $sort $order";

    在这里我们将检索goods_number来在模板显示商品库存.将该字段放到数组中 $arr[$row['goods_id']]['goods_number']             = $row['goods_number'];
    最后我们在themes/default/library/goods_list.lbi中使用{$goods.goods_number}来在模板显示商品库存.

   相关文章:

 ecshop2.7.0utf给属性增加库存

   ecshop库存报警插件程序

    来源:中国B4C电子商务