コード例 #1
0
 /**
  * Page のアクション.
  *
  * @return void
  */
 function action()
 {
     $objCartSess = new SC_CartSession_Ex();
     $objSiteSess = new SC_SiteSession_Ex();
     $objCustomer = new SC_Customer_Ex();
     $objPurchase = new SC_Helper_Purchase_Ex();
     $objHelperMail = new SC_Helper_Mail_Ex();
     $this->is_multiple = $objPurchase->isMultiple();
     // 前のページで正しく登録手続きが行われた記録があるか判定
     if (!$objSiteSess->isPrePage()) {
         SC_Utils_Ex::sfDispSiteError(PAGE_ERROR, $objSiteSess);
     }
     // ユーザユニークIDの取得と購入状態の正当性をチェック
     $this->tpl_uniqid = $objSiteSess->getUniqId();
     $objPurchase->verifyChangeCart($this->tpl_uniqid, $objCartSess);
     $this->cartKey = $objCartSess->getKey();
     // カート内商品のチェック
     $this->tpl_message = $objCartSess->checkProducts($this->cartKey);
     if (!SC_Utils_Ex::isBlank($this->tpl_message)) {
         SC_Response_Ex::sendRedirect(CART_URLPATH);
         SC_Response_Ex::actionExit();
     }
     // カートの商品を取得
     $this->arrShipping = $objPurchase->getShippingTemp($this->is_multiple);
     $this->arrCartItems = $objCartSess->getCartList($this->cartKey);
     // 合計金額
     $this->tpl_total_inctax[$this->cartKey] = $objCartSess->getAllProductsTotal($this->cartKey);
     // 税額
     $this->tpl_total_tax[$this->cartKey] = $objCartSess->getAllProductsTax($this->cartKey);
     // ポイント合計
     $this->tpl_total_point[$this->cartKey] = $objCartSess->getAllProductsPoint($this->cartKey);
     // 一時受注テーブルの読込
     $arrOrderTemp = $objPurchase->getOrderTemp($this->tpl_uniqid);
     // カート集計を元に最終計算
     $arrCalcResults = $objCartSess->calculate($this->cartKey, $objCustomer, $arrOrderTemp['use_point'], $objPurchase->getShippingPref($this->is_multiple), $arrOrderTemp['charge'], $arrOrderTemp['discount'], $arrOrderTemp['deliv_id']);
     $this->arrForm = array_merge($arrOrderTemp, $arrCalcResults);
     // 会員ログインチェック
     if ($objCustomer->isLoginSuccess(true)) {
         $this->tpl_login = '******';
         $this->tpl_user_point = $objCustomer->getValue('point');
     }
     // 決済モジュールを使用するかどうか
     $this->use_module = SC_Helper_Payment_Ex::useModule($this->arrForm['payment_id']);
     switch ($this->getMode()) {
         // 前のページに戻る
         case 'return':
             // 正常な推移であることを記録しておく
             $objSiteSess->setRegistFlag();
             SC_Response_Ex::sendRedirect(SHOPPING_PAYMENT_URLPATH);
             SC_Response_Ex::actionExit();
             break;
         case 'confirm':
             /*
              * 決済モジュールで必要なため, 受注番号を取得
              */
             $this->arrForm['order_id'] = $objPurchase->getNextOrderID();
             $_SESSION['order_id'] = $this->arrForm['order_id'];
             // 集計結果を受注一時テーブルに反映
             $objPurchase->saveOrderTemp($this->tpl_uniqid, $this->arrForm, $objCustomer);
             // 正常に登録されたことを記録しておく
             $objSiteSess->setRegistFlag();
             // 決済モジュールを使用する場合
             if ($this->use_module) {
                 $objPurchase->completeOrder(ORDER_PENDING);
                 SC_Response_Ex::sendRedirect(SHOPPING_MODULE_URLPATH);
             } else {
                 $objPurchase->completeOrder(ORDER_NEW);
                 $template_id = SC_Display_Ex::detectDevice() == DEVICE_TYPE_MOBILE ? 2 : 1;
                 $objHelperMail->sfSendOrderMail($this->arrForm['order_id'], $template_id);
                 SC_Response_Ex::sendRedirect(SHOPPING_COMPLETE_URLPATH);
             }
             SC_Response_Ex::actionExit();
             break;
         default:
             break;
     }
 }
コード例 #2
0
 /**
  * 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);
 }
コード例 #3
0
 /**
  * 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;
     // 会員の住所をカウントしない
 }
コード例 #4
0
 /**
  * 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);
 }