提交 1a95fb7f 编写于 作者: G gongfuxiang

购买判断顺序优化

上级 d98b7fe6
......@@ -2909,58 +2909,60 @@ class GoodsService
];
$error = '仅展示';
} else {
// web端class
$class_name = (APPLICATION == 'web') ? 'buy-event login-event' : '';
// 购买
$buy = [
'color' => 'main',
'type' => 'buy',
'title' => '点此按钮到下一步确认购买信息',
'name' => (MyC('common_order_is_booking', 0, true) == 1) ? '立即预约' : '立即购买',
'class' => $class_name,
'icon' => '',
];
// 还有库存
if($goods['inventory'] <= 0)
{
$error = '没货了';
}
if(empty($error))
{
// web端class
$class_name = (APPLICATION == 'web') ? 'buy-event login-event' : '';
// 商品类型是否和当前站点类型一致
$cart = [];
$ret = self::IsGoodsSiteTypeConsistent($goods['id'], $goods['site_type']);
if($ret['code'] == 0)
{
// 加入购物车
$cart = [
'color' => 'second',
'type' => 'cart',
'title' => '加入购物车',
'name' => '加入购物车',
// 购买
$buy = [
'color' => 'main',
'type' => 'buy',
'title' => '点此按钮到下一步确认购买信息',
'name' => (MyC('common_order_is_booking', 0, true) == 1) ? '立即预约' : '立即购买',
'class' => $class_name,
'icon' => 'am-icon-opencart',
'icon' => '',
];
} else {
$error = $ret['msg'];
}
// 主按钮顺序处理,手机端立即购买放在最后面
if(APPLICATION == 'app')
{
if(!empty($cart))
// 商品类型是否和当前站点类型一致
$cart = [];
$ret = self::IsGoodsSiteTypeConsistent($goods['id'], $goods['site_type']);
if($ret['code'] == 0)
{
$data[] = $cart;
// 加入购物车
$cart = [
'color' => 'second',
'type' => 'cart',
'title' => '加入购物车',
'name' => '加入购物车',
'class' => $class_name,
'icon' => 'am-icon-opencart',
];
} else {
$error = $ret['msg'];
}
$data[] = $buy;
} else {
$data[] = $buy;
if(!empty($cart))
// 主按钮顺序处理,手机端立即购买放在最后面
if(APPLICATION == 'app')
{
$data[] = $cart;
if(!empty($cart))
{
$data[] = $cart;
}
$data[] = $buy;
} else {
$data[] = $buy;
if(!empty($cart))
{
$data[] = $cart;
}
}
}
// 还有库存
if($goods['inventory'] <= 0)
{
$error = '没货了';
}
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册