- Timestamp:
- 2011/02/08 22:18:07 (13 years ago)
- bzr:base-revision:
- ohkouchi@loop-az.jp-20110208051257-xl9fregl4xbtkxn7
- bzr:committer:
- Kentaro Ohkouchi <ohkouchi@loop-az.jp>
- bzr:file-ids:
data/Smarty/templates/default/shopping/payment.tpl 15732@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Ffeature-module-update%2Fdata%2FSmarty%2Ftemplates%2Fdefault%2Fshopping%2Fpayment.tpl
data/Smarty/templates/mobile/shopping/payment.tpl 15732@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Ffeature-module-update%2Fdata%2FSmarty%2Ftemplates%2Fdefault%2Fmobile%2Fshopping%2Fpayment.tpl
data/Smarty/templates/sphone/shopping/payment.tpl payment.tpl-20101209134550-lsv02w9wikfx9cj3-40
data/class/helper/SC_Helper_Purchase.php sc_helper_purchase.p-20101020100530-jyaoa7ch9pdfjqzp-1
data/class/pages/shopping/LC_Page_Shopping_Payment.php 15223@1e3b908f-19a9-db11-a64c-001125224ba8:branches%2Ffeature-module-update%2Fdata%2Fclass%2Fpages%2Fshopping%2FLC_Page_Shopping_Payment.php- bzr:mapping-version:
- v4
- bzr:merge:
ohkouchi@loop-az.jp-20110208131617-jyz7xe44rri90ct0- bzr:repository-uuid:
- 1e3b908f-19a9-db11-a64c-001125224ba8
- bzr:revision-id:
- ohkouchi@loop-az.jp-20110208131803-xedcdo8gjw03g54o
- bzr:revno:
- 2842
- bzr:revprop:branch-nick:
- branches/version-2_5-dev
- bzr:root:
- branches/version-2_5-dev
- bzr:text-revisions:
data/Smarty/templates/default/shopping/payment.tpl ohkouchi@loop-az.jp-20110208131617-jyz7xe44rri90ct0
data/Smarty/templates/mobile/shopping/payment.tpl ohkouchi@loop-az.jp-20110208131617-jyz7xe44rri90ct0
data/Smarty/templates/sphone/shopping/payment.tpl ohkouchi@loop-az.jp-20110208131617-jyz7xe44rri90ct0
data/class/helper/SC_Helper_Purchase.php ohkouchi@loop-az.jp-20110208131617-jyz7xe44rri90ct0
data/class/pages/shopping/LC_Page_Shopping_Payment.php ohkouchi@loop-az.jp-20110208131617-jyz7xe44rri90ct0- bzr:timestamp:
- 2011-02-08 22:18:03.164000034 +0900
- bzr:user-agent:
- bzr2.2.1+bzr-svn1.0.4
- svn:original-date:
- 2011-02-08T13:18:03.164000Z
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_5-dev/data/class/pages/shopping/LC_Page_Shopping_Payment.php
r20112 r20114 78 78 $objCartSess = new SC_CartSession(); 79 79 $objPurchase = new SC_Helper_Purchase_Ex(); 80 $this->objCustomer = new SC_Customer(); 81 $this->objFormParam = new SC_FormParam(); 82 80 $objCustomer = new SC_Customer(); 81 $objFormParam = new SC_FormParam(); 82 83 // カートの情報を取得 83 84 $this->arrShipping =& $objPurchase->getShippingTemp(); 85 $shipping_vol = count($this->arrShipping); 86 84 87 $this->is_multiple = $objPurchase->isMultiple(); 85 88 $this->tpl_uniqid = $objSiteSess->getUniqId(); 89 $cart_key = $objCartSess->getKey(); 86 90 $objPurchase->verifyChangeCart($this->tpl_uniqid, $objCartSess); 87 91 88 $this->cartKey = $objCartSess->getKey();89 90 92 // 配送業者を取得 91 $this->arrDeliv = $objPurchase->getDeliv($this->cartKey); 92 if (count($this->arrDeliv) == 1) { 93 $this->is_single_deliv = true; 94 $deliv_id = $this->arrDeliv[0]['deliv_id']; 95 } else { 96 $this->is_single_deliv = false; 97 } 98 99 // 会員ログインチェック 100 if($this->objCustomer->isLoginSuccess(true)) { 93 $this->arrDeliv = $objPurchase->getDeliv($cart_key); 94 $this->is_single_deliv = $this->isSingleDeliv($this->arrDeliv); 95 96 // 会員情報の取得 97 if ($objCustomer->isLoginSuccess(true)) { 101 98 $this->tpl_login = '1'; 102 $this->tpl_user_point = $this->objCustomer->getValue('point'); 103 //戻り先URL 104 if ($this->cartKey == PRODUCT_TYPE_DOWNLOAD) { 105 // ダウンロード商品のみの場合はカート画面へ戻る 106 $this->tpl_back_url = CART_URLPATH; 107 } else { 108 $this->tpl_back_url = DELIV_URLPATH; 109 } 110 } else { 111 $this->tpl_back_url = SHOPPING_URL . "?from=nonmember"; 112 } 113 114 // 一時受注テーブルの読込 99 $this->tpl_user_point = $objCustomer->getValue('point'); 100 $this->name01 = $objCustomer->getValue('name01'); 101 $this->name02 = $objCustomer->getValue('name02'); 102 } 103 104 // 戻り URL の設定 105 $this->tpl_back_url = $this->getPreviousURL($objCustomer->isLoginSuccess(true), $cart_key); 106 115 107 $arrOrderTemp = $objPurchase->getOrderTemp($this->tpl_uniqid); 116 // 不正遷移チェック(正常に受注情報が格納されていない場合は一旦カート画面まで戻す)117 if ( !$arrOrderTemp) {108 // 正常に受注情報が格納されていない場合はカート画面へ戻す 109 if (SC_Utils_Ex::isBlank($arrOrderTemp)) { 118 110 SC_Response_Ex::sendRedirect(CART_URLPATH); 119 111 exit; 120 112 } 121 113 122 // カート内商品の集計処理を行う 123 $this->cartItems = $objCartSess->getCartList($this->cartKey); 124 $this->tpl_message = $objCartSess->checkProducts($this->cartKey); 125 114 // カート内商品の妥当性チェック 115 $this->tpl_message = $objCartSess->checkProducts($cart_key); 126 116 if (strlen($this->tpl_message) >= 1) { 127 117 SC_Response_Ex::sendRedirect(CART_URLPATH); 128 118 exit; 129 119 } 130 // FIXME 使用ポイント, 手数料の扱い131 $this->arrData = $objCartSess->calculate($this->cartKey, $objCustomer, 0, $objPurchase->getShippingPref());132 120 133 121 // 購入金額の取得 134 $t otal_inctax = $objCartSess->getAllProductsTotal($this->cartKey);122 $this->arrPrices = $objCartSess->calculate($cart_key, $objCustomer, 0, $objPurchase->getShippingPref()); 135 123 136 124 // お届け日一覧の取得 137 $this->arrDelivDate = $objPurchase->getDelivDate($objCartSess, $ this->cartKey);125 $this->arrDelivDate = $objPurchase->getDelivDate($objCartSess, $cart_key); 138 126 139 127 switch($this->getMode()) { 128 /* 129 * 配送業者選択時のアクション 130 * モバイル端末以外の場合は, JSON 形式のデータを出力し, ajax で取得する. 131 */ 140 132 case 'select_deliv': 141 $this->objFormParam->convParam(); 142 $this->lfInitParam(true); 143 $this->objFormParam->setParam($_POST); 144 $arrErr = $this->objFormParam->checkError(); 133 $this->setFormParams($objFormParam, $_POST, true, $shipping_vol); 134 135 $arrErr = $objFormParam->checkError(); 145 136 if (SC_Utils_Ex::isBlank($arrErr)) { 146 $deliv_id = $this->objFormParam->getValue('deliv_id'); 147 $this->arrPayment = $objPurchase->getPaymentsByPrice($total_inctax, $deliv_id); 148 $this->img_show = $this->lfGetImgShow($this->arrPayment); 149 // 配送時間を取得 150 $this->arrDelivTime = $objPurchase->getDelivTime($deliv_id); 151 $arrSelectDeliv = array('error' => false, 152 'arrPayment' => $this->arrPayment, 153 'arrDelivTime' => $this->arrDelivTime, 154 'img_show' => $this->img_show); 137 $deliv_id = $objFormParam->getValue('deliv_id'); 138 $arrSelectedDeliv = $this->getSelectedDeliv($objPurchase, $objCartSess, $deliv_id); 139 $arrSelectedDeliv['error'] = false; 155 140 } else { 156 $arrSelect Deliv = array('error' => true);141 $arrSelectedDeliv = array('error' => true); 157 142 } 158 143 159 144 if (SC_Display::detectDevice() != DEVICE_TYPE_MOBILE) { 160 145 $objJson = new Services_JSON(); 161 echo $objJson->encode($arrSelect Deliv);146 echo $objJson->encode($arrSelectedDeliv); 162 147 exit; 148 } else { 149 $this->arrPayment = $arrSelectedDeliv['arrPayment']; 150 $this->arrDelivTime = $arrSelectedDeliv['arrDelivTime']; 163 151 } 164 152 break; 165 153 154 // 登録処理 166 155 case 'confirm': 167 156 // パラメータ情報の初期化 168 $this->lfInitParam(); 169 // POST値の取得 170 $this->objFormParam->setParam($_POST); 171 // 入力値の変換 172 $this->objFormParam->convParam(); 173 $deliv_id = $this->objFormParam->getValue('deliv_id'); 174 $this->arrPayment = $objPurchase->getPaymentsByPrice($total_inctax, $deliv_id); 175 $this->arrDelivTime = $objPurchase->getDelivTime($deliv_id); 176 $this->arrErr = $this->lfCheckError($this->arrData, $this->arrPayment); 177 // 入力エラーなし 178 if(count($this->arrErr) == 0) { 179 180 foreach (array_keys($_SESSION['shipping']) as $key) { 181 $timeId = $this->objFormParam->getValue('deliv_time_id' . $key); 182 183 /* TODO 184 * SC_Purchase::getShippingTemp() で取得して, 185 * リファレンスで代入すると, セッションに添字を追加できない? 186 */ 187 $_SESSION['shipping'][$key]['deliv_id'] = $deliv_id; 188 $_SESSION['shipping'][$key]['time_id'] = $timeId; 189 $_SESSION['shipping'][$key]['shipping_time'] = $this->arrDelivTime[$timeId]; 190 $_SESSION['shipping'][$key]['shipping_date'] = $this->objFormParam->getValue('deliv_date' . $key); 191 } 192 $this->lfRegistData($this->tpl_uniqid, $objPurchase); 157 $this->setFormParams($objFormParam, $_POST, false, $shipping_vol); 158 159 $deliv_id = $objFormParam->getValue('deliv_id'); 160 $arrSelectedDeliv = $this->getSelectedDeliv($objPurchase, $objCartSess, $deliv_id); 161 $this->arrPayment = $arrSelectedDeliv['arrPayment']; 162 $this->arrDelivTime = $arrSelectedDeliv['arrDelivTime']; 163 164 $this->arrErr = $this->lfCheckError($objFormParam, $this->arrPrices['subtotal'], $this->tpl_user_point); 165 166 if (SC_Utils_Ex::isBlank($this->arrErr)) { 167 $this->saveShippings($objFormParam, $this->arrDelivTime); 168 $this->lfRegistData($this->tpl_uniqid, $objFormParam->getDbArray(), $objPurchase, $this->arrPayment); 193 169 194 170 // 正常に登録されたことを記録しておく … … 197 173 SC_Response_Ex::sendRedirect(SHOPPING_CONFIRM_URLPATH); 198 174 exit; 199 } else{175 } else { 200 176 // 受注一時テーブルからの情報を格納 201 $this->img_show = $ this->lfGetImgShow($this->arrPayment);202 $ this->objFormParam->setParam($objPurchase->getOrderTemp($this->tpl_uniqid));177 $this->img_show = $arrSelectedDeliv['img_show']; 178 $objFormParam->setParam($objPurchase->getOrderTemp($this->tpl_uniqid)); 203 179 } 204 180 break; 181 205 182 // 前のページに戻る 206 183 case 'return': … … 213 190 214 191 default: 215 216 192 // 前のページから戻ってきた場合の初期値を設定 217 $this->lfInitParam(); 218 $this->objFormParam->setParam($arrOrderTemp); 219 $this->objFormParam->convParam(); 193 $this->setFormParams($objFormParam, $arrOrderTemp, true, $shipping_vol); 220 194 221 195 if (!$this->is_single_deliv) { 222 $deliv_id = $ this->objFormParam->getValue('deliv_id');196 $deliv_id = $objFormParam->getValue('deliv_id'); 223 197 } 224 198 225 199 if (!SC_Utils_Ex::isBlank($deliv_id)) { 226 $this->objFormParam->setValue('deliv_id', $deliv_id); 227 $this->arrPayment = $objPurchase->getPaymentsByPrice($total_inctax, $deliv_id); 200 $objFormParam->setValue('deliv_id', $deliv_id); 201 $arrSelectedDeliv = $this->getSelectedDeliv($objPurchase, $objCartSess, $deliv_id); 202 $this->arrPayment = $arrSelectedDeliv['arrPayment']; 228 203 // XXX セッションからデフォルト値を取得する必要あり 229 $this->arrDelivTime = $ objPurchase->getDelivTime($deliv_id);230 $this->img_show = $ this->lfGetImgShow($this->arrPayment);204 $this->arrDelivTime = $arrSelectedDeliv['arrDelivTime']; 205 $this->img_show = $arrSelectedDeliv['img_show']; 231 206 } 232 207 break; … … 235 210 // モバイル用 ポストバック処理 236 211 if (SC_Display::detectDevice() == DEVICE_TYPE_MOBILE) { 237 switch($this->getMode()) { 238 case 'select_deliv': 239 $this->tpl_mainpage = 'shopping/payment.tpl'; 240 break; 241 242 case 'confirm': 243 case 'return': 244 default: 245 if ($this->is_single_deliv) { 246 $this->tpl_mainpage = 'shopping/payment.tpl'; 247 } else { 248 $this->tpl_mainpage = 'shopping/select_deliv.tpl'; 249 } 250 } 251 } 252 253 $this->arrForm = $this->objFormParam->getFormParamList(); 212 $this->tpl_mainpage = $this->getMobileMainpage($this->is_single_deliv, $this->getMode()); 213 } 214 215 $this->arrForm = $objFormParam->getFormParamList(); 254 216 } 255 217 … … 263 225 } 264 226 265 /* パラメータ情報の初期化 */ 266 function lfInitParam($deliv_only = false) { 267 $this->objFormParam->addParam("配送業者", "deliv_id", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK")); 227 /** 228 * パラメータの初期化を行い, 初期値を設定する. 229 * 230 * @param SC_FormParam $objFormParam SC_FormParam インスタンス 231 * @param array $arrParam 設定する値の配列 232 * @param boolean $deliv_only deliv_id チェックのみの場合 true 233 * @param integer $shipping_vol 配送数 234 */ 235 function setFormParams(&$objFormParam, $arrParam, $deliv_only = false, $shipping_vol) { 236 $this->lfInitParam($objFormParam, $deliv_only, $shipping_vol); 237 $objFormParam->setParam($arrParam); 238 $objFormParam->convParam(); 239 } 240 241 /** 242 * パラメータ情報の初期化を行う. 243 * 244 * @param SC_FormParam $objFormParam SC_FormParam インスタンス 245 * @param boolean $deliv_only deliv_id チェックのみの場合 true 246 * @param integer $shipping_vol 配送数 247 * @return void 248 */ 249 function lfInitParam(&$objFormParam, $deliv_only = false, $shipping_vol) { 250 $objFormParam->addParam("配送業者", "deliv_id", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK")); 268 251 269 252 if (!$deliv_only) { 270 $this->objFormParam->addParam("お支払い方法", "payment_id", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK")); 271 $this->objFormParam->addParam("ポイント", "use_point", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK", "ZERO_START")); 272 $this->objFormParam->addParam("その他お問い合わせ", "message", LTEXT_LEN, "KVa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK")); 273 $this->objFormParam->addParam("ポイントを使用する", "point_check", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"), '2'); 274 275 for ($i = 0; $i < count($this->shipping); $i++) { 276 $this->objFormParam->addParam("お届け時間", "deliv_time_id" . $i, INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK")); 277 $this->objFormParam->addParam("お届け日", "deliv_date" . $i, STEXT_LEN, "KVa", array("MAX_LENGTH_CHECK")); 278 } 279 } 280 } 281 282 283 /* 入力内容のチェック */ 284 function lfCheckError($arrData, $arrPayment) { 253 $objFormParam->addParam("お支払い方法", "payment_id", INT_LEN, "n", array("EXIST_CHECK", "MAX_LENGTH_CHECK", "NUM_CHECK")); 254 $objFormParam->addParam("ポイント", "use_point", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK", "ZERO_START")); 255 $objFormParam->addParam("その他お問い合わせ", "message", LTEXT_LEN, "KVa", array("SPTAB_CHECK", "MAX_LENGTH_CHECK")); 256 $objFormParam->addParam("ポイントを使用する", "point_check", INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK"), '2'); 257 258 for ($i = 0; $i < $shipping_vol; $i++) { 259 $objFormParam->addParam("お届け時間", "deliv_time_id" . $i, INT_LEN, "n", array("MAX_LENGTH_CHECK", "NUM_CHECK")); 260 $objFormParam->addParam("お届け日", "deliv_date" . $i, STEXT_LEN, "KVa", array("MAX_LENGTH_CHECK")); 261 } 262 } 263 264 $objFormParam->setParam($arrParam); 265 $objFormParam->convParam(); 266 } 267 268 /** 269 * 入力内容のチェックを行なう. 270 * 271 * @param SC_FormParam $objFormParam SC_FormParam インスタンス 272 * @param integer $subtotal 購入金額の小計 273 * @param integer $max_point 会員の保持ポイント 274 * @return array 入力チェック結果の配列 275 */ 276 function lfCheckError(&$objFormParam, $subtotal, $max_point) { 285 277 // 入力データを渡す。 286 $arr Ret = $this->objFormParam->getHashArray();287 $objErr = new SC_CheckError($arr Ret);288 $objErr->arrErr = $ this->objFormParam->checkError();278 $arrForm = $objFormParam->getHashArray(); 279 $objErr = new SC_CheckError($arrForm); 280 $objErr->arrErr = $objFormParam->checkError(); 289 281 290 282 if (USE_POINT === false) { 291 $_POST['point_check'] = ""; 292 $_POST['use_point'] = "0"; 293 } 294 295 if (!isset($_POST['point_check'])) $_POST['point_check'] = ""; 296 297 if($_POST['point_check'] == '1') { 283 return $objErr->arrErr; 284 } 285 286 if($arrForm['point_check'] == '1') { 298 287 $objErr->doFunc(array("ポイントを使用する", "point_check"), array("EXIST_CHECK")); 299 288 $objErr->doFunc(array("ポイント", "use_point"), array("EXIST_CHECK")); 300 $max_point = $this->objCustomer->getValue('point');301 289 if($max_point == "") { 302 290 $max_point = 0; 303 291 } 304 292 // FIXME mobile 互換のため br は閉じない... 305 if($arr Ret['use_point'] > $max_point) {293 if($arrForm['use_point'] > $max_point) { 306 294 $objErr->arrErr['use_point'] = "※ ご利用ポイントが所持ポイントを超えています。<br>"; 307 295 } 308 if(($arr Ret['use_point'] * POINT_VALUE) > $arrData['subtotal']) {296 if(($arrForm['use_point'] * POINT_VALUE) > $subtotal) { 309 297 $objErr->arrErr['use_point'] = "※ ご利用ポイントがご購入金額を超えています。<br>"; 310 298 } 311 299 } 312 313 $objCartSess = new SC_CartSession(); 314 // 購入金額の取得得 315 $total_inctax = $objCartSess->getAllProductsTotal($this->cartKey); 316 $pay_flag = true; 317 foreach ($arrPayment as $key => $payment) { 318 if ($payment['payment_id'] == $arrRet['payment_id']) { 319 $pay_flag = false; 300 return $objErr->arrErr; 301 } 302 303 /** 304 * 配送情報を保存する. 305 * 306 * @param SC_FormParam $objFormParam SC_FormParam インスタンス 307 * @param array $arrDelivTime 配送時間の配列 308 */ 309 function saveShippings(&$objFormParam, $arrDelivTime) { 310 $deliv_id = $objFormParam->getValue('deliv_id'); 311 312 /* TODO 313 * SC_Purchase::getShippingTemp() で取得して, 314 * リファレンスで代入すると, セッションに添字を追加できない? 315 */ 316 foreach (array_keys($_SESSION['shipping']) as $key) { 317 318 $time_id = $objFormParam->getValue('deliv_time_id' . $key); 319 320 $_SESSION['shipping'][$key]['deliv_id'] = $deliv_id; 321 $_SESSION['shipping'][$key]['time_id'] = $time_id; 322 $_SESSION['shipping'][$key]['shipping_time'] = $arrDelivTime[$time_id]; 323 $_SESSION['shipping'][$key]['shipping_date'] = $objFormParam->getValue('deliv_date' . $key); 324 } 325 } 326 327 /** 328 * 受注一時テーブルへ登録を行う. 329 * 330 * @param integer $uniqid 受注一時テーブルのユニークID 331 * @param array $arrForm フォームの入力値 332 * @param SC_Helper_Purchase $objPurchase SC_Helper_Purchase インスタンス 333 * @param array $arrPayment お支払い方法の配列 334 * @return void 335 */ 336 function lfRegistData($uniqid, $arrForm, &$objPurchase, $arrPayment) { 337 338 $arrForm['order_temp_id'] = $uniqid; 339 $arrForm['update_date'] = 'Now()'; 340 341 if($arrForm['point_check'] != '1') { 342 $arrForm['use_point'] = 0; 343 } 344 345 foreach ($arrPayment as $payment) { 346 if ($arrForm['payment_id'] == $payment['payment_id']) { 347 $arrForm['charge'] = $payment['charge']; 348 $arrForm['payment_method'] = $payment['payment_method']; 320 349 break; 321 350 } 322 351 } 323 if ($pay_flag && $arrRet['payment_id'] != "") { 324 SC_Utils_Ex::sfDispSiteError(CUSTOMER_ERROR); 325 } 326 327 return $objErr->arrErr; 328 } 329 330 /* 支払い方法文字列の取得 */ 331 function lfGetPaymentInfo($payment_id) { 332 $objQuery = new SC_Query(); 333 $where = "payment_id = ?"; 334 $arrRet = $objQuery->getRow("charge, payment_method", "dtb_payment", $where, array($payment_id)); 335 return (array($arrRet['charge'], $arrRet['payment_method'])); 336 } 337 338 /* DBへデータの登録 */ 339 function lfRegistData($uniqid, &$objPurchase) { 340 341 $sqlval = $this->objFormParam->getDbArray(); 342 // 登録データの作成 343 $sqlval['order_temp_id'] = $uniqid; 344 $sqlval['update_date'] = 'Now()'; 345 346 if (strlen($sqlval['payment_id']) >= 1) { 347 list($sqlval['charge'], $sqlval['payment_method']) = $this->lfGetPaymentInfo($sqlval['payment_id']); 348 } 349 350 // 使用ポイントの設定 351 if($sqlval['point_check'] != '1') { 352 $sqlval['use_point'] = 0; 353 } 354 355 $objPurchase->saveOrderTemp($uniqid, $sqlval); 356 } 357 358 //一時受注テーブルからの情報を格納する 359 function lfSetOrderTempData($uniqid, &$objPurchase) { 360 $arrOrderTemp = $objPurchase->getOrderTemp($uniqid); 361 $this->objFormParam->setParam($arrOrderTemp); 362 return $this->objFormParam; 363 } 364 365 /* 支払い方法の画像があるなしを取得($img_show true:ある false:なし) */ 366 function lfGetImgShow($arrPayment) { 367 $img_show = false; 368 foreach ($arrPayment as $payment) { 369 if (strlen($payment["payment_image"]) > 0 ){ 370 $img_show = true; 371 break; 372 } 373 } 374 return $img_show; 352 $objPurchase->saveOrderTemp($uniqid, $arrForm); 353 } 354 355 /** 356 * 配送業者IDから, 支払い方法, お届け時間の配列を取得する. 357 * 358 * 結果の連想配列の添字の値は以下の通り 359 * - 'arrDelivTime' - お届け時間の配列 360 * - 'arrPayment' - 支払い方法の配列 361 * - 'img_show' - 支払い方法の画像の有無 362 * 363 * @param SC_Helper_Purchase $objPurchase SC_Helper_Purchase インスタンス 364 * @param SC_CartSession $objCartSess SC_CartSession インスタンス 365 * @param integer $deliv_id 配送業者ID 366 * @return array 支払い方法, お届け時間を格納した配列 367 */ 368 function getSelectedDeliv(&$objPurchase, &$objCartSess, $deliv_id) { 369 $arrResults = array(); 370 $arrResults['arrDelivTime'] = $objPurchase->getDelivTime($deliv_id); 371 $total = $objCartSess->getAllProductsTotal($objCartSess->getKey(), 372 $deliv_id); 373 $arrResults['arrPayment'] = $objPurchase->getPaymentsByPrice($total, 374 $deliv_id); 375 $arrResults['img_show'] = $this->hasPaymentImage($arrResults['arrPayment']); 376 return $arrResults; 377 } 378 379 /** 380 * 支払い方法の画像があるかどうか. 381 * 382 * @param array $arrPayment 支払い方法の配列 383 * @return boolean 支払い方法の画像がある場合 true 384 */ 385 function hasPaymentImage($arrPayment) { 386 foreach ($arrPayment as $val) { 387 if (!SC_Utils_Ex::isBlank($val['payment_image'])) { 388 return true; 389 } 390 } 391 return false; 392 } 393 394 /** 395 * 配送業者が1社のみかどうか. 396 * 397 * @param array $arrDeliv 配送業者の配列 398 * @return boolean 配送業者が1社のみの場合 true 399 */ 400 function isSingleDeliv($arrDeliv) { 401 if (count($arrDeliv) == 1) { 402 return true; 403 } else { 404 return false; 405 } 406 } 407 408 /** 409 * 前に戻るボタンの URL を取得する. 410 * 411 * @param boolean $is_login ユーザーがログインしている場合 true 412 * @param $product_type_id 商品種別ID 413 * @return string 前に戻るボタンの URL 414 */ 415 function getPreviousURL($is_login = false, $product_type_id) { 416 if ($is_login) { 417 if ($product_type_id == PRODUCT_TYPE_DOWNLOAD) { 418 return CART_URLPATH; 419 } else { 420 return DELIV_URLPATH; 421 } 422 } else { 423 return SHOPPING_URL . "?from=nonmember"; 424 } 425 } 426 427 /** 428 * モバイル用テンプレートのパスを取得する. 429 * 430 * @param boolean $is_single_deliv 配送業者が1社の場合 true 431 * @param string $mode フォームパラメータ "mode" の文字列 432 * @return string モバイル用テンプレートのパス 433 */ 434 function getMobileMainpage($is_single_deliv = true, $mode) { 435 switch($mode) { 436 case 'select_deliv': 437 return 'shopping/payment.tpl'; 438 break; 439 440 case 'confirm': 441 case 'return': 442 default: 443 if ($is_single_deliv) { 444 return 'shopping/payment.tpl'; 445 } else { 446 return 'shopping/select_deliv.tpl'; 447 } 448 } 375 449 } 376 450 }
Note: See TracChangeset
for help on using the changeset viewer.