Ectouch修改虚拟销售数量的方法

时间:2021-11-29 10:19:58

1、参考:
http://zhidao.baidu.com/link?url=5OEkRlKqtRcmnO6iyW2pq-gw1aj-1S6QdImmBkQZHHt6tcvT50aIf_1nibP3T6urM8nIC8iF0U6RyxCx7B9qfHGke7sIPciIdYcrsYwUgm_

经过实验,此方法也不管用。

=================================================================================================
经过4个小时的分析后发现:

2、位置:

A)、Ectouch 1.7版本安装后,会创建一个数据表:ecs_touch_goods,包含goods_id和sales_volume字段。正是销售数量记录表。 

B)、文件位置:

(1)、.\mobile\include\apps\default\common目录下面的:function.php(Ectouch1.7)
(2)、.\mobile\include\apps\default\helpers目录下面的:function.php(Ectouch2.0)

 此文件里有查询销量的函数:function get_goods_count($goods_id),于是修改如下:


    /* 查询该商品销量 */

    /*1、注释掉以下SQL查询语句*/
    /*$sql = 'SELECT IFNULL(SUM(g.goods_number), 0) as count ' .
        'FROM '. M()->pre .'order_info AS o, '. M()->pre .'order_goods AS g ' .
        "WHERE o . order_id = g . order_id " .
        " AND o . order_status " . db_create_in(array(OS_CONFIRMED, OS_SPLITED)) .
        " AND o . shipping_status " . db_create_in(array(SS_SHIPPED, SS_RECEIVED)) .
        " AND o . pay_status " . db_create_in(array(PS_PAYED, PS_PAYING)) .
        " AND g . goods_id = '$goods_id'";*/ 
    /*2、改为*/
    $sql = 'SELECT sales_volume as count FROM '. M()->pre .'touch_goods  WHERE goods_id = '.$goods_id;       
    /*3、修改结束*/

    $result = M()->getRow($sql);
    /*4、if   $result['count']=null then return 1  else  如果销售数量表中没有记录时就应该返回0,待修改  */
    return $result['count'];