/** * Page のアクション. * * @return void */ public function action() { parent::action(); //ヘッダーナビのカート情報を取得 $objCart = new SC_CartSession_Ex(); $cartKeys = $objCart->getKeys(); $arrInfo = SC_Helper_DB_Ex::sfGetBasisData(); $this->freeRule = $arrInfo['free_rule']; $this->arrCartList = $this->lfGetCartData($objCart, $arrInfo, $cartKeys); }
/** * Page のアクション. * * @return void */ function action() { // カートが空かどうかを確認する。 $objCartSess = new SC_CartSession_Ex(); $arrCartKeys = $objCartSess->getKeys(); $this->tpl_cart_empty = true; foreach ($arrCartKeys as $cart_key) { if (count($objCartSess->getCartList($cart_key)) > 0) { $this->tpl_cart_empty = false; break; } } // メインテンプレートを設定 if (CUSTOMER_CONFIRM_MAIL == true) { // 仮会員登録完了 $this->tpl_mainpage = 'entry/complete.tpl'; } else { // 本会員登録完了 SC_Response_Ex::sendRedirectFromUrlPath('regist/complete.php'); } }
/** * Page のアクション. * * @return void */ function action() { $objCartSess = new SC_CartSession_Ex(); $objSiteSess = new SC_SiteSession_Ex(); $objCustomer = new SC_Customer_Ex(); $objFormParam = $this->lfInitParam($_POST); $this->mode = $this->getMode(); // モバイル対応 if (SC_Display_Ex::detectDevice() == DEVICE_TYPE_MOBILE) { if (isset($_GET['cart_no'])) { $objFormParam->setValue('cart_no', $_GET['cart_no']); } if (isset($_GET['cartKey'])) { $objFormParam->setValue('cartKey', $_GET['cartKey']); } } $this->cartKeys = $objCartSess->getKeys(); foreach ($this->cartKeys as $key) { // 商品購入中にカート内容が変更された。 if ($objCartSess->getCancelPurchase($key)) { $this->tpl_message .= "商品購入中にカート内容が変更されましたので、お手数ですが購入手続きをやり直して下さい。\n"; } } $cart_no = $objFormParam->getValue('cart_no'); $cartKey = $objFormParam->getValue('cartKey'); // エラーチェック $arrError = $objFormParam->checkError(); if (isset($arrError) && !empty($arrError)) { SC_Utils_Ex::sfDispSiteError(CART_NOT_FOUND); SC_Response_Ex::actionExit(); } 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); SC_Response_Ex::actionExit(); } break; case 'up': //1個追加 $objCartSess->upQuantity($cart_no, $cartKey); SC_Response_Ex::reload(array('category_id' => $objFormParam->getValue('category_id')), true); SC_Response_Ex::actionExit(); break; case 'down': //1個減らす $objCartSess->downQuantity($cart_no, $cartKey); SC_Response_Ex::reload(array('category_id' => $objFormParam->getValue('category_id')), true); SC_Response_Ex::actionExit(); break; case 'setQuantity': //数量変更 $objCartSess->setQuantity($objFormParam->getValue('quantity'), $cart_no, $cartKey); SC_Response_Ex::reload(array('category_id' => $objFormParam->getValue('category_id')), true); SC_Response_Ex::actionExit(); break; case 'delete': //カートから削除 $objCartSess->delProduct($cart_no, $cartKey); SC_Response_Ex::reload(array('category_id' => $objFormParam->getValue('category_id')), true); SC_Response_Ex::actionExit(); break; default: break; } $this->arrInfo = SC_Helper_DB_Ex::sfGetBasisData(); $totalIncTax = 0; foreach ($this->cartKeys as $key) { // カート集計処理 $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]; } //商品の合計金額をセット $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'] : ''; // すべてのカートの内容を取得する $this->cartItems = $objCartSess->getAllCartList(); }
public function checkSessionPendingOrder() { if (!SC_Utils_Ex::isBlank($_SESSION['order_id'])) { $order_id = $_SESSION['order_id']; unset($_SESSION['order_id']); $objQuery =& SC_Query_Ex::getSingletonInstance(); $objQuery->begin(); $arrOrder = SC_Helper_Purchase_Ex::getOrder($order_id); if ($arrOrder['status'] == ORDER_PENDING) { $objCartSess = new SC_CartSession_Ex(); $cartKeys = $objCartSess->getKeys(); if (SC_Utils_Ex::isBlank($cartKeys)) { SC_Helper_Purchase_Ex::rollbackOrder($order_id, ORDER_CANCEL, true); GC_Utils_Ex::gfPrintLog('order rollback.(session pending) order_id=' . $order_id); } else { SC_Helper_Purchase_Ex::cancelOrder($order_id, ORDER_CANCEL, true); GC_Utils_Ex::gfPrintLog('order rollback.(session pending and set card) order_id=' . $order_id); } } $objQuery->commit(); } }