mirror of
https://gitee.com/zongzhige/shopxo.git
synced 2024-12-02 03:48:47 +08:00
用户购物车总数新增钩子
This commit is contained in:
parent
029c29a4f5
commit
e59df0cca4
@ -81,14 +81,14 @@ class Buy extends Common
|
||||
// 参数
|
||||
$params = array_merge($this->data_request, $data);
|
||||
$params['user'] = $this->user;
|
||||
$buy_ret = BuyService::BuyTypeGoodsList($params);
|
||||
$ret = BuyService::BuyTypeGoodsList($params);
|
||||
|
||||
// 商品校验
|
||||
if(isset($buy_ret['code']) && $buy_ret['code'] == 0)
|
||||
if(isset($ret['code']) && $ret['code'] == 0)
|
||||
{
|
||||
// 基础信息
|
||||
$buy_base = $buy_ret['data']['base'];
|
||||
$buy_goods = $buy_ret['data']['goods'];
|
||||
$buy_base = $ret['data']['base'];
|
||||
$buy_goods = $ret['data']['goods'];
|
||||
|
||||
// 用户地址
|
||||
$address = UserAddressService::UserAddressList(['user'=>$this->user]);
|
||||
@ -112,7 +112,7 @@ class Buy extends Common
|
||||
MyViewAssign('is_load_baidu_map_api', 1);
|
||||
|
||||
// 钩子
|
||||
$this->PluginsHook($buy_ret['data'], $params);
|
||||
$this->PluginsHook($ret['data'], $params);
|
||||
|
||||
// 浏览器名称
|
||||
MyViewAssign('home_seo_site_title', SeoService::BrowserSeoTitle('订单确认', 1));
|
||||
|
@ -1687,8 +1687,22 @@ class BuyService
|
||||
return 0;
|
||||
}
|
||||
|
||||
// 获取购物车总数
|
||||
$total = self::CartTotal(['user_id'=>$params['user']['id']]);
|
||||
// 条件
|
||||
$where = [
|
||||
['user_id', '=', $params['user']['id']]
|
||||
];
|
||||
|
||||
// 购物车总数读取前钩子
|
||||
$hook_name = 'plugins_service_user_cart_total_begin';
|
||||
MyEventTrigger($hook_name, [
|
||||
'hook_name' => $hook_name,
|
||||
'is_backend' => true,
|
||||
'params' => $params,
|
||||
'where' => &$where,
|
||||
]);
|
||||
|
||||
|
||||
$total = self::CartTotal($where);
|
||||
return ($total > 99) ? '99+' : $total;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user