/** * 添加购物车 * * @param Request $request * @param Response $response */ public function cart_list(Request $request, Response $response) { $this->v->set_tplname('mod_trade_cart_list'); $this->nav_flag2 = 'cartlist'; $this->topnav_no = 1; // >0: 表示有topnav bar,具体值标识哪个topnav bar(有多个的情况下) if ($request->is_hashreq()) { $user_id = $GLOBALS['user']->ec_user_id; if (!$user_id) { $user_id = session_id(); } $cartGoods = Goods::getUserCart($user_id); $cartNum = Goods::getUserCartNum($user_id); $this->v->assign('cartGoods', $cartGoods); $this->v->assign('cartNum', intval($cartNum)); $this->v->assign('cartRecNum', count($cartGoods)); } else { $backurl = U('explore'); $this->v->assign('backurl', $backurl); } $response->send($this->v); }