| 1 | <?php |
---|
| 2 | /* |
---|
| 3 | * This file is part of EC-CUBE |
---|
| 4 | * |
---|
| 5 | * Copyright(c) 2000-2013 LOCKON CO.,LTD. All Rights Reserved. |
---|
| 6 | * |
---|
| 7 | * http://www.lockon.co.jp/ |
---|
| 8 | * |
---|
| 9 | * This program is free software; you can redistribute it and/or |
---|
| 10 | * modify it under the terms of the GNU General Public License |
---|
| 11 | * as published by the Free Software Foundation; either version 2 |
---|
| 12 | * of the License, or (at your option) any later version. |
---|
| 13 | * |
---|
| 14 | * This program is distributed in the hope that it will be useful, |
---|
| 15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
| 17 | * GNU General Public License for more details. |
---|
| 18 | * |
---|
| 19 | * You should have received a copy of the GNU General Public License |
---|
| 20 | * along with this program; if not, write to the Free Software |
---|
| 21 | * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
---|
| 22 | */ |
---|
| 23 | |
---|
| 24 | require_once CLASS_EX_REALDIR . 'page_extends/LC_Page_Ex.php'; |
---|
| 25 | |
---|
| 26 | /** |
---|
| 27 | * ショッピングログインのページクラス. |
---|
| 28 | * |
---|
| 29 | * @package Page |
---|
| 30 | * @author LOCKON CO.,LTD. |
---|
| 31 | * @version $Id$ |
---|
| 32 | */ |
---|
| 33 | class LC_Page_Shopping extends LC_Page_Ex |
---|
| 34 | { |
---|
| 35 | /** |
---|
| 36 | * Page を初期化する. |
---|
| 37 | * |
---|
| 38 | * @return void |
---|
| 39 | */ |
---|
| 40 | function init() |
---|
| 41 | { |
---|
| 42 | parent::init(); |
---|
| 43 | $this->tpl_title = 'ログイン'; |
---|
| 44 | $masterData = new SC_DB_MasterData_Ex(); |
---|
| 45 | $this->arrPref = $masterData->getMasterData('mtb_pref'); |
---|
| 46 | $this->arrSex = $masterData->getMasterData('mtb_sex'); |
---|
| 47 | $this->arrJob = $masterData->getMasterData('mtb_job'); |
---|
| 48 | $this->tpl_onload = 'fnCheckInputDeliv();'; |
---|
| 49 | |
---|
| 50 | $objDate = new SC_Date_Ex(BIRTH_YEAR, date('Y',strtotime('now'))); |
---|
| 51 | $this->arrYear = $objDate->getYear('', START_BIRTH_YEAR, ''); |
---|
| 52 | $this->arrMonth = $objDate->getMonth(true); |
---|
| 53 | $this->arrDay = $objDate->getDay(true); |
---|
| 54 | |
---|
| 55 | $this->httpCacheControl('nocache'); |
---|
| 56 | } |
---|
| 57 | |
---|
| 58 | /** |
---|
| 59 | * Page のプロセス. |
---|
| 60 | * |
---|
| 61 | * @return void |
---|
| 62 | */ |
---|
| 63 | function process() |
---|
| 64 | { |
---|
| 65 | parent::process(); |
---|
| 66 | $this->action(); |
---|
| 67 | $this->sendResponse(); |
---|
| 68 | } |
---|
| 69 | |
---|
| 70 | /** |
---|
| 71 | * Page のプロセス. |
---|
| 72 | * |
---|
| 73 | * @return void |
---|
| 74 | */ |
---|
| 75 | function action() |
---|
| 76 | { |
---|
| 77 | $objSiteSess = new SC_SiteSession_Ex(); |
---|
| 78 | $objCartSess = new SC_CartSession_Ex(); |
---|
| 79 | $objCustomer = new SC_Customer_Ex(); |
---|
| 80 | $objCookie = new SC_Cookie_Ex(); |
---|
| 81 | $objPurchase = new SC_Helper_Purchase_Ex(); |
---|
| 82 | $objFormParam = new SC_FormParam_Ex(); |
---|
| 83 | |
---|
| 84 | $nonmember_mainpage = 'shopping/nonmember_input.tpl'; |
---|
| 85 | $nonmember_title = 'お客様情報入力'; |
---|
| 86 | |
---|
| 87 | $this->tpl_uniqid = $objSiteSess->getUniqId(); |
---|
| 88 | $objPurchase->verifyChangeCart($this->tpl_uniqid, $objCartSess); |
---|
| 89 | |
---|
| 90 | $this->cartKey = $objCartSess->getKey(); |
---|
| 91 | |
---|
| 92 | // ログイン済みの場合は次画面に遷移 |
---|
| 93 | if ($objCustomer->isLoginSuccess(true)) { |
---|
| 94 | SC_Response_Ex::sendRedirect( |
---|
| 95 | $this->getNextlocation($this->cartKey, $this->tpl_uniqid, |
---|
| 96 | $objCustomer, $objPurchase, |
---|
| 97 | $objSiteSess)); |
---|
| 98 | SC_Response_Ex::actionExit(); |
---|
| 99 | } |
---|
| 100 | // 非会員かつ, ダウンロード商品の場合はエラー表示 |
---|
| 101 | else { |
---|
| 102 | if ($this->cartKey == PRODUCT_TYPE_DOWNLOAD) { |
---|
| 103 | $msg = 'ダウンロード商品を含むお買い物は、会員登録が必要です。<br/>' |
---|
| 104 | . 'お手数ですが、会員登録をお願いします。'; |
---|
| 105 | SC_Utils_Ex::sfDispSiteError(FREE_ERROR_MSG, $objSiteSess, false, $msg); |
---|
| 106 | SC_Response_Ex::actionExit(); |
---|
| 107 | } |
---|
| 108 | } |
---|
| 109 | |
---|
| 110 | switch ($this->getMode()) { |
---|
| 111 | // ログイン実行 |
---|
| 112 | case 'login': |
---|
| 113 | $this->lfInitLoginFormParam($objFormParam); |
---|
| 114 | $objFormParam->setParam($_POST); |
---|
| 115 | $objFormParam->trimParam(); |
---|
| 116 | $objFormParam->convParam(); |
---|
| 117 | $objFormParam->toLower('login_email'); |
---|
| 118 | $this->arrErr = $objFormParam->checkError(); |
---|
| 119 | |
---|
| 120 | // ログイン判定 |
---|
| 121 | if (SC_Utils_Ex::isBlank($this->arrErr) |
---|
| 122 | && $objCustomer->doLogin($objFormParam->getValue('login_email'), |
---|
| 123 | $objFormParam->getValue('login_pass'))) { |
---|
| 124 | // モバイルサイトで携帯アドレスの登録が無い場合、携帯アドレス登録ページへ遷移 |
---|
| 125 | if (SC_Display_Ex::detectDevice() == DEVICE_TYPE_MOBILE) { |
---|
| 126 | if (!$objCustomer->hasValue('email_mobile')) { |
---|
| 127 | SC_Response_Ex::sendRedirectFromUrlPath('entry/email_mobile.php'); |
---|
| 128 | SC_Response_Ex::actionExit(); |
---|
| 129 | } |
---|
| 130 | } |
---|
| 131 | // スマートフォンの場合はログイン成功を返す |
---|
| 132 | elseif (SC_Display_Ex::detectDevice() === DEVICE_TYPE_SMARTPHONE) { |
---|
| 133 | echo SC_Utils_Ex::jsonEncode(array('success' => |
---|
| 134 | $this->getNextLocation($this->cartKey, $this->tpl_uniqid, |
---|
| 135 | $objCustomer, $objPurchase, |
---|
| 136 | $objSiteSess))); |
---|
| 137 | SC_Response_Ex::actionExit(); |
---|
| 138 | } |
---|
| 139 | |
---|
| 140 | // クッキー保存判定 |
---|
| 141 | if ($objFormParam->getValue('login_memory') == '1' && $objFormParam->getValue('login_email') != '') { |
---|
| 142 | $objCookie->setCookie('login_email', $objFormParam->getValue('login_email')); |
---|
| 143 | } else { |
---|
| 144 | $objCookie->setCookie('login_email', ''); |
---|
| 145 | } |
---|
| 146 | |
---|
| 147 | SC_Response_Ex::sendRedirect( |
---|
| 148 | $this->getNextLocation($this->cartKey, $this->tpl_uniqid, |
---|
| 149 | $objCustomer, $objPurchase, |
---|
| 150 | $objSiteSess)); |
---|
| 151 | SC_Response_Ex::actionExit(); |
---|
| 152 | } |
---|
| 153 | // ログインに失敗した場合 |
---|
| 154 | else { |
---|
| 155 | // 仮登録の場合 |
---|
| 156 | if (SC_Helper_Customer_Ex::checkTempCustomer($objFormParam->getValue('login_email'))) { |
---|
| 157 | if (SC_Display_Ex::detectDevice() === DEVICE_TYPE_SMARTPHONE) { |
---|
| 158 | echo $this->lfGetErrorMessage(TEMP_LOGIN_ERROR); |
---|
| 159 | SC_Response_Ex::actionExit(); |
---|
| 160 | } else { |
---|
| 161 | SC_Utils_Ex::sfDispSiteError(TEMP_LOGIN_ERROR); |
---|
| 162 | SC_Response_Ex::actionExit(); |
---|
| 163 | } |
---|
| 164 | } else { |
---|
| 165 | if (SC_Display_Ex::detectDevice() === DEVICE_TYPE_SMARTPHONE) { |
---|
| 166 | echo $this->lfGetErrorMessage(SITE_LOGIN_ERROR); |
---|
| 167 | SC_Response_Ex::actionExit(); |
---|
| 168 | } else { |
---|
| 169 | SC_Utils_Ex::sfDispSiteError(SITE_LOGIN_ERROR); |
---|
| 170 | SC_Response_Ex::actionExit(); |
---|
| 171 | } |
---|
| 172 | } |
---|
| 173 | } |
---|
| 174 | break; |
---|
| 175 | |
---|
| 176 | // お客様情報登録 |
---|
| 177 | case 'nonmember_confirm': |
---|
| 178 | $this->tpl_mainpage = $nonmember_mainpage; |
---|
| 179 | $this->tpl_title = $nonmember_title; |
---|
| 180 | $this->lfInitParam($objFormParam); |
---|
| 181 | $objFormParam->setParam($_POST); |
---|
| 182 | $this->arrErr = $this->lfCheckError($objFormParam); |
---|
| 183 | |
---|
| 184 | if (SC_Utils_Ex::isBlank($this->arrErr)) { |
---|
| 185 | $this->lfRegistData($this->tpl_uniqid, $objPurchase, $objCustomer, $objFormParam); |
---|
| 186 | |
---|
| 187 | $arrParams = $objFormParam->getHashArray(); |
---|
| 188 | $shipping_id = $arrParams['deliv_check'] == '1' ? 1 : 0; |
---|
| 189 | $objPurchase->setShipmentItemTempForSole($objCartSess, $shipping_id); |
---|
| 190 | |
---|
| 191 | $objSiteSess->setRegistFlag(); |
---|
| 192 | |
---|
| 193 | SC_Response_Ex::sendRedirect(SHOPPING_PAYMENT_URLPATH); |
---|
| 194 | SC_Response_Ex::actionExit(); |
---|
| 195 | } |
---|
| 196 | break; |
---|
| 197 | |
---|
| 198 | // 前のページに戻る |
---|
| 199 | case 'return': |
---|
| 200 | |
---|
| 201 | SC_Response_Ex::sendRedirect(CART_URLPATH); |
---|
| 202 | SC_Response_Ex::actionExit(); |
---|
| 203 | break; |
---|
| 204 | |
---|
| 205 | // 複数配送ページへ遷移 |
---|
| 206 | case 'multiple': |
---|
| 207 | // 複数配送先指定が無効な場合はエラー |
---|
| 208 | if (USE_MULTIPLE_SHIPPING === false) { |
---|
| 209 | SC_Utils_Ex::sfDispSiteError(PAGE_ERROR, '', true); |
---|
| 210 | SC_Response_Ex::actionExit(); |
---|
| 211 | } |
---|
| 212 | |
---|
| 213 | $this->lfInitParam($objFormParam); |
---|
| 214 | $objFormParam->setParam($_POST); |
---|
| 215 | $this->arrErr = $this->lfCheckError($objFormParam); |
---|
| 216 | |
---|
| 217 | if (SC_Utils_Ex::isBlank($this->arrErr)) { |
---|
| 218 | $this->lfRegistData($this->tpl_uniqid, $objPurchase, $objCustomer, $objFormParam, true); |
---|
| 219 | |
---|
| 220 | $objSiteSess->setRegistFlag(); |
---|
| 221 | |
---|
| 222 | SC_Response_Ex::sendRedirect(MULTIPLE_URLPATH); |
---|
| 223 | SC_Response_Ex::actionExit(); |
---|
| 224 | } |
---|
| 225 | $this->tpl_mainpage = $nonmember_mainpage; |
---|
| 226 | $this->tpl_title = $nonmember_title; |
---|
| 227 | break; |
---|
| 228 | |
---|
| 229 | // お客様情報入力ページの表示 |
---|
| 230 | case 'nonmember': |
---|
| 231 | $this->tpl_mainpage = $nonmember_mainpage; |
---|
| 232 | $this->tpl_title = $nonmember_title; |
---|
| 233 | $this->lfInitParam($objFormParam); |
---|
| 234 | // ※breakなし |
---|
| 235 | |
---|
| 236 | default: |
---|
| 237 | // 前のページから戻ってきた場合は, お客様情報入力ページ |
---|
| 238 | if (isset($_GET['from']) && $_GET['from'] == 'nonmember') { |
---|
| 239 | $this->tpl_mainpage = $nonmember_mainpage; |
---|
| 240 | $this->tpl_title = $nonmember_title; |
---|
| 241 | $this->lfInitParam($objFormParam); |
---|
| 242 | } |
---|
| 243 | // 通常はログインページ |
---|
| 244 | else { |
---|
| 245 | $this->lfInitLoginFormParam($objFormParam); |
---|
| 246 | } |
---|
| 247 | |
---|
| 248 | $this->setFormParams($objFormParam, $objPurchase, $this->tpl_uniqid); |
---|
| 249 | break; |
---|
| 250 | } |
---|
| 251 | |
---|
| 252 | // 記憶したメールアドレスを取得 |
---|
| 253 | $this->tpl_login_email = $objCookie->getCookie('login_email'); |
---|
| 254 | if (!SC_Utils_Ex::isBlank($this->tpl_login_email)) { |
---|
| 255 | $this->tpl_login_memory = '1'; |
---|
| 256 | } |
---|
| 257 | |
---|
| 258 | // 入力値の取得 |
---|
| 259 | $this->arrForm = $objFormParam->getFormParamList(); |
---|
| 260 | |
---|
| 261 | // 携帯端末IDが一致する会員が存在するかどうかをチェックする。 |
---|
| 262 | if (SC_Display_Ex::detectDevice() === DEVICE_TYPE_MOBILE) { |
---|
| 263 | $this->tpl_valid_phone_id = $objCustomer->checkMobilePhoneId(); |
---|
| 264 | } |
---|
| 265 | |
---|
| 266 | } |
---|
| 267 | |
---|
| 268 | /** |
---|
| 269 | * お客様情報入力時のパラメーター情報の初期化を行う. |
---|
| 270 | * |
---|
| 271 | * @param SC_FormParam $objFormParam SC_FormParam インスタンス |
---|
| 272 | * @return void |
---|
| 273 | */ |
---|
| 274 | function lfInitParam(&$objFormParam) |
---|
| 275 | { |
---|
| 276 | SC_Helper_Customer_Ex::sfCustomerCommonParam($objFormParam, 'order_'); |
---|
| 277 | SC_Helper_Customer_Ex::sfCustomerRegisterParam($objFormParam, false, false, 'order_'); |
---|
| 278 | |
---|
| 279 | // 不要なパラメーターの削除 |
---|
| 280 | // XXX: 共通化したことをうまく使えば、以前あった購入同時会員登録も復活出来そうですが |
---|
| 281 | $objFormParam->removeParam('order_password'); |
---|
| 282 | $objFormParam->removeParam('order_password02'); |
---|
| 283 | $objFormParam->removeParam('order_reminder'); |
---|
| 284 | $objFormParam->removeParam('order_reminder_answer'); |
---|
| 285 | $objFormParam->removeParam('order_mailmaga_flg'); |
---|
| 286 | |
---|
| 287 | $objFormParam->addParam('別のお届け先', 'deliv_check', INT_LEN, 'n', array('MAX_LENGTH_CHECK', 'NUM_CHECK')); |
---|
| 288 | |
---|
| 289 | SC_Helper_Customer_Ex::sfCustomerCommonParam($objFormParam, 'shipping_'); |
---|
| 290 | } |
---|
| 291 | |
---|
| 292 | /** |
---|
| 293 | * ログイン時のパラメーター情報の初期化を行う. |
---|
| 294 | * |
---|
| 295 | * @param SC_FormParam $objFormParam SC_FormParam インスタンス |
---|
| 296 | * @return void |
---|
| 297 | */ |
---|
| 298 | function lfInitLoginFormParam(&$objFormParam) |
---|
| 299 | { |
---|
| 300 | $objFormParam->addParam('記憶する', 'login_memory', INT_LEN, 'n', array('MAX_LENGTH_CHECK', 'NUM_CHECK')); |
---|
| 301 | $objFormParam->addParam('メールアドレス', 'login_email', STEXT_LEN, 'a', array('EXIST_CHECK', 'MAX_LENGTH_CHECK')); |
---|
| 302 | $objFormParam->addParam('パスワード', 'login_pass', PASSWORD_MAX_LEN, '', array('EXIST_CHECK', 'MAX_LENGTH_CHECK')); |
---|
| 303 | } |
---|
| 304 | |
---|
| 305 | /** |
---|
| 306 | * ログイン済みの場合の遷移先を取得する. |
---|
| 307 | * |
---|
| 308 | * 商品種別IDが, ダウンロード商品の場合は, 会員情報を受注一時情報に保存し, |
---|
| 309 | * 支払方法選択画面のパスを返す. |
---|
| 310 | * それ以外は, お届け先選択画面のパスを返す. |
---|
| 311 | * |
---|
| 312 | * @param integer $product_type_id 商品種別ID |
---|
| 313 | * @param string $uniqid 受注一時テーブルのユニークID |
---|
| 314 | * @param SC_Customer $objCustomer SC_Customer インスタンス |
---|
| 315 | * @param SC_Helper_Purchase $objPurchase SC_Helper_Purchase インスタンス |
---|
| 316 | * @param SC_SiteSession $objSiteSess SC_SiteSession インスタンス |
---|
| 317 | * @return string 遷移先のパス |
---|
| 318 | */ |
---|
| 319 | function getNextLocation($product_type_id, $uniqid, &$objCustomer, &$objPurchase, &$objSiteSess) |
---|
| 320 | { |
---|
| 321 | switch ($product_type_id) { |
---|
| 322 | case PRODUCT_TYPE_DOWNLOAD: |
---|
| 323 | $objPurchase->unsetAllShippingTemp(true); |
---|
| 324 | $objPurchase->saveOrderTemp($uniqid, array(), $objCustomer); |
---|
| 325 | $objSiteSess->setRegistFlag(); |
---|
| 326 | return 'payment.php'; |
---|
| 327 | |
---|
| 328 | case PRODUCT_TYPE_NORMAL: |
---|
| 329 | default: |
---|
| 330 | return 'deliv.php'; |
---|
| 331 | } |
---|
| 332 | } |
---|
| 333 | |
---|
| 334 | /** |
---|
| 335 | * データの一時登録を行う. |
---|
| 336 | * |
---|
| 337 | * 非会員向けの処理 |
---|
| 338 | * @param integer $uniqid 受注一時テーブルのユニークID |
---|
| 339 | * @param SC_Helper_Purchase $objPurchase SC_Helper_Purchase インスタンス |
---|
| 340 | * @param SC_Customer $objCustomer SC_Customer インスタンス |
---|
| 341 | * @param SC_FormParam $objFormParam SC_FormParam インスタンス |
---|
| 342 | * @param boolean $isMultiple 複数配送の場合 true |
---|
| 343 | */ |
---|
| 344 | function lfRegistData($uniqid, &$objPurchase, &$objCustomer, &$objFormParam, $isMultiple = false) |
---|
| 345 | { |
---|
| 346 | $arrParams = $objFormParam->getHashArray(); |
---|
| 347 | |
---|
| 348 | // 注文者をお届け先とする配列を取得 |
---|
| 349 | $arrShippingOwn = array(); |
---|
| 350 | $objPurchase->copyFromOrder($arrShippingOwn, $arrParams); |
---|
| 351 | |
---|
| 352 | // 都度入力されたお届け先 |
---|
| 353 | $arrShipping = $objPurchase->extractShipping($arrParams); |
---|
| 354 | |
---|
| 355 | if ($isMultiple) { |
---|
| 356 | $objPurchase->unsetOneShippingTemp(0); |
---|
| 357 | $objPurchase->unsetOneShippingTemp(1); |
---|
| 358 | $objPurchase->saveShippingTemp($arrShippingOwn, 0); |
---|
| 359 | if ($arrParams['deliv_check'] == '1') { |
---|
| 360 | $objPurchase->saveShippingTemp($arrShipping, 1); |
---|
| 361 | } |
---|
| 362 | } else { |
---|
| 363 | $objPurchase->unsetAllShippingTemp(true); |
---|
| 364 | if ($arrParams['deliv_check'] == '1') { |
---|
| 365 | $objPurchase->saveShippingTemp($arrShipping, 1); |
---|
| 366 | } else { |
---|
| 367 | $objPurchase->saveShippingTemp($arrShippingOwn, 0); |
---|
| 368 | } |
---|
| 369 | } |
---|
| 370 | |
---|
| 371 | $arrValues = $objFormParam->getDbArray(); |
---|
| 372 | |
---|
| 373 | // 登録データの作成 |
---|
| 374 | $arrValues['order_birth'] = SC_Utils_Ex::sfGetTimestamp($arrParams['year'], $arrParams['month'], $arrParams['day']); |
---|
| 375 | $arrValues['update_date'] = 'CURRENT_TIMESTAMP'; |
---|
| 376 | $arrValues['customer_id'] = '0'; |
---|
| 377 | $objPurchase->saveOrderTemp($uniqid, $arrValues, $objCustomer); |
---|
| 378 | } |
---|
| 379 | |
---|
| 380 | /** |
---|
| 381 | * 入力内容のチェックを行う. |
---|
| 382 | * |
---|
| 383 | * 追加の必須チェック, 相関チェックを行うため, SC_CheckError を使用する. |
---|
| 384 | * |
---|
| 385 | * @param SC_FormParam $objFormParam SC_FormParam インスタンス |
---|
| 386 | * @return array エラー情報の配 |
---|
| 387 | */ |
---|
| 388 | function lfCheckError(&$objFormParam) |
---|
| 389 | { |
---|
| 390 | $objErr = SC_Helper_Customer_Ex::sfCustomerCommonErrorCheck($objFormParam, 'order_'); |
---|
| 391 | |
---|
| 392 | // 別のお届け先チェック |
---|
| 393 | if (isset($arrParams['deliv_check']) && $arrParams['deliv_check'] == '1') { |
---|
| 394 | $objErr2 = SC_Helper_Customer_Ex::sfCustomerCommonErrorCheck($objFormParam, 'shipping_'); |
---|
| 395 | $objErr->arrErr = array_merge((array)$objErr->arrErr, (array)$objErr2->arrErr); |
---|
| 396 | } else { |
---|
| 397 | // shipping系のエラーは無視 |
---|
| 398 | foreach ($objErr->arrErr as $key => $val) { |
---|
| 399 | if (substr($key, 0, strlen('shipping_')) == 'shipping_') { |
---|
| 400 | unset($objErr->arrErr[$key]); |
---|
| 401 | } |
---|
| 402 | } |
---|
| 403 | } |
---|
| 404 | |
---|
| 405 | // 複数項目チェック |
---|
| 406 | $objErr->doFunc(array('生年月日', 'year', 'month', 'day'), array('CHECK_BIRTHDAY')); |
---|
| 407 | $objErr->doFunc(array('メールアドレス', 'メールアドレス(確認)', 'order_email', 'order_email02'), array('EQUAL_CHECK')); |
---|
| 408 | |
---|
| 409 | return $objErr->arrErr; |
---|
| 410 | } |
---|
| 411 | |
---|
| 412 | /** |
---|
| 413 | * 入力済みの購入情報をフォームに設定する. |
---|
| 414 | * |
---|
| 415 | * 受注一時テーブル, セッションの配送情報から入力済みの購入情報を取得し, |
---|
| 416 | * フォームに設定する. |
---|
| 417 | * |
---|
| 418 | * @param SC_FormParam $objFormParam SC_FormParam インスタンス |
---|
| 419 | * @param SC_Helper_Purchase $objPurchase SC_Helper_Purchase インスタンス |
---|
| 420 | * @param integer $uniqid 購入一時情報のユニークID |
---|
| 421 | * @return void |
---|
| 422 | */ |
---|
| 423 | function setFormParams(&$objFormParam, &$objPurchase, $uniqid) |
---|
| 424 | { |
---|
| 425 | $arrOrderTemp = $objPurchase->getOrderTemp($uniqid); |
---|
| 426 | if (SC_Utils_Ex::isBlank($arrOrderTemp)) { |
---|
| 427 | $arrOrderTemp = array( |
---|
| 428 | 'order_email' => '', |
---|
| 429 | 'order_birth' => '', |
---|
| 430 | ); |
---|
| 431 | } |
---|
| 432 | $arrShippingTemp = $objPurchase->getShippingTemp(); |
---|
| 433 | |
---|
| 434 | $objFormParam->setParam($arrOrderTemp); |
---|
| 435 | /* |
---|
| 436 | * count($arrShippingTemp) > 1 は複数配送であり, |
---|
| 437 | * $arrShippingTemp[0] は注文者が格納されている |
---|
| 438 | */ |
---|
| 439 | if (count($arrShippingTemp) > 1) { |
---|
| 440 | $objFormParam->setParam($arrShippingTemp[1]); |
---|
| 441 | } else { |
---|
| 442 | if ($arrOrderTemp['deliv_check'] == 1) { |
---|
| 443 | $objFormParam->setParam($arrShippingTemp[1]); |
---|
| 444 | } else { |
---|
| 445 | $objFormParam->setParam($arrShippingTemp[0]); |
---|
| 446 | } |
---|
| 447 | } |
---|
| 448 | $objFormParam->setValue('order_email02', $arrOrderTemp['order_email']); |
---|
| 449 | $objFormParam->setDBDate($arrOrderTemp['order_birth']); |
---|
| 450 | } |
---|
| 451 | |
---|
| 452 | /** |
---|
| 453 | * エラーメッセージを JSON 形式で返す. |
---|
| 454 | * |
---|
| 455 | * TODO リファクタリング |
---|
| 456 | * この関数は主にスマートフォンで使用します. |
---|
| 457 | * |
---|
| 458 | * @param integer エラーコード |
---|
| 459 | * @return string JSON 形式のエラーメッセージ |
---|
| 460 | * @see LC_PageError |
---|
| 461 | */ |
---|
| 462 | function lfGetErrorMessage($error) |
---|
| 463 | { |
---|
| 464 | switch ($error) { |
---|
| 465 | case TEMP_LOGIN_ERROR: |
---|
| 466 | $msg = "メールアドレスもしくはパスワードが正しくありません。\n本登録がお済みでない場合は、仮登録メールに記載されているURLより本登録を行ってください。"; |
---|
| 467 | break; |
---|
| 468 | case SITE_LOGIN_ERROR: |
---|
| 469 | default: |
---|
| 470 | $msg = 'メールアドレスもしくはパスワードが正しくありません。'; |
---|
| 471 | } |
---|
| 472 | |
---|
| 473 | return SC_Utils_Ex::jsonEncode(array('login_error' => $msg)); |
---|
| 474 | } |
---|
| 475 | } |
---|