Changeset 21049
- Timestamp:
- 2011/07/27 13:46:39 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_11-dev/data/class/pages/products/LC_Page_Products_List.php
r20970 r21049 126 126 $this->objNavi = new SC_PageNavi_Ex($this->tpl_pageno, $this->tpl_linemax, $this->disp_number, 'fnNaviPage', NAVI_PMAX, $urlParam, SC_Display_Ex::detectDevice() !== DEVICE_TYPE_MOBILE); 127 127 $this->arrProducts = $this->lfGetProductsList($arrSearchCondition, $this->disp_number, $this->objNavi->start_row, $this->tpl_linemax, $objProduct); 128 //商品一覧の表示処理 129 $strnavi = $this->objNavi->strnavi; 130 // 表示文字列 131 $this->tpl_strnavi = empty($strnavi) ? " " : $strnavi; 132 133 // 規格1クラス名 134 $this->tpl_class_name1 = $objProduct->className1; 135 136 // 規格2クラス名 137 $this->tpl_class_name2 = $objProduct->className2; 138 139 // 規格1 140 $this->arrClassCat1 = $objProduct->classCats1; 141 142 // 規格1が設定されている 143 $this->tpl_classcat_find1 = $objProduct->classCat1_find; 144 // 規格2が設定されている 145 $this->tpl_classcat_find2 = $objProduct->classCat2_find; 146 147 $this->tpl_stock_find = $objProduct->stock_find; 148 $this->tpl_product_class_id = $objProduct->product_class_id; 149 $this->tpl_product_type = $objProduct->product_type; 150 151 // 商品ステータスを取得 152 $this->productStatus = $this->arrProducts['productStatus']; 153 unset($this->arrProducts['productStatus']); 154 $this->tpl_javascript .= 'var productsClassCategories = ' . SC_Utils_Ex::jsonEncode($objProduct->classCategories) . ';'; 155 //onloadスクリプトを設定 156 foreach ($this->arrProducts as $arrProduct) { 157 $js_fnOnLoad .= "fnSetClassCategories(document.product_form{$arrProduct['product_id']});"; 158 } 159 160 //カート処理 161 $target_product_id = intval($this->arrForm['product_id']); 162 if ( $target_product_id > 0) { 163 // 商品IDの正当性チェック 164 if (!SC_Utils_Ex::sfIsInt($this->arrForm['product_id']) 165 || !SC_Helper_DB_Ex::sfIsRecord("dtb_products", "product_id", $this->arrForm['product_id'], "del_flg = 0 AND status = 1")) { 166 SC_Utils_Ex::sfDispSiteError(PRODUCT_NOT_FOUND); 128 129 130 switch($this->getMode()){ 131 132 case "json": 133 $this->arrProducts = $this->setStatusData($this->arrProducts, $this->arrSTATUS, $this->arrSTATUS_IMAGE); 134 $this->arrProducts = $this->setPriceTax($this->arrProducts); 135 echo SC_Utils_Ex::jsonEncode($this->arrProducts); 136 exit; 137 break; 138 139 default: 140 141 //商品一覧の表示処理 142 $strnavi = $this->objNavi->strnavi; 143 // 表示文字列 144 $this->tpl_strnavi = empty($strnavi) ? " " : $strnavi; 145 146 // 規格1クラス名 147 $this->tpl_class_name1 = $objProduct->className1; 148 149 // 規格2クラス名 150 $this->tpl_class_name2 = $objProduct->className2; 151 152 // 規格1 153 $this->arrClassCat1 = $objProduct->classCats1; 154 155 // 規格1が設定されている 156 $this->tpl_classcat_find1 = $objProduct->classCat1_find; 157 // 規格2が設定されている 158 $this->tpl_classcat_find2 = $objProduct->classCat2_find; 159 160 $this->tpl_stock_find = $objProduct->stock_find; 161 $this->tpl_product_class_id = $objProduct->product_class_id; 162 $this->tpl_product_type = $objProduct->product_type; 163 164 // 商品ステータスを取得 165 $this->productStatus = $this->arrProducts['productStatus']; 166 unset($this->arrProducts['productStatus']); 167 $this->tpl_javascript .= 'var productsClassCategories = ' . SC_Utils_Ex::jsonEncode($objProduct->classCategories) . ';'; 168 //onloadスクリプトを設定 169 foreach ($this->arrProducts as $arrProduct) { 170 $js_fnOnLoad .= "fnSetClassCategories(document.product_form{$arrProduct['product_id']});"; 171 } 172 173 //カート処理 174 $target_product_id = intval($this->arrForm['product_id']); 175 if ( $target_product_id > 0) { 176 // 商品IDの正当性チェック 177 if (!SC_Utils_Ex::sfIsInt($this->arrForm['product_id']) 178 || !SC_Helper_DB_Ex::sfIsRecord("dtb_products", "product_id", $this->arrForm['product_id'], "del_flg = 0 AND status = 1")) { 179 SC_Utils_Ex::sfDispSiteError(PRODUCT_NOT_FOUND); 180 } 181 182 // 入力内容のチェック 183 $arrErr = $this->lfCheckError($target_product_id, $this->arrForm, $this->tpl_classcat_find1, $this->tpl_classcat_find2); 184 if (empty($arrErr)) { 185 $this->lfAddCart($this->arrForm, $_SERVER['HTTP_REFERER']); 186 SC_Response_Ex::sendRedirect(CART_URLPATH); 187 exit; 188 } 189 $js_fnOnLoad .= $this->lfSetSelectedData($this->arrProducts, $this->arrForm, $arrErr, $target_product_id); 190 } 191 192 $this->tpl_javascript .= 'function fnOnLoad(){' . $js_fnOnLoad . '}'; 193 $this->tpl_onload .= 'fnOnLoad(); '; 194 break; 195 167 196 } 168 197 169 // 入力内容のチェック 170 $arrErr = $this->lfCheckError($target_product_id, $this->arrForm, $this->tpl_classcat_find1, $this->tpl_classcat_find2); 171 if (empty($arrErr)) { 172 $this->lfAddCart($this->arrForm, $_SERVER['HTTP_REFERER']); 173 SC_Response_Ex::sendRedirect(CART_URLPATH); 174 exit; 175 } 176 $js_fnOnLoad .= $this->lfSetSelectedData($this->arrProducts, $this->arrForm, $arrErr, $target_product_id); 177 } 178 179 $this->tpl_javascript .= 'function fnOnLoad(){' . $js_fnOnLoad . '}'; 180 $this->tpl_onload .= 'fnOnLoad(); '; 181 182 $this->tpl_rnd = SC_Utils_Ex::sfGetRandomString(3); 198 $this->tpl_rnd = SC_Utils_Ex::sfGetRandomString(3); 199 183 200 } 184 201 … … 488 505 } 489 506 } 507 508 /** 509 * 商品情報配列にステータス情報を追加する 510 * 511 * @param Array $arrProducts 商品一覧情報 512 * @param Array $arrStatus ステータス配列 513 * @param Array $arrStatusImage スタータス画像配列 514 * @return Array $arrProducts 商品一覧情報 515 */ 516 function setStatusData($arrProducts, $arrStatus, $arrStatusImage){ 517 518 foreach($arrProducts['productStatus'] as $keyArr => $valArr){ 519 for($i=0; $i<count($valArr); $i++){ 520 $statusCd = $valArr[$i]; 521 if(!empty($statusCd)){ 522 $statusAry = array('status_cd'=>$statusCd, 'status_name'=>$arrStatus[$statusCd], 'status_image' =>$arrStatusImage[$statusCd]); 523 $arrProducts['productStatus'][$keyArr][$i] = $statusAry; 524 525 } 526 } 527 } 528 return $arrProducts; 529 } 530 531 /** 532 * 商品情報配列に税込み金額を追加する 533 * 534 * @param Array $arrProducts 商品一覧情報 535 * @return Array $arrProducts 商品一覧情報 536 */ 537 function setPriceTax($arrProducts){ 538 foreach($arrProducts as $key=>$val){ 539 $arrProducts[$key]['price01_min_format'] = number_format($arrProducts[$key]['price01_min']); 540 $arrProducts[$key]['price01_max_format'] = number_format($arrProducts[$key]['price01_max']); 541 $arrProducts[$key]['price02_min_format'] = number_format($arrProducts[$key]['price02_min']); 542 $arrProducts[$key]['price02_max_format'] = number_format($arrProducts[$key]['price02_max']); 543 544 $arrProducts[$key]['price01_min_tax'] = SC_Helper_DB::sfCalcIncTax($arrProducts[$key]['price01_min']); 545 $arrProducts[$key]['price01_max_tax'] = SC_Helper_DB::sfCalcIncTax($arrProducts[$key]['price01_max']); 546 $arrProducts[$key]['price02_min_tax'] = SC_Helper_DB::sfCalcIncTax($arrProducts[$key]['price02_min']); 547 $arrProducts[$key]['price02_max_tax'] = SC_Helper_DB::sfCalcIncTax($arrProducts[$key]['price02_max']); 548 549 $arrProducts[$key]['price01_min_tax_format'] = number_format($arrProducts[$key]['price01_min_tax']); 550 $arrProducts[$key]['price01_max_tax_format'] = number_format($arrProducts[$key]['price01_max_tax']); 551 $arrProducts[$key]['price02_min_tax_format'] = number_format($arrProducts[$key]['price02_min_tax']); 552 $arrProducts[$key]['price02_max_tax_format'] = number_format($arrProducts[$key]['price02_max_tax']); 553 } 554 return $arrProducts; 555 } 490 556 } 491 557 ?>
Note: See TracChangeset
for help on using the changeset viewer.