ecshop bonuscontroller.php,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') '商易专业验证

{

$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));

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值