/** * Page のプロセス. * * @return void */ function action() { $objSiteSess = new SC_SiteSession_Ex(); $objCartSess = new SC_CartSession_Ex(); $objPurchase = new SC_Helper_Purchase_Ex(); $objCustomer = new SC_Customer_Ex(); $objFormParam = new SC_FormParam_Ex(); $this->tpl_uniqid = $objSiteSess->getUniqId(); $this->addrs = $this->getDelivAddrs($objCustomer, $objPurchase, $this->tpl_uniqid); $this->tpl_addrmax = count($this->addrs); $this->lfInitParam($objFormParam); $objPurchase->verifyChangeCart($this->tpl_uniqid, $objCartSess); switch ($this->getMode()) { case 'confirm': $objFormParam->setParam($_POST); $this->arrErr = $this->lfCheckError($objFormParam); if (SC_Utils_Ex::isBlank($this->arrErr)) { // フォームの情報を一時保存しておく $_SESSION['multiple_temp'] = $objFormParam->getHashArray(); $this->saveMultipleShippings($this->tpl_uniqid, $objFormParam, $objCustomer, $objPurchase, $objCartSess); $objSiteSess->setRegistFlag(); SC_Response_Ex::sendRedirect("payment.php"); exit; } break; default: $this->setParamToSplitItems($objFormParam, $objCartSess); } // 前のページから戻ってきた場合 if ($_GET['from'] == 'multiple') { $objFormParam->setParam($_SESSION['multiple_temp']); } $this->arrForm = $objFormParam->getFormParamList(); }
/** * Page のアクション. * * @return void */ function action() { $objSiteSess = new SC_SiteSession_Ex(); $objCartSess = new SC_CartSession_Ex(); $objPurchase = new SC_Helper_Purchase_Ex(); $objCustomer = new SC_Customer_Ex(); $objFormParam = new SC_FormParam_Ex(); $this->is_multiple = $objPurchase->isMultiple(); // カートの情報を取得 $this->arrShipping = $objPurchase->getShippingTemp($this->is_multiple); $this->tpl_uniqid = $objSiteSess->getUniqId(); $cart_key = $objCartSess->getKey(); $this->cartKey = $cart_key; $objPurchase->verifyChangeCart($this->tpl_uniqid, $objCartSess); // 配送業者を取得 $this->arrDeliv = $objPurchase->getDeliv($cart_key); $this->is_single_deliv = $this->isSingleDeliv($this->arrDeliv); // 会員情報の取得 if ($objCustomer->isLoginSuccess(true)) { $this->tpl_login = '******'; $this->tpl_user_point = $objCustomer->getValue('point'); $this->name01 = $objCustomer->getValue('name01'); $this->name02 = $objCustomer->getValue('name02'); } // 戻り URL の設定 // @deprecated 2.12.0 テンプレート直書きに戻した $this->tpl_back_url = '?mode=return'; $arrOrderTemp = $objPurchase->getOrderTemp($this->tpl_uniqid); // 正常に受注情報が格納されていない場合はカート画面へ戻す if (SC_Utils_Ex::isBlank($arrOrderTemp)) { SC_Response_Ex::sendRedirect(CART_URLPATH); SC_Response_Ex::actionExit(); } // カート内商品の妥当性チェック $this->tpl_message = $objCartSess->checkProducts($cart_key); if (strlen($this->tpl_message) >= 1) { SC_Response_Ex::sendRedirect(CART_URLPATH); SC_Response_Ex::actionExit(); } /* * 購入金額の取得 * ここでは送料を加算しない */ $this->arrPrices = $objCartSess->calculate($cart_key, $objCustomer); // お届け日一覧の取得 $this->arrDelivDate = $objPurchase->getDelivDate($objCartSess, $cart_key); switch ($this->getMode()) { /* * 配送業者選択時のアクション * モバイル端末以外の場合は, JSON 形式のデータを出力し, ajax で取得する. */ case 'select_deliv': $this->setFormParams($objFormParam, $arrOrderTemp, true, $this->arrShipping); $objFormParam->setParam($_POST); $this->arrErr = $objFormParam->checkError(); if (SC_Utils_Ex::isBlank($this->arrErr)) { $deliv_id = $objFormParam->getValue('deliv_id'); $arrSelectedDeliv = $this->getSelectedDeliv($objPurchase, $objCartSess, $deliv_id); $arrSelectedDeliv['error'] = false; } else { $arrSelectedDeliv = array('error' => true); $this->tpl_mainpage = 'shopping/select_deliv.tpl'; // モバイル用 } if (SC_Display_Ex::detectDevice() != DEVICE_TYPE_MOBILE) { echo SC_Utils_Ex::jsonEncode($arrSelectedDeliv); SC_Response_Ex::actionExit(); } else { $this->arrPayment = $arrSelectedDeliv['arrPayment']; $this->arrDelivTime = $arrSelectedDeliv['arrDelivTime']; } break; // 登録処理 // 登録処理 case 'confirm': // パラメーター情報の初期化 $this->setFormParams($objFormParam, $_POST, false, $this->arrShipping); $deliv_id = $objFormParam->getValue('deliv_id'); $arrSelectedDeliv = $this->getSelectedDeliv($objPurchase, $objCartSess, $deliv_id); $this->arrPayment = $arrSelectedDeliv['arrPayment']; $this->arrDelivTime = $arrSelectedDeliv['arrDelivTime']; $this->img_show = $arrSelectedDeliv['img_show']; $this->arrErr = $this->lfCheckError($objFormParam, $this->arrPrices['subtotal'], $this->tpl_user_point); if (empty($this->arrErr)) { $this->saveShippings($objFormParam, $this->arrDelivTime); $this->lfRegistData($this->tpl_uniqid, $objFormParam->getDbArray(), $objPurchase, $this->arrPayment); // 正常に登録されたことを記録しておく $objSiteSess->setRegistFlag(); // 確認ページへ移動 SC_Response_Ex::sendRedirect(SHOPPING_CONFIRM_URLPATH); SC_Response_Ex::actionExit(); } break; // 前のページに戻る // 前のページに戻る case 'return': // 正常な推移であることを記録しておく $objSiteSess->setRegistFlag(); $url = null; if ($this->is_multiple) { $url = MULTIPLE_URLPATH . '?from=multiple'; } elseif ($objCustomer->isLoginSuccess(true)) { if ($product_type_id == PRODUCT_TYPE_DOWNLOAD) { $url = CART_URLPATH; } else { $url = DELIV_URLPATH; } } else { $url = SHOPPING_URL . '?from=nonmember'; } SC_Response_Ex::sendRedirect($url); SC_Response_Ex::actionExit(); break; default: // FIXME 前のページから戻ってきた場合は別パラメーター(mode)で処理分岐する必要があるのかもしれない $this->setFormParams($objFormParam, $arrOrderTemp, false, $this->arrShipping); if (!$this->is_single_deliv) { $deliv_id = $objFormParam->getValue('deliv_id'); } else { $deliv_id = $this->arrDeliv[0]['deliv_id']; } if (!SC_Utils_Ex::isBlank($deliv_id)) { $objFormParam->setValue('deliv_id', $deliv_id); $arrSelectedDeliv = $this->getSelectedDeliv($objPurchase, $objCartSess, $deliv_id); $this->arrPayment = $arrSelectedDeliv['arrPayment']; $this->arrDelivTime = $arrSelectedDeliv['arrDelivTime']; $this->img_show = $arrSelectedDeliv['img_show']; } break; } // モバイル用 ポストバック処理 if (SC_Display_Ex::detectDevice() == DEVICE_TYPE_MOBILE && SC_Utils_Ex::isBlank($this->arrErr)) { $this->tpl_mainpage = $this->getMobileMainpage($this->is_single_deliv, $this->getMode()); } $this->arrForm = $objFormParam->getFormParamList(); }
/** * 受注をキャンセルし, カートをロールバックして, 受注一時IDを返す. * * 受注完了後の受注をキャンセルし, カートの状態を受注前の状態へ戻す. * この関数は, 主に, 決済モジュールに遷移した後, 購入確認画面へ戻る場合に使用する. * * 対応状況を引数 $orderStatus で指定した値に変更する. * (デフォルト ORDER_CANCEL) * 引数 $is_delete が true の場合は, 受注データを論理削除する. * 商品の在庫数, カートの内容は受注前の状態に戻される. * * @param integer $order_id 受注ID * @param integer $orderStatus 対応状況 * @param boolean $is_delete 受注データを論理削除する場合 true * @return string 受注一時ID */ public function rollbackOrder($order_id, $orderStatus = ORDER_CANCEL, $is_delete = false) { $objQuery =& SC_Query_Ex::getSingletonInstance(); $in_transaction = $objQuery->inTransaction(); if (!$in_transaction) { $objQuery->begin(); } $this->cancelOrder($order_id, $orderStatus, $is_delete); $arrOrderTemp = $this->getOrderTempByOrderId($order_id); $_SESSION = array_merge($_SESSION, unserialize($arrOrderTemp['session'])); $objSiteSession = new SC_SiteSession_Ex(); $objCartSession = new SC_CartSession_Ex(); $objCustomer = new SC_Customer_Ex(); // 新たに受注一時情報を保存する $objSiteSession->unsetUniqId(); $uniqid = $objSiteSession->getUniqId(); $arrOrderTemp['del_flg'] = 0; $this->saveOrderTemp($uniqid, $arrOrderTemp, $objCustomer); $this->verifyChangeCart($uniqid, $objCartSession); $objSiteSession->setRegistFlag(); if (!$in_transaction) { $objQuery->commit(); } return $uniqid; }
/** * Page のプロセス. * * @return void */ public function action() { //決済処理中ステータスのロールバック $objPurchase = new SC_Helper_Purchase_Ex(); $objPurchase->cancelPendingOrder(PENDING_ORDER_CANCEL_FLAG); $objSiteSess = new SC_SiteSession_Ex(); $objCartSess = new SC_CartSession_Ex(); $objCustomer = new SC_Customer_Ex(); $objFormParam = new SC_FormParam_Ex(); $objAddress = new SC_Helper_Address_Ex(); // 複数配送先指定が無効な場合はエラー if (USE_MULTIPLE_SHIPPING === false) { SC_Utils_Ex::sfDispSiteError(PAGE_ERROR, '', true); SC_Response_Ex::actionExit(); } $this->tpl_uniqid = $objSiteSess->getUniqId(); $this->addrs = $this->getDelivAddrs($objCustomer, $objPurchase, $objAddress); $this->tpl_addrmax = count($this->addrs) - 2; // 「選択してください」と会員の住所をカウントしない $this->lfInitParam($objFormParam); $objPurchase->verifyChangeCart($this->tpl_uniqid, $objCartSess); switch ($this->getMode()) { case 'confirm': $objFormParam->setParam($_POST); $this->arrErr = $this->lfCheckError($objFormParam); if (SC_Utils_Ex::isBlank($this->arrErr)) { // フォームの情報を一時保存しておく $_SESSION['multiple_temp'] = $objFormParam->getHashArray(); $this->saveMultipleShippings($this->tpl_uniqid, $objFormParam, $objCustomer, $objPurchase, $objAddress); $objSiteSess->setRegistFlag(); SC_Response_Ex::sendRedirect('payment.php'); SC_Response_Ex::actionExit(); } break; default: $this->setParamToSplitItems($objFormParam, $objCartSess); } // 前のページから戻ってきた場合 if ($_GET['from'] == 'multiple') { $objFormParam->setParam($_SESSION['multiple_temp']); } $this->arrForm = $objFormParam->getFormParamList(); }
/** * カートを購入モードに設定 * * @param SC_SiteSession_Ex $objSiteSess * @param SC_CartSession_Ex $objCartSess * @return void */ public function lfSetCurrentCart(&$objSiteSess, &$objCartSess, $cartKey) { // 正常に登録されたことを記録しておく $objSiteSess->setRegistFlag(); $pre_uniqid = $objSiteSess->getUniqId(); // 注文一時IDの発行 $objSiteSess->setUniqId(); $uniqid = $objSiteSess->getUniqId(); // エラーリトライなどで既にuniqidが存在する場合は、設定を引き継ぐ if ($pre_uniqid != '') { $this->lfUpdateOrderTempid($pre_uniqid, $uniqid); } // カートを購入モードに設定 $objCartSess->registerKey($cartKey); $objCartSess->saveCurrentCart($uniqid, $cartKey); }
/** * Page のプロセス. * * @return void */ public function action() { //決済処理中ステータスのロールバック $objPurchase = new SC_Helper_Purchase_Ex(); $objPurchase->cancelPendingOrder(PENDING_ORDER_CANCEL_FLAG); $objSiteSess = new SC_SiteSession_Ex(); $objCartSess = new SC_CartSession_Ex(); $objCustomer = new SC_Customer_Ex(); $objFormParam = new SC_FormParam_Ex(); $objAddress = new SC_Helper_Address_Ex(); $this->tpl_uniqid = $objSiteSess->getUniqId(); $objPurchase->verifyChangeCart($this->tpl_uniqid, $objCartSess); $this->cartKey = $objCartSess->getKey(); // ログインチェック if (!$objCustomer->isLoginSuccess(true)) { SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR); } // ダウンロード商品の場合は、支払方法画面に転送 if ($this->cartKey == PRODUCT_TYPE_DOWNLOAD) { $objPurchase->copyFromCustomer($sqlval, $objCustomer, 'shipping'); $objPurchase->saveShippingTemp($sqlval); $objPurchase->saveOrderTemp($this->tpl_uniqid, $sqlval, $objCustomer); $objSiteSess->setRegistFlag(); SC_Response_Ex::sendRedirect('payment.php'); SC_Response_Ex::actionExit(); } $this->lfInitParam($objFormParam); $objFormParam->setParam($_POST); $objFormParam->convParam(); $arrErr = $objFormParam->checkError(); if (!SC_Utils_Ex::isBlank($arrErr)) { SC_Utils_Ex::sfDispSiteError(PAGE_ERROR, '', true); SC_Response_Ex::actionExit(); } $arrForm = $objFormParam->getHashArray(); switch ($this->getMode()) { // 削除 case 'delete': if (!$objAddress->deleteAddress($arrForm['other_deliv_id'], $objCustomer->getValue('customer_id'))) { SC_Utils_Ex::sfDispSiteError(FREE_ERROR_MSG, '', false, '別のお届け先を削除できませんでした。'); SC_Response_Ex::actionExit(); } break; // 会員登録住所に送る // 会員登録住所に送る case 'customer_addr': $objPurchase->unsetShippingTemp(); $shipping_id = $arrForm['deliv_check'] == -1 ? 0 : $arrForm['deliv_check']; $success = $this->registerDeliv($shipping_id, $this->tpl_uniqid, $objPurchase, $objCustomer, $objAddress); if (!$success) { SC_Utils_Ex::sfDispSiteError(PAGE_ERROR, '', true); } $objPurchase->setShipmentItemTempForSole($objCartSess, $shipping_id); $objSiteSess->setRegistFlag(); SC_Response_Ex::sendRedirect(SHOPPING_PAYMENT_URLPATH); SC_Response_Ex::actionExit(); break; // 前のページに戻る // 前のページに戻る case 'return': // 確認ページへ移動 SC_Response_Ex::sendRedirect(CART_URL); SC_Response_Ex::actionExit(); break; // お届け先複数指定 // お届け先複数指定 case 'multiple': // 複数配送先指定が無効な場合はエラー if (USE_MULTIPLE_SHIPPING === false) { SC_Utils_Ex::sfDispSiteError(PAGE_ERROR, '', true); SC_Response_Ex::actionExit(); } SC_Response_Ex::sendRedirect('multiple.php'); SC_Response_Ex::actionExit(); break; default: // 配送IDの取得 $shippingData = $objPurchase->getShippingTemp(); if (!SC_Utils_Ex::isBlank($shippingData)) { $arrShippingId = array_keys($shippingData); } if (isset($arrShippingId[0])) { $this->arrForm['deliv_check']['value'] = $arrShippingId[0] == 0 ? -1 : $arrShippingId[0]; } break; } // 登録済み住所を取得 $addr = array(array('other_deliv_id' => NULL, 'customer_id' => $objCustomer->getValue('customer_id'), 'name01' => $objCustomer->getValue('name01'), 'name02' => $objCustomer->getValue('name02'), 'kana01' => $objCustomer->getValue('kana01'), 'kana02' => $objCustomer->getValue('kana02'), 'company_name' => $objCustomer->getValue('company_name'), 'country_id' => $objCustomer->getValue('country_id'), 'zipcode' => $objCustomer->getValue('zipcode'), 'zip01' => $objCustomer->getValue('zip01'), 'zip02' => $objCustomer->getValue('zip02'), 'pref' => $objCustomer->getValue('pref'), 'addr01' => $objCustomer->getValue('addr01'), 'addr02' => $objCustomer->getValue('addr02'), 'tel01' => $objCustomer->getValue('tel01'), 'tel02' => $objCustomer->getValue('tel02'), 'tel03' => $objCustomer->getValue('tel03'))); $this->arrAddr = array_merge($addr, $objAddress->getList($objCustomer->getValue('customer_id'))); $this->tpl_addrmax = count($this->arrAddr) - 1; // 会員の住所をカウントしない }
/** * Page のプロセス. * * @return void */ function action() { $objSiteSess = new SC_SiteSession_Ex(); $objCartSess = new SC_CartSession_Ex(); $objCustomer = new SC_Customer_Ex(); $objPurchase = new SC_Helper_Purchase_Ex(); $objFormParam = new SC_FormParam_Ex(); $this->tpl_uniqid = $objSiteSess->getUniqId(); $objPurchase->verifyChangeCart($this->tpl_uniqid, $objCartSess); $this->cartKey = $objCartSess->getKey(); // ログインチェック if (!$objCustomer->isLoginSuccess(true)) { SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR); } // ダウンロード商品の場合は、支払方法画面に転送 if ($this->cartKey == PRODUCT_TYPE_DOWNLOAD) { $objPurchase->copyFromCustomer($sqlval, $objCustomer, 'shipping'); $objPurchase->saveShippingTemp($sqlval); $objPurchase->saveOrderTemp($this->tpl_uniqid, $sqlval, $objCustomer); $objSiteSess->setRegistFlag(); SC_Response_Ex::sendRedirect('payment.php'); SC_Response_Ex::actionExit(); } $this->lfInitParam($objFormParam); $objFormParam->setParam($_POST); $objFormParam->convParam(); $arrErr = $objFormParam->checkError(); if (!SC_Utils_Ex::isBlank($arrErr)) { SC_Utils_Ex::sfDispSiteError(PAGE_ERROR, '', true); SC_Response_Ex::actionExit(); } $arrForm = $objFormParam->getHashArray(); switch ($this->getMode()) { // 削除 case 'delete': $this->doDelete($arrForm['other_deliv_id']); break; // 会員登録住所に送る // 会員登録住所に送る case 'customer_addr': $objPurchase->unsetShippingTemp(); $shipping_id = $arrForm['deliv_check'] == -1 ? 0 : $arrForm['deliv_check']; $success = $this->registerDeliv($shipping_id, $this->tpl_uniqid, $objPurchase, $objCustomer); if (!$success) { SC_Utils_Ex::sfDispSiteError(PAGE_ERROR, '', true); } $objPurchase->setShipmentItemTempForSole($objCartSess, $shipping_id); $objSiteSess->setRegistFlag(); SC_Response_Ex::sendRedirect(SHOPPING_PAYMENT_URLPATH); SC_Response_Ex::actionExit(); break; // 前のページに戻る // 前のページに戻る case 'return': // 確認ページへ移動 SC_Response_Ex::sendRedirect(CART_URLPATH); SC_Response_Ex::actionExit(); break; // お届け先複数指定 // お届け先複数指定 case 'multiple': // 複数配送先指定が無効な場合はエラー if (USE_MULTIPLE_SHIPPING === false) { SC_Utils_Ex::sfDispSiteError(PAGE_ERROR, '', true); SC_Response_Ex::actionExit(); } SC_Response_Ex::sendRedirect('multiple.php'); SC_Response_Ex::actionExit(); break; default: // 配送IDの取得 $shippingData = $objPurchase->getShippingTemp(); $arrShippingId = array_keys($shippingData); if (isset($arrShippingId[0])) { $this->arrForm['deliv_check']['value'] = $arrShippingId[0] == 0 ? -1 : $arrShippingId[0]; } break; } // 登録済み住所を取得 $this->arrAddr = $objCustomer->getCustomerAddress($objCustomer->getValue('customer_id')); $this->tpl_addrmax = count($this->arrAddr); }
/** * Page のプロセス. * * @return void */ function action() { $objSiteSess = new SC_SiteSession_Ex(); $objCartSess = new SC_CartSession_Ex(); $objCustomer = new SC_Customer_Ex(); $objPurchase = new SC_Helper_Purchase_Ex(); $objFormParam = new SC_FormParam_Ex(); $objCookie = new SC_Cookie_Ex(COOKIE_EXPIRE); $this->tpl_uniqid = $objSiteSess->getUniqId(); $objPurchase->verifyChangeCart($this->tpl_uniqid, $objCartSess); $this->cartKey = $objCartSess->getKey(); // ログインチェック if (!$objCustomer->isLoginSuccess(true)) { SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR); } // ダウンロード商品の場合は、支払方法画面に転送 if ($this->cartKey == PRODUCT_TYPE_DOWNLOAD) { $objPurchase->copyFromCustomer($sqlval, $objCustomer, 'shipping'); $objPurchase->saveShippingTemp($sqlval); $objPurchase->saveOrderTemp($this->tpl_uniqid, $sqlval, $objCustomer); $objSiteSess->setRegistFlag(); SC_Response_Ex::sendRedirect('payment.php'); exit; } $this->lfInitParam($objFormParam); $objFormParam->setParam($_POST); $objFormParam->convParam(); $arrErr = $objFormParam->checkError(); if (!SC_Utils_Ex::isBlank($arrErr)) { SC_Utils_Ex::sfDispSiteError(PAGE_ERROR, "", true); exit; } $arrForm = $objFormParam->getHashArray(); switch ($this->getMode()) { // 削除 case 'delete': $this->doDelete($arrForm['other_deliv_id']); break; // 会員登録住所に送る // 会員登録住所に送る case 'customer_addr': $objPurchase->unsetShippingTemp(); if ($this->registerDeliv($arrForm['deliv_check'], $this->tpl_uniqid, $objPurchase, $objCustomer)) { $objSiteSess->setRegistFlag(); SC_Response_Ex::sendRedirect(SHOPPING_PAYMENT_URLPATH); exit; } else { SC_Utils_Ex::sfDispSiteError(PAGE_ERROR, "", true); } break; // 前のページに戻る // 前のページに戻る case 'return': // 確認ページへ移動 SC_Response_Ex::sendRedirect(CART_URLPATH); exit; break; // お届け先複数指定 // お届け先複数指定 case 'multiple': SC_Response_Ex::sendRedirect('multiple.php'); exit; break; } // 登録済み住所を取得 $this->arrAddr = $objCustomer->getCustomerAddress($objCustomer->getValue('customer_id')); $this->tpl_addrmax = count($this->arrAddr); }