06
2012
09

修复ECSHOP 2.7.2线下发放的红包BUG

今天测试ec的线下红包不管最小消费金额是多少,都可以无限制的使用红包。

flow.php文件下替换如下内容

elseif ($_REQUEST['step'] == 'validate_bonus')
{
$bonus_sn = trim($_REQUEST['bonus_sn']);
if (is_numeric($bonus_sn))
{
$bonus = bonus_info(0, $bonus_sn);
//var_dump($bonus);
}
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'];
}
/* 计算订单的费用 */
//var_dump(order_fee($order, $cart_goods, $consignee));
$total = order_fee($order, $cart_goods, $consignee);
// var_dump($total);
//var_dump($total['goods_price']);
//var_dump($bonus['min_goods_amount']);
if($total['goods_price']<$bonus['min_goods_amount'])
{
$order['bonus_id'] = '';
$total = order_fee($order, $cart_goods, $consignee);
$result['error'] = '订单价格不足';
}

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

« 上一篇 下一篇 »

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。