/** * Page のアクション. * * @return void */ function action() { $objCartSess = new SC_CartSession_Ex(); $objSiteSess = new SC_SiteSession_Ex(); $objCustomer = new SC_Customer_Ex(); $objFormParam = $this->lfInitParam($_REQUEST); $this->mode = $this->getMode(); $this->cartKeys = $objCartSess->getKeys(); foreach ($this->cartKeys as $key) { // 商品購入中にカート内容が変更された。 if ($objCartSess->getCancelPurchase($key)) { $this->tpl_message = "商品購入中にカート内容が変更されましたので、お手数ですが購入手続きをやり直して下さい。"; } } $this->cartItems =& $objCartSess->getAllCartList(); $cart_no = $objFormParam->getValue('cart_no'); $cartKey = $objFormParam->getValue('cartKey'); switch ($this->mode) { case 'confirm': // カート内情報の取得 $cartList = $objCartSess->getCartList($cartKey); // カート商品が1件以上存在する場合 if (count($cartList) > 0) { // カートを購入モードに設定 $this->lfSetCurrentCart($objSiteSess, $objCartSess, $cartKey); // 購入ページへ SC_Response_Ex::sendRedirect(SHOPPING_URL); exit; } break; case 'up': //1個追加 $objCartSess->upQuantity($cart_no, $cartKey); SC_Response_Ex::reload(array('category_id' => $objFormParam->getValue('category_id')), true); exit; break; case 'down': //1個減らす $objCartSess->downQuantity($cart_no, $cartKey); SC_Response_Ex::reload(array('category_id' => $objFormParam->getValue('category_id')), true); exit; break; case 'setQuantity': //数量変更 $objCartSess->setQuantity($objFormParam->getValue('quantity'), $cart_no, $cartKey); SC_Response_Ex::reload(array('category_id' => $objFormParam->getValue('category_id')), true); exit; break; case 'delete': //カートから削除 $objCartSess->delProduct($cart_no, $cartKey); SC_Response_Ex::reload(array('category_id' => $objFormParam->getValue('category_id')), true); exit; break; default: break; } $this->arrInfo = SC_Helper_DB_Ex::sfGetBasisData(); $totalIncTax = 0; foreach (array_keys($this->cartKeys) as $index) { $key = $this->cartKeys[$index]; // カート集計処理 $this->tpl_message = $objCartSess->checkProducts($key); $this->tpl_total_inctax[$key] = $objCartSess->getAllProductsTotal($key); $totalIncTax += $this->tpl_total_inctax[$key]; $this->tpl_total_tax[$key] = $objCartSess->getAllProductsTax($key); // ポイント合計 $this->tpl_total_point[$key] = $objCartSess->getAllProductsPoint($key); $this->arrData[$key] = $objCartSess->calculate($key, $objCustomer); // 送料無料チェック $this->arrData[$key]['is_deliv_free'] = $objCartSess->isDelivFree($key); // 送料無料までの金額を計算 $this->tpl_deliv_free[$key] = $this->arrInfo['free_rule'] - $this->tpl_total_inctax[$key]; if (SC_Utils_Ex::isBlank($key)) { unset($this->cartKeys[$index]); } } //商品の合計金額をセット $this->tpl_all_total_inctax = $totalIncTax; $this->tpl_category_id = $objFormParam->getValue('category_id'); // ログイン判定 if ($objCustomer->isLoginSuccess(true)) { $this->tpl_login = true; $this->tpl_user_point = $objCustomer->getValue('point'); $this->tpl_name = $objCustomer->getValue('name01'); } // 前頁のURLを取得 // TODO: SC_CartSession::setPrevURL()利用不可。 $this->lfGetCartPrevUrl($_SESSION, $_SERVER['HTTP_REFERER']); $this->tpl_prev_url = isset($_SESSION['cart_prev_url']) ? $_SESSION['cart_prev_url'] : ''; }