优惠方式判断优惠上限范围的修改
1、flow.php
找到:
	        //添加赠品  //www.lyecs.com
        foreach($val['goods_promotion'] AS $v){
            if($v['gift']){
                foreach($v['gift'] AS $gift){
                    $gift_rec_id=add_gift_to_cart($val['goods_id'], $gift['goods_id'], 0,$val['goods_number']);
                    $_SESSION['cart_rec_ids'].=','.$gift_rec_id;
                }
            }
        } 
将其删除
同文件找到:
	    /* 订单中的总额 */
    $total = order_fee($order, $cart_goods, $consignee);
在其后面添加以下代码:
	    foreach ($cart_goods as $val) {        
        //添加赠品  //www.lyecs.com
        foreach($val['goods_promotion'] AS $v){
            if($v['gift'] && $v['min_amount']<=$total['goods_price'] && ($v['max_amount']>$total['goods_price'] || $v['max_amount'] ==0)){
                foreach($v['gift'] AS $gift){
                    $gift_rec_id=add_gift_to_cart($val['goods_id'], $gift['goods_id'], 0,$val['goods_number']);
                    $_SESSION['cart_rec_ids'].=','.$gift_rec_id;
                }
            }
        }
    } 
	
2、找到includes/lib_common.php
找到:
	$sql = 'SELECT act_id, act_range, act_range_ext, act_name, start_time,act_type, end_time,min_amount,gift FROM ' . $GLOBALS['ecs']->table('favourable_activity') . " WHERE start_time <= '$gmtime' AND end_time >= '$gmtime'";
替换为:
$sql = 'SELECT act_id, act_range, act_range_ext, act_name, start_time,act_type, end_time,min_amount,gift,max_amount FROM ' . $GLOBALS['ecs']->table('favourable_activity') . " WHERE start_time <= '$gmtime' AND end_time >= '$gmtime'";
找到:
if ($rows['act_range'] == FAR_ALL)
替换为:
	            $favourable[$rows['act_id']]['min_amount'] = $rows['min_amount'];
            $favourable[$rows['act_id']]['max_amount'] = $rows['max_amount'];
            if ($rows['act_range'] == FAR_ALL) 
LYECS LYECS电商系统 老杨商城系统 ECSHOP二次开发