コード例 #1
0
 /**
  * Page のプロセス.
  *
  * @return void
  */
 function process()
 {
     global $objCampaignSess;
     $conn = new SC_DBConn();
     $objView = new SC_SiteView();
     $objSiteSess = new SC_SiteSession();
     $objCartSess = new SC_CartSession();
     $objCampaignSess = new SC_CampaignSession();
     $objCustomer = new SC_Customer();
     $objCookie = new SC_Cookie();
     $objDb = new SC_Helper_DB_Ex();
     $this->objFormParam = new SC_FormParam();
     // フォーム用
     $this->lfInitParam();
     // パラメータ情報の初期化
     $this->objFormParam->setParam($_POST);
     // POST値の取得
     // ユーザユニークIDの取得と購入状態の正当性をチェック
     $uniqid = SC_Utils_Ex::sfCheckNormalAccess($objSiteSess, $objCartSess);
     $this->tpl_uniqid = $uniqid;
     //ダウンロード商品判定
     $this->cartdown = $objDb->chkCartDown($objCartSess);
     // ログインチェック
     if ($objCustomer->isLoginSuccess()) {
         if ($this->cartdown == 2) {
             // 会員情報の住所を受注一時テーブルに書き込む
             $objDb->sfRegistDelivData($uniqid, $objCustomer);
             // 正常に登録されたことを記録しておく
             $objSiteSess->setRegistFlag();
             // ダウンロード商品有りの場合は、支払方法画面に転送
             $this->sendRedirect($this->getLocation("./payment.php"), array());
             exit;
         }
         // すでにログインされている場合は、お届け先設定画面に転送
         $this->sendRedirect($this->getLocation("./deliv.php"), array());
         exit;
     }
     if ($_SERVER["REQUEST_METHOD"] == "POST") {
         if (!$this->isValidToken()) {
             SC_Utils_Ex::sfDispSiteError(PAGE_ERROR, "", true);
         }
     }
     if (!isset($_POST['mode'])) {
         $_POST['mode'] = "";
     }
     switch ($_POST['mode']) {
         case 'nonmember_confirm':
             $this->lfSetNonMember($this);
             // ※breakなし
         // ※breakなし
         case 'confirm':
             // 入力値の変換
             $this->objFormParam->convParam();
             $this->objFormParam->toLower('order_mail');
             $this->objFormParam->toLower('order_mail_check');
             $this->arrErr = $this->lfCheckError();
             // 入力エラーなし
             if (count($this->arrErr) == 0) {
                 // DBへのデータ登録
                 $this->lfRegistData($uniqid);
                 // お届け先のコピー
                 $this->lfCopyDeliv($uniqid, $_POST);
                 // 正常に登録されたことを記録しておく
                 $objSiteSess->setRegistFlag();
                 // お支払い方法選択ページへ移動
                 $this->sendRedirect($this->getLocation(URL_SHOP_PAYMENT));
                 exit;
             }
             break;
             // 前のページに戻る
         // 前のページに戻る
         case 'return':
             // 確認ページへ移動
             $this->sendRedirect($this->getLocation(URL_CART_TOP));
             exit;
             break;
         case 'nonmember':
             $this->lfSetNonMember($this);
             //非会員のダウンロード商品を含んだ買い物はNG
             if ($this->cartdown != 0) {
                 SC_Utils_Ex::sfDispSiteError(FREE_ERROR_MSG, $objSiteSess, false, "ダウンロード商品を含むお買い物は、会員登録が必要です。<br/>お手数ですが、会員登録をお願いします。");
             }
             // ※breakなし
         // ※breakなし
         default:
             if (isset($_GET['from']) && $_GET['from'] == 'nonmember') {
                 $this->lfSetNonMember($this);
             }
             // ユーザユニークIDの取得
             $uniqid = $objSiteSess->getUniqId();
             $objQuery = new SC_Query();
             $where = "order_temp_id = ?";
             $arrRet = $objQuery->select("*", "dtb_order_temp", $where, array($uniqid));
             if (empty($arrRet)) {
                 $arrRet = array(array('order_email' => "", 'order_birth' => ""));
             }
             // DB値の取得
             $this->objFormParam->setParam($arrRet[0]);
             $this->objFormParam->setValue('order_email_check', $arrRet[0]['order_email']);
             $this->objFormParam->setDBDate($arrRet[0]['order_birth']);
             break;
     }
     // クッキー判定
     $this->tpl_login_email = $objCookie->getCookie('login_email');
     if ($this->tpl_login_email != "") {
         $this->tpl_login_memory = "1";
     }
     // 選択用日付の取得
     $objDate = new SC_Date(START_BIRTH_YEAR);
     $this->arrYear = $objDate->getYear('', 1950);
     // 日付プルダウン設定
     $this->arrMonth = $objDate->getMonth();
     $this->arrDay = $objDate->getDay();
     if ($this->year == '') {
         $this->year = '----';
     }
     // 入力値の取得
     $this->arrForm = $this->objFormParam->getFormParamList();
     if (empty($this->arrForm['year']['value'])) {
         $this->arrForm['year']['value'] = '----';
     }
     $this->transactionid = $this->getToken();
     $objView->assignobj($this);
     // フレームを選択(キャンペーンページから遷移なら変更)
     $objCampaignSess->pageView($objView);
 }
コード例 #2
0
 /**
  * Page のプロセス.
  *
  * @return void
  */
 function process()
 {
     global $objCampaignSess;
     $objView = new SC_SiteView();
     $objSiteSess = new SC_SiteSession();
     $objCartSess = new SC_CartSession();
     $objCampaignSess = new SC_CampaignSession();
     $objDb = new SC_Helper_DB_Ex();
     $this->objCustomer = new SC_Customer();
     $objSiteInfo = $objView->objSiteInfo;
     $arrInfo = $objSiteInfo->data;
     // パラメータ管理クラス
     $this->objFormParam = new SC_FormParam();
     // パラメータ情報の初期化
     $this->lfInitParam();
     // POST値の取得
     $this->objFormParam->setParam($_POST);
     // ユーザユニークIDの取得と購入状態の正当性をチェック
     $uniqid = SC_Utils_Ex::sfCheckNormalAccess($objSiteSess, $objCartSess);
     // ユニークIDを引き継ぐ
     $this->tpl_uniqid = $uniqid;
     //ダウンロード商品判定
     $this->cartdown = $objDb->chkCartDown($objCartSess);
     // 会員ログインチェック
     if ($this->objCustomer->isLoginSuccess()) {
         $this->tpl_login = '******';
         $this->tpl_user_point = $this->objCustomer->getValue('point');
         //戻り先URL
         if ($this->cartdown == 2) {
             // ダウンロード商品のみの場合は、カート画面に戻る
             $this->tpl_back_url = URL_CART_TOP;
         } else {
             $this->tpl_back_url = URL_DELIV_TOP;
         }
     } else {
         $this->tpl_back_url = URL_SHOP_TOP . "?from=nonmember";
     }
     // 金額の取得 (購入途中で売り切れた場合にはこの関数内にてその商品の個数が0になる)
     $objDb->sfTotalCart($this, $objCartSess, $arrInfo);
     if (empty($arrData)) {
         $arrData = array();
     }
     $this->arrData = $objDb->sfTotalConfirm($arrData, $this, $objCartSess, $arrInfo);
     // カート内の商品の売り切れチェック
     $objCartSess->chkSoldOut($objCartSess->getCartList());
     if (!isset($_POST['mode'])) {
         $_POST['mode'] = "";
     }
     switch ($_POST['mode']) {
         case 'confirm':
             // 入力値の変換
             $this->objFormParam->convParam();
             $this->arrErr = $this->lfCheckError($this->arrData);
             // 入力エラーなし
             if (count($this->arrErr) == 0) {
                 // DBへのデータ登録
                 $this->lfRegistData($uniqid);
                 // 正常に登録されたことを記録しておく
                 $objSiteSess->setRegistFlag();
                 // 確認ページへ移動
                 $this->sendRedirect($this->getLocation(URL_SHOP_CONFIRM, array(), true));
                 exit;
             } else {
                 // ユーザユニークIDの取得
                 $uniqid = $objSiteSess->getUniqId();
                 // 受注一時テーブルからの情報を格納
                 $this->lfSetOrderTempData($uniqid);
             }
             break;
             // 前のページに戻る
         // 前のページに戻る
         case 'return':
             // 非会員の場合
             // 正常な推移であることを記録しておく
             $objSiteSess->setRegistFlag();
             $this->sendRedirect(URL_SHOP_TOP);
             exit;
             break;
             // 支払い方法が変更された場合
         // 支払い方法が変更された場合
         case 'payment':
             // ここのbreakは、意味があるので外さないで下さい。
             break;
         default:
             // 受注一時テーブルからの情報を格納
             $this->lfSetOrderTempData($uniqid);
             break;
     }
     // 店舗情報の取得
     $arrInfo = $objSiteInfo->data;
     // 購入金額の取得得
     $total_pretax = $objCartSess->getAllProductsTotal($arrInfo);
     // 支払い方法の取得
     $this->arrPayment = $this->lfGetPayment($total_pretax);
     // 支払い方法の画像があるなしを取得($img_show true:ある false:なし)
     $this->img_show = $this->lfGetImgShow($this->arrPayment);
     // 配送時間の取得
     $arrRet = $objDb->sfGetDelivTime($this->objFormParam->getValue('payment_id'));
     $this->arrDelivTime = SC_Utils_Ex::sfArrKeyValue($arrRet, 'time_id', 'deliv_time');
     // 配送日一覧の取得
     $this->arrDelivDate = $this->lfGetDelivDate();
     $this->arrForm = $this->objFormParam->getFormParamList();
     $objView->assignobj($this);
     // フレームを選択(キャンペーンページから遷移なら変更)
     $objCampaignSess->pageView($objView);
 }