广州传奇网络

地址:广州市天河区东圃大马路富华楼C座

电话:13808825895

邮箱:gz020wbs@163.com

QQ:1564443073

网址:http://www.020wbs.com/

首页 > 二次开发Ecshop二次开发 > ECSHOP线下红包不能支持最小订单

二次开发Ecshop二次开发

二次开发Ecshop二次开发

ECSHOP线下红包不能支持最小订单

 ECSHOP线下红包都有个bug,就是线下红包不支持最小订单,无论多小金额的订单都能使用红包。
flow.php文件中找到

/* 验证红包序列号 */

elseif ($_REQUEST['step'] == 'validate_bonus')

{

$bonus_sn = trim($_REQUEST['bonus_sn']);

if (is_numeric($bonus_sn))

{

$bonus = bonus_info(0, $bonus_sn);

}

else

{

$bonus = array();

}


// if (empty($bonus) || $bonus['user_id'] > 0 || $bonus['order_id'] > 0)

// {

// die($_LANG['bonus_sn_error']);

// }

// if ($bonus['min_goods_amount'] > cart_amount())

// {

// die(sprintf($_LANG['bonus_min_amount_error'], price_format($bonus['min_goods_amount'], false)));

// }

// die(sprintf($_LANG['bonus_is_ok'], price_format($bonus['type_money'], false)));

$bonus_kill = price_format($bonus['type_money'], false);


include_once('includes/cls_json.php');

$result = array('error' => '', 'content' => '');


/* 取得购物类型 */

$flow_type = isset($_SESSION['flow_type']) ? intval($_SESSION['flow_type']) : CART_GENERAL_GOODS;


/* 获得收货人信息 */

$consignee = get_consignee($_SESSION['user_id']);


/* 对商品信息赋值 */

$cart_goods = cart_goods($flow_type); // 取得商品列表,计算合计


if (empty($cart_goods) || !check_consignee_info($consignee, $flow_type))

{

$result['error'] = $_LANG['no_goods_in_cart'];

}

else

{

/* 取得购物流程设置 */

$smarty->assign('config', $_CFG);


/* 取得订单信息 */

$order = flow_order_info();



if (((!empty($bonus) && $bonus['user_id'] == $_SESSION['user_id']) || ($bonus['type_money'] > 0 && empty($bonus['user_id']))) && $bonus['order_id'] <= 0)

{

//$order['bonus_kill'] = $bonus['type_money'];

$now = gmtime();

if ($now > $bonus['use_end_date'])

{

$order['bonus_id'] = '';

$result['error']=$_LANG['bonus_use_expire'];

}

else

{

$order['bonus_id'] = $bonus['bonus_id'];

$order['bonus_sn'] = $bonus_sn;

}

}

else

{

//$order['bonus_kill'] = 0;

$order['bonus_id'] = '';

$result['error'] = $_LANG['invalid_bonus'];

}


/* 计算订单的费用 */

$total = order_fee($order, $cart_goods, $consignee);


$smarty->assign('total', $total);


/* 团购标志 */

if ($flow_type == CART_GROUP_BUY_GOODS)

{

$smarty->assign('is_group_buy', 1);

}


$result['content'] = $smarty->fetch('library/order_total.lbi');

}

$json = new JSON();

die($json->encode($result));

}

修改为




/* 验证红包序列号 */



elseif ($_REQUEST['step'] == 'validate_bonus') '商易专业验证
www.kicshop.com


{



$bonus_sn = trim($_REQUEST['bonus_sn']);



if (is_numeric($bonus_sn))



{



$bonus = bonus_info(0, $bonus_sn);



}



else



{



$bonus = array();



}



$bonus_kill = price_format($bonus['type_money'], false); '成都商易



include_once('includes/cls_json.php');



$result = array('error' => '', 'content' => '');



/* 取得购物类型 */



$flow_type = isset($_SESSION['flow_type']) ? intval($_SESSION['flow_type']) : CART_GENERAL_GOODS;



/* 获得收货人信息 */



$consignee = get_consignee($_SESSION['user_id']);



/* 对商品信息赋值 */



$cart_goods = cart_goods($flow_type); // 取得商品列表,计算合计



if (empty($cart_goods) || !check_consignee_info($consignee, $flow_type))



{



$result['error'] = $_LANG['no_goods_in_cart'];



}



else



{



/* 取得购物流程设置 */



$smarty->assign('config', $_CFG);



/* 取得订单信息 */



$order = flow_order_info();



if ($bonus['min_goods_amount'] <= cart_amount())



{



if (((!empty($bonus) && $bonus['user_id'] == $_SESSION['user_id']) || ($bonus['type_money'] > 0 && empty($bonus['user_id']))) && $bonus['order_id'] <= 0)



{



//$order['bonus_kill'] = $bonus['type_money'];



$now = gmtime();



if ($now > $bonus['use_end_date'])



{



$order['bonus_id'] = '';



$result['error']=$_LANG['bonus_use_expire'];



}



else



{



$order['bonus_id'] = $bonus['bonus_id'];



$order['bonus_sn'] = $bonus_sn;



}



}



else



{



//$order['bonus_kill'] = 0;



$order['bonus_id'] = '';



$result['error'] = $_LANG['invalid_bonus'];



}



}



else



{



$result['error'] = sprintf($_LANG['bonus_min_amount_error'], price_format($bonus['min_goods_amount'], false));



}



/* 计算订单的费用 */



$total = order_fee($order, $cart_goods, $consignee);



$smarty->assign('total', $total);



/* 团购标志 */



if ($flow_type == CART_GROUP_BUY_GOODS)



{



$smarty->assign('is_group_buy', 1);



}



$result['content'] = $smarty->fetch('library/order_total.lbi');



}



$json = new JSON();



die($json->encode($result));