服务报价 | 域名主机 | 网络营销 | 软件工具| [加入收藏]
 热线电话: #
当前位置: 主页 > php教程 > ecshop教程 >

ecshop红包指定某些商品不能使用 修改步骤(2)

时间:2012-09-12 08:09来源:未知 作者:最模板 点击:
再修改前台: 首页在tb_cart表中加一个字段 is_bonus 类型 tinyint 默认为1 (1是可以使用红包) 找到includes/lib_order.php 中的 function addto_cart 1022行: $sql = SELECT g.

再修改前台:

首页在tb_cart表中加一个字段 is_bonus 类型 tinyint 默认为1 (1是可以使用红包)

找到includes/lib_order.php 中的 function  addto_cart

1022行:

$sql = “SELECT g.goods_name, g.goods_sn, g.is_on_sale, g.is_real,g.is_bonus, “.

“g.market_price, g.shop_price AS org_price, g.promote_price, g.promote_start_date, “.

“g.promote_end_date, g.goods_weight, g.integral, g.extension_code, “.

“g.goods_number, g.is_alone_sale, g.is_shipping,”.

“IFNULL(mp.user_price, g.shop_price * ‘$_SESSION[discount]‘) AS shop_price “.

” 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 g.goods_id = ‘$goods_id’” .

” AND g.is_delete = 0″;

1117行:

/* 初始化要插入购物车的基本件数据 */

$parent = array(

‘user_id’       => $_SESSION['user_id'],

‘session_id’    => SESS_ID,

‘goods_id’      => $goods_id,

‘goods_sn’      => addslashes($goods['goods_sn']),

‘product_id’    => $product_info['product_id'],

‘goods_name’    => addslashes($goods['goods_name']),

‘market_price’  => $goods['market_price'],

‘goods_attr’    => addslashes($goods_attr),

‘goods_attr_id’ => $goods_attr_id,

‘is_real’       => $goods['is_real'],

‘extension_code’=> $goods['extension_code'],

‘is_gift’       => 0,

‘is_bonus’      => $goods['is_bonus'],

‘is_shipping’   => $goods['is_shipping'],

‘rec_type’      => CART_GENERAL_GOODS

);

再修改:function order_fee 大概在545行

/* 商品总价 */

foreach ($goods AS $val)

{

/* 统计实体商品的个数 */

if ($val['is_real'])

{

$total['real_goods_count']++;

}

if($val['is_bonus'])

{

$total['goods_bonus_price']  += $val['goods_price'] * $val['goods_number'];

}

$total['goods_price']  += $val['goods_price'] * $val['goods_number'];

$total['market_price'] += $val['market_price'] * $val['goods_number'];

}

 

第六步:修改后台商品列表显示页代码

找到后台includes/lib_goods.php 中的 function  goods_list

$sql = “SELECT goods_id, goods_name, goods_type, goods_sn, shop_price, is_on_sale, is_best, is_new, is_hot,is_bonus, sort_order, goods_number, click_count,integral, ” .

” (promote_price > 0 AND promote_start_date <= ‘$today’ AND promote_end_date >= ‘$today’) AS is_promote “.

” FROM ” . $GLOBALS['ecs']->table(‘goods’) . ” AS g WHERE is_delete=’$is_delete’ $where” .

” ORDER BY $filter[sort_by] $filter[sort_order] “.

” LIMIT ” . $filter['start'] . “,$filter[page_size]“;

(责任编辑:最模板)

顶一下
(2)
22.2%
踩一下
(7)
77.8%
------分隔线----------------------------