/** * Page のプロセス(モバイル). * * @return void */ function mobileProcess() { $conn = new SC_DBConn(); $objView = new SC_MobileView(); $this->objSiteSess = new SC_SiteSession(); $this->objCartSess = new SC_CartSession(); $objSiteInfo = $objView->objSiteInfo; $this->arrInfo = $objSiteInfo->data; $this->objCustomer = new SC_Customer(); $mailHelper = new SC_Helper_Mail_Ex(); // 前のページで正しく登録手続きが行われたか判定 SC_Utils_Ex::sfIsPrePage($this->objSiteSess, true); // ユーザユニークIDの取得と購入状態の正当性をチェック $uniqid = SC_Utils_Ex::sfCheckNormalAccess($this->objSiteSess, $this->objCartSess); if ($uniqid != "") { // 完了処理 $objQuery = new SC_Query(); $objQuery->begin(); $order_id = $this->lfDoComplete($objQuery, $uniqid); $objQuery->commit(); // セッションに保管されている情報を更新する $this->objCustomer->updateSession(); // 完了メール送信 if ($order_id != "") { $mailHelper->sfSendOrderMail($order_id, '2'); } //その他情報の取得 $other_data = $objQuery->get("dtb_order", "memo02", "order_id = ? ", array($order_id)); if ($other_data != "") { $arrOther = unserialize($other_data); // データを編集 foreach ($arrOther as $key => $val) { // URLの場合にはリンクつきで表示させる if (preg_match('/^(https?|ftp)(:\\/\\/[-_.!~*\'()a-zA-Z0-9;\\/?:\\@&=+\\$,%#]+)$/', $val["value"])) { $arrOther[$key]["value"] = "<a href='" . $val["value"] . "'>" . $val["value"] . "</a>"; } } $this->arrOther = $arrOther; } // アフィリエイト用コンバージョンタグの設定 $this->tpl_conv_page = AFF_SHOPPING_COMPLETE; $this->tpl_aff_option = "order_id={$order_id}"; //合計価格の取得 $total = $objQuery->get("dtb_order", "total", "order_id = ? ", array($order_id)); if ($total != "") { $this->tpl_aff_option .= "|total={$total}"; } // TS連携モジュールの実行 if (function_exists('sfTSRequest')) { sfTSRequest($order_id); } } $objView->assignobj($this); $objView->display(SITE_FRAME); }
/** * Page のプロセス(モバイル). * * @return void */ function mobileProcess() { $conn = new SC_DBConn(); $objView = new SC_MobileView(); $objSiteSess = new SC_SiteSession(); $objCartSess = new SC_CartSession(); $objCustomer = new SC_Customer(); $objCookie = new SC_Cookie(); $this->objFormParam = new SC_FormParam(); // フォーム用 $helperMobile = new SC_Helper_Mobile_Ex(); $this->lfInitParam(); // パラメータ情報の初期化 $this->objFormParam->setParam($_POST); // POST値の取得 // ユーザユニークIDの取得と購入状態の正当性をチェック $uniqid = SC_Utils_Ex::sfCheckNormalAccess($objSiteSess, $objCartSess); $this->tpl_uniqid = $uniqid; // ログインチェック if ($objCustomer->isLoginSuccess(true)) { // すでにログインされている場合は、お届け先設定画面に転送 $this->sendRedirect($this->getLocation('./deliv.php'), true); exit; } // 携帯端末IDが一致する会員が存在するかどうかをチェックする。 $this->tpl_valid_phone_id = $objCustomer->checkMobilePhoneId(); 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(MOBILE_URL_SHOP_PAYMENT), true); exit; } break; // 前のページに戻る // 前のページに戻る case 'return': // 確認ページへ移動 $this->sendRedirect($this->getLocation(MOBILE_URL_CART_TOP), true); exit; break; case 'nonmember': $this->lfSetNonMember($this); // ※breakなし // ※breakなし default: if ($_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 ($this->arrForm['year']['value'] == "") { $this->arrForm['year']['value'] = '----'; } $objView->assignobj($this); $objView->display(SITE_FRAME); }
/** * Page のプロセス(モバイル). * * @return void */ function mobileProcess() { $objView = new SC_MobileView(); $objSiteSess = new SC_SiteSession(); $objCartSess = new SC_CartSession(); $this->objCustomer = new SC_Customer(); $objDb = new SC_Helper_DB_Ex(); $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; // 会員ログインチェック if ($this->objCustomer->isLoginSuccess(true)) { $this->tpl_login = '******'; $this->tpl_user_point = $this->objCustomer->getValue('point'); } // 金額の取得 (購入途中で売り切れた場合にはこの関数内にてその商品の個数が0になる) $objDb->sfTotalCart($this, $objCartSess, $arrInfo); if (empty($arrData)) { $arrData = array(); } $this->arrData = $objDb->sfTotalConfirm($arrData, $this, $objCartSess, $arrInfo); // カート内の商品の売り切れチェック $objCartSess->chkSoldOut($objCartSess->getCartList(), true); if (!isset($_POST['mode'])) { $_POST['mode'] = ""; } // 戻るボタンの処理 if (!empty($_POST['return'])) { switch ($_POST['mode']) { case 'confirm': $_POST['mode'] = 'payment'; break; default: // 正常な推移であることを記録しておく $objSiteSess->setRegistFlag(); $this->sendRedirect(MOBILE_URL_SHOP_TOP, true); exit; } } switch ($_POST['mode']) { // 支払い方法指定 → 配達日時指定 case 'deliv_date': // 入力値の変換 $this->objFormParam->convParam(); $this->arrErr = $this->lfCheckError($this->arrData); if (!isset($this->arrErr['payment_id'])) { // 支払い方法の入力エラーなし $this->tpl_mainpage = 'shopping/deliv_date.tpl'; $this->tpl_title = "配達日時指定"; break; } else { // ユーザユニークIDの取得 $uniqid = $objSiteSess->getUniqId(); // 受注一時テーブルからの情報を格納 $this->lfSetOrderTempData($uniqid); } break; 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(MOBILE_URL_SHOP_CONFIRM), true); exit; } else { // ユーザユニークIDの取得 $uniqid = $objSiteSess->getUniqId(); // 受注一時テーブルからの情報を格納 $this->lfSetOrderTempData($uniqid); if (!isset($this->arrErr['payment_id'])) { // 支払い方法の入力エラーなし $this->tpl_mainpage = 'shopping/deliv_date.tpl'; $this->tpl_title = "配達日時指定"; } } break; // 前のページに戻る // 前のページに戻る case 'return': // 非会員の場合 // 正常な推移であることを記録しておく $objSiteSess->setRegistFlag(); $this->sendRedirect(MOBILE_URL_SHOP_TOP, true); 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); // 配送時間の取得 $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); $objView->display(SITE_FRAME); }
/** * Page のプロセス(モバイル). * * @return void */ function mobileProcess() { $objView = new SC_MobileView(false); $objQuery = new SC_Query(); $objCustomer = new SC_Customer(); $objSiteSess = new SC_SiteSession(); $objCartSess = new SC_CartSession(); //ログイン判定 if (!$objCustomer->isLoginSuccess(true)) { SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR, "", false, "", true); } $this->arrForm = $_POST; //-- データ設定 foreach ($_POST as $key => $val) { if ($key != "mode" && $key != "return" && $key != "submit" && $key != session_name()) { $this->list_data[$key] = $val; } } // ユーザユニークIDの取得と購入状態の正当性をチェック $uniqid = SC_Utils_Ex::sfCheckNormalAccess($objSiteSess, $objCartSess); //別のお届け先DB登録用カラム配列 $arrRegistColumn = array(array("column" => "name01", "convert" => "aKV"), array("column" => "name02", "convert" => "aKV"), array("column" => "kana01", "convert" => "CKV"), array("column" => "kana02", "convert" => "CKV"), array("column" => "zip01", "convert" => "n"), array("column" => "zip02", "convert" => "n"), array("column" => "pref", "convert" => "n"), array("column" => "addr01", "convert" => "aKV"), array("column" => "addr02", "convert" => "aKV"), array("column" => "tel01", "convert" => "n"), array("column" => "tel02", "convert" => "n"), array("column" => "tel03", "convert" => "n")); // 戻るボタン用処理 if (!empty($_POST["return"])) { switch ($_POST["mode"]) { case 'complete': $_POST["mode"] = "set2"; break; case 'set2': $_POST["mode"] = "set1"; break; default: $this->sendRedirect($this->getLocation("./deliv.php"), true); exit; } } switch ($_POST['mode']) { case 'set1': $this->arrErr = $this->lfErrorCheck1($this->arrForm); if (count($this->arrErr) == 0 && empty($_POST["return"])) { $this->tpl_mainpage = 'shopping/set1.tpl'; $checkVal = array("pref", "addr01", "addr02", "addr03", "tel01", "tel02", "tel03"); foreach ($checkVal as $key) { unset($this->list_data[$key]); } // 郵便番号から住所の取得 if (@$this->arrForm['pref'] == "" && @$this->arrForm['addr01'] == "" && @$this->arrForm['addr02'] == "") { $address = $this->lfGetAddress($_REQUEST['zip01'] . $_REQUEST['zip02']); $this->arrForm['pref'] = @$address[0]['state']; $this->arrForm['addr01'] = @$address[0]['city'] . @$address[0]['town']; } } else { $checkVal = array("name01", "name02", "kana01", "kana02", "zip01", "zip02"); foreach ($checkVal as $key) { unset($this->list_data[$key]); } } break; case 'set2': $this->arrErr = $this->lfErrorCheck2($this->arrForm); if (count($this->arrErr) == 0 && empty($_POST["return"])) { $this->tpl_mainpage = 'shopping/set2.tpl'; } else { $this->tpl_mainpage = 'shopping/set1.tpl'; $checkVal = array("pref", "addr01", "addr02", "addr03", "tel01", "tel02", "tel03"); foreach ($checkVal as $key) { unset($this->list_data[$key]); } } break; case 'complete': $this->arrErr = $this->lfErrorCheck($this->arrForm); if (count($this->arrErr) == 0) { // 登録 $other_deliv_id = $this->lfRegistData($_POST, $arrRegistColumn, $objCustomer); // 登録済みの別のお届け先を受注一時テーブルに書き込む $this->lfRegistOtherDelivData($uniqid, $objCustomer, $other_deliv_id); // 正常に登録されたことを記録しておく $objSiteSess->setRegistFlag(); // お支払い方法選択ページへ移動 $this->sendRedirect($this->getLocation(MOBILE_URL_SHOP_PAYMENT), true); exit; } else { SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR, "", false, "", true); } break; default: $deliv_count = $objQuery->count("dtb_other_deliv", "customer_id=?", array($objCustomer->getValue('customer_id'))); if ($deliv_count >= DELIV_ADDR_MAX) { SC_Utils_Ex::sfDispSiteError(FREE_ERROR_MSG, "", false, "最大登録件数を超えています。"); } } $objView->assignobj($this); $objView->display(SITE_FRAME); }
/** * Page のプロセス(モバイル). * * @return void */ function mobileProcess() { $objView = new SC_MobileView(); $objCartSess = new SC_CartSession(); $objSiteInfo = $objView->objSiteInfo; $objSiteSess = new SC_SiteSession(); $objCustomer = new SC_Customer(); $arrInfo = $objSiteInfo->data; $objQuery = new SC_Query(); $objDb = new SC_Helper_DB_Ex(); // 前のページで正しく登録手続きが行われた記録があるか判定 SC_Utils_Ex::sfIsPrePage($objSiteSess, true); // ユーザユニークIDの取得と購入状態の正当性をチェック $uniqid = SC_Utils_Ex::sfCheckNormalAccess($objSiteSess, $objCartSess); $this->tpl_uniqid = $uniqid; // カート集計処理 $objDb->sfTotalCart($this, $objCartSess, $arrInfo); // 一時受注テーブルの読込 $arrData = $objDb->sfGetOrderTemp($uniqid); // カート集計を元に最終計算 $arrData = $objDb->sfTotalConfirm($arrData, $this, $objCartSess, $arrInfo, $objCustomer); // カート内の商品の売り切れチェック $objCartSess->chkSoldOut($objCartSess->getCartList()); // 会員ログインチェック if ($objCustomer->isLoginSuccess(true)) { $this->tpl_login = '******'; $this->tpl_user_point = $objCustomer->getValue('point'); } // 決済区分を取得する $payment_type = ""; if ($objDb->sfColumnExists("dtb_payment", "memo01")) { // MEMO03に値が入っている場合には、モジュール追加されたものとみなす $sql = "SELECT memo03 FROM dtb_payment WHERE payment_id = ?"; $arrPayment = $objQuery->getall($sql, array($arrData['payment_id'])); $payment_type = $arrPayment[0]["memo03"]; } $this->payment_type = $payment_type; if (!isset($_POST['mode'])) { $_POST['mode'] = ""; } switch ($_POST['mode']) { // 前のページに戻る case 'return': // 正常な推移であることを記録しておく $objSiteSess->setRegistFlag(); $this->sendRedirect($this->getLocation(MOBILE_URL_SHOP_PAYMENT), true); exit; break; case 'confirm': // この時点で注文番号を確保しておく(クレジット、コンビニ決済で必要なため) // postgresqlとmysqlとで処理を分ける if (DB_TYPE == "pgsql") { $order_id = $objQuery->nextval("dtb_order", "order_id"); } elseif (DB_TYPE == "mysql") { $order_id = $objQuery->get_auto_increment("dtb_order"); } $arrData["order_id"] = $order_id; // セッション情報を保持 $arrData['session'] = serialize($_SESSION); // 集計結果を受注一時テーブルに反映 $objDb->sfRegistTempOrder($uniqid, $arrData); // 正常に登録されたことを記録しておく $objSiteSess->setRegistFlag(); // 決済方法により画面切替 if ($payment_type != "") { $_SESSION["payment_id"] = $arrData['payment_id']; $this->sendRedirect($this->getLocation(MOBILE_URL_SHOP_MODULE), true); } else { $this->sendRedirect($this->getLocation(MOBILE_URL_SHOP_COMPLETE), true); } exit; break; default: break; } $this->arrData = $arrData; $this->arrInfo = $arrInfo; $objView->assignobj($this); $objView->display(SITE_FRAME); }
/** * Page のプロセス(モバイル). * * @return void */ function mobileProcess() { $objView = new SC_MobileView(); $objSiteSess = new SC_SiteSession(); $objCartSess = new SC_CartSession(); $objCustomer = new SC_Customer(); // クッキー管理クラス $objCookie = new SC_Cookie(COOKIE_EXPIRE); // パラメータ管理クラス $this->objFormParam = new SC_FormParam(); // パラメータ情報の初期化 $this->lfInitParam(); // POST値の取得 $this->lfConvertEmail($_POST["login_email"]); $this->lfConvertLoginPass($_POST["login_pass"]); $this->objFormParam->setParam($_POST); $this->objLoginFormParam = new SC_FormParam(); // ログインフォーム用 $this->lfInitLoginFormParam(); // 初期設定 $this->objLoginFormParam->setParam($_POST); // POST値の取得 // ユーザユニークIDの取得と購入状態の正当性をチェック $uniqid = SC_Utils_Ex::sfCheckNormalAccess($objSiteSess, $objCartSess); $this->tpl_uniqid = $uniqid; if (!isset($_POST['mode'])) { $_POST['mode'] = ""; } // ログインチェック if ($_POST['mode'] != 'login' && !$objCustomer->isLoginSuccess(true)) { // 不正アクセスとみなす SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR, "", false, "", true); } switch ($_POST['mode']) { case 'login': $this->objLoginFormParam->toLower('login_email'); $this->arrErr = $this->objLoginFormParam->checkError(); $arrForm = $this->objLoginFormParam->getHashArray(); // クッキー保存判定 if ($arrForm['login_memory'] == "1" && $arrForm['login_email'] != "") { $objCookie->setCookie('login_email', $_POST['login_email']); } else { $objCookie->setCookie('login_email', ''); } if (count($this->arrErr) == 0) { // ログイン判定 if (!$objCustomer->getCustomerDataFromMobilePhoneIdPass($arrForm['login_pass']) && !$objCustomer->getCustomerDataFromEmailPass($arrForm['login_pass'], $arrForm['login_email'], true)) { // 仮登録の判定 $objQuery = new SC_Query(); $where = "(email = ? OR email_mobile = ?) AND status = 1 AND del_flg = 0"; $ret = $objQuery->count("dtb_customer", $where, array($arrForm['login_email'], $arrForm['login_email'])); if ($ret > 0) { SC_Utils_Ex::sfDispSiteError(TEMP_LOGIN_ERROR, "", false, "", true); } else { SC_Utils_Ex::sfDispSiteError(SITE_LOGIN_ERROR, "", false, "", true); } } } else { // ログインページに戻る $this->sendRedirect($this->getLocation(MOBILE_URL_SHOP_TOP), true); exit; } // ログインが成功した場合は携帯端末IDを保存する。 $objCustomer->updateMobilePhoneId(); /* * 携帯メールアドレスが登録されていない場合は, * 携帯メールアドレス登録画面へ遷移 */ $objMobile = new SC_Helper_Mobile_Ex(); if (!$objMobile->gfIsMobileMailAddress($objCustomer->getValue('email'))) { if (!$objCustomer->hasValue('email_mobile')) { $this->sendRedirect($this->getLocation("../entry/email_mobile.php"), true); exit; } } break; // 削除 // 削除 case 'delete': if (SC_Utils_Ex::sfIsInt($_POST['other_deliv_id'])) { $objQuery = new SC_Query(); $where = "other_deliv_id = ?"; $arrRet = $objQuery->delete("dtb_other_deliv", $where, array($_POST['other_deliv_id'])); $this->objFormParam->setValue('select_addr_id', ''); } break; // 会員登録住所に送る // 会員登録住所に送る case 'customer_addr': // お届け先がチェックされている場合には更新処理を行う if ($_POST['deli'] != "") { // 会員情報の住所を受注一時テーブルに書き込む $this->lfRegistDelivData($uniqid, $objCustomer); // 正常に登録されたことを記録しておく $objSiteSess->setRegistFlag(); // お支払い方法選択ページへ移動 $this->sendRedirect($this->getLocation(MOBILE_URL_SHOP_PAYMENT), true); exit; } else { // エラーを返す $arrErr['deli'] = '※ お届け先を選択してください。'; } break; // 登録済みの別のお届け先に送る // 登録済みの別のお届け先に送る case 'other_addr': // お届け先がチェックされている場合には更新処理を行う if ($_POST['deli'] != "") { if (SC_Utils_Ex::sfIsInt($_POST['other_deliv_id'])) { $objQuery = new SC_Query(); $deliv_count = $objQuery->count("dtb_other_deliv", "customer_id=? and other_deliv_id = ?", array($objCustomer->getValue('customer_id'), $_POST['other_deliv_id'])); if ($deliv_count != 1) { SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR); } // 登録済みの別のお届け先を受注一時テーブルに書き込む $this->lfRegistOtherDelivData($uniqid, $objCustomer, $_POST['other_deliv_id']); // 正常に登録されたことを記録しておく $objSiteSess->setRegistFlag(); // お支払い方法選択ページへ移動 $this->sendRedirect($this->getLocation(MOBILE_URL_SHOP_PAYMENT), true); exit; } } else { // エラーを返す $arrErr['deli'] = '※ お届け先を選択してください。'; } break; // 前のページに戻る // 前のページに戻る case 'return': // 確認ページへ移動 $this->sendRedirect($this->getLocation(MOBILE_URL_CART_TOP), true); exit; break; default: $objQuery = new SC_Query(); $where = "order_temp_id = ?"; $arrRet = $objQuery->select("*", "dtb_order_temp", $where, array($uniqid)); $this->objFormParam->setParam($arrRet[0]); break; } /** 表示処理 **/ // 会員登録住所の取得 $col = "name01, name02, pref, addr01, addr02, zip01, zip02"; $where = "customer_id = ?"; $objQuery = new SC_Query(); $arrCustomerAddr = $objQuery->select($col, "dtb_customer", $where, array($_SESSION['customer']['customer_id'])); // 別のお届け先住所の取得 $col = "other_deliv_id, name01, name02, pref, addr01, addr02, zip01, zip02"; $objQuery->setorder("other_deliv_id DESC"); $objOtherAddr = $objQuery->select($col, "dtb_other_deliv", $where, array($_SESSION['customer']['customer_id'])); $this->arrAddr = $arrCustomerAddr; $cnt = 1; foreach ($objOtherAddr as $val) { $this->arrAddr[$cnt] = $val; $cnt++; } // 入力値の取得 if (!isset($arrErr)) { $arrErr = array(); } $this->arrForm = $this->objFormParam->getFormParamList(); $this->arrErr = $arrErr; $objView->assignobj($this); $objView->display(SITE_FRAME); }