- Timestamp:
- 2012/07/04 10:13:22 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_12-dev/data/class/pages/products/LC_Page_Products_List.php
r21953 r21957 135 135 136 136 case 'json': 137 $this->doJson($objProduct); 137 $this->arrProducts = $this->setStatusDataTo($this->arrProducts, $this->arrSTATUS, $this->arrSTATUS_IMAGE); 138 $this->arrProducts = $objProduct->setPriceTaxTo($this->arrProducts); 139 140 // 一覧メイン画像の指定が無い商品のための処理 141 foreach ($this->arrProducts as $key=>$val) { 142 $this->arrProducts[$key]['main_list_image'] = SC_Utils_Ex::sfNoImageMainList($val['main_list_image']); 143 } 144 145 echo SC_Utils_Ex::jsonEncode($this->arrProducts); 146 SC_Response_Ex::actionExit(); 138 147 break; 139 148 140 149 default: 141 $this->doDefault($objProduct); 150 151 //商品一覧の表示処理 152 $strnavi = $this->objNavi->strnavi; 153 // 表示文字列 154 $this->tpl_strnavi = empty($strnavi) ? ' ' : $strnavi; 155 156 // 規格1クラス名 157 $this->tpl_class_name1 = $objProduct->className1; 158 159 // 規格2クラス名 160 $this->tpl_class_name2 = $objProduct->className2; 161 162 // 規格1 163 $this->arrClassCat1 = $objProduct->classCats1; 164 165 // 規格1が設定されている 166 $this->tpl_classcat_find1 = $objProduct->classCat1_find; 167 // 規格2が設定されている 168 $this->tpl_classcat_find2 = $objProduct->classCat2_find; 169 170 $this->tpl_stock_find = $objProduct->stock_find; 171 $this->tpl_product_class_id = $objProduct->product_class_id; 172 $this->tpl_product_type = $objProduct->product_type; 173 174 // 商品ステータスを取得 175 $this->productStatus = $this->arrProducts['productStatus']; 176 unset($this->arrProducts['productStatus']); 177 $this->tpl_javascript .= 'var productsClassCategories = ' . SC_Utils_Ex::jsonEncode($objProduct->classCategories) . ';'; 178 //onloadスクリプトを設定. 在庫ありの商品のみ出力する 179 foreach ($this->arrProducts as $arrProduct) { 180 if ($arrProduct['stock_unlimited_max'] || $arrProduct['stock_max'] > 0) { 181 $js_fnOnLoad .= "fnSetClassCategories(document.product_form{$arrProduct['product_id']});"; 182 } 183 } 184 185 //カート処理 186 $target_product_id = intval($this->arrForm['product_id']); 187 if ($target_product_id > 0) { 188 // 商品IDの正当性チェック 189 if (!SC_Utils_Ex::sfIsInt($this->arrForm['product_id']) 190 || !SC_Helper_DB_Ex::sfIsRecord('dtb_products', 'product_id', $this->arrForm['product_id'], 'del_flg = 0 AND status = 1')) { 191 SC_Utils_Ex::sfDispSiteError(PRODUCT_NOT_FOUND); 192 } 193 194 // 入力内容のチェック 195 $arrErr = $this->lfCheckError($target_product_id, $this->arrForm, $this->tpl_classcat_find1, $this->tpl_classcat_find2); 196 if (empty($arrErr)) { 197 $this->lfAddCart($this->arrForm, $_SERVER['HTTP_REFERER']); 198 199 200 SC_Response_Ex::sendRedirect(CART_URLPATH); 201 SC_Response_Ex::actionExit(); 202 } 203 $js_fnOnLoad .= $this->lfSetSelectedData($this->arrProducts, $this->arrForm, $arrErr, $target_product_id); 204 } else { 205 // カート「戻るボタン」用に保持 206 $netURL = new Net_URL(); 207 //該当メソッドが無いため、$_SESSIONに直接セット 208 $_SESSION['cart_referer_url'] = $netURL->getURL(); 209 } 210 211 $this->tpl_javascript .= 'function fnOnLoad(){' . $js_fnOnLoad . '}'; 212 $this->tpl_onload .= 'fnOnLoad(); '; 142 213 break; 143 214 } … … 445 516 return $arrProducts; 446 517 } 447 448 /**449 *450 * @param type $objProduct451 * @return void452 */453 function doJson(&$objProduct) {454 $this->arrProducts = $this->setStatusDataTo($this->arrProducts, $this->arrSTATUS, $this->arrSTATUS_IMAGE);455 $this->arrProducts = $objProduct->setPriceTaxTo($this->arrProducts);456 457 // 一覧メイン画像の指定が無い商品のための処理458 foreach ($this->arrProducts as $key=>$val) {459 $this->arrProducts[$key]['main_list_image'] = SC_Utils_Ex::sfNoImageMainList($val['main_list_image']);460 }461 462 echo SC_Utils_Ex::jsonEncode($this->arrProducts);463 SC_Response_Ex::actionExit();464 }465 466 /**467 *468 * @param type $objProduct469 * @return void470 */471 function doDefault(&$objProduct) {472 //商品一覧の表示処理473 $strnavi = $this->objNavi->strnavi;474 // 表示文字列475 $this->tpl_strnavi = empty($strnavi) ? ' ' : $strnavi;476 477 // 規格1クラス名478 $this->tpl_class_name1 = $objProduct->className1;479 480 // 規格2クラス名481 $this->tpl_class_name2 = $objProduct->className2;482 483 // 規格1484 $this->arrClassCat1 = $objProduct->classCats1;485 486 // 規格1が設定されている487 $this->tpl_classcat_find1 = $objProduct->classCat1_find;488 // 規格2が設定されている489 $this->tpl_classcat_find2 = $objProduct->classCat2_find;490 491 $this->tpl_stock_find = $objProduct->stock_find;492 $this->tpl_product_class_id = $objProduct->product_class_id;493 $this->tpl_product_type = $objProduct->product_type;494 495 // 商品ステータスを取得496 $this->productStatus = $this->arrProducts['productStatus'];497 unset($this->arrProducts['productStatus']);498 $this->tpl_javascript .= 'var productsClassCategories = ' . SC_Utils_Ex::jsonEncode($objProduct->classCategories) . ';';499 //onloadスクリプトを設定. 在庫ありの商品のみ出力する500 foreach ($this->arrProducts as $arrProduct) {501 if ($arrProduct['stock_unlimited_max'] || $arrProduct['stock_max'] > 0) {502 $js_fnOnLoad .= "fnSetClassCategories(document.product_form{$arrProduct['product_id']});";503 }504 }505 506 //カート処理507 $target_product_id = intval($this->arrForm['product_id']);508 if ($target_product_id > 0) {509 // 商品IDの正当性チェック510 if (!SC_Utils_Ex::sfIsInt($this->arrForm['product_id'])511 || !SC_Helper_DB_Ex::sfIsRecord('dtb_products', 'product_id', $this->arrForm['product_id'], 'del_flg = 0 AND status = 1')) {512 SC_Utils_Ex::sfDispSiteError(PRODUCT_NOT_FOUND);513 }514 515 // 入力内容のチェック516 $arrErr = $this->lfCheckError($target_product_id, $this->arrForm, $this->tpl_classcat_find1, $this->tpl_classcat_find2);517 if (empty($arrErr)) {518 $this->lfAddCart($this->arrForm, $_SERVER['HTTP_REFERER']);519 520 521 SC_Response_Ex::sendRedirect(CART_URLPATH);522 SC_Response_Ex::actionExit();523 }524 $js_fnOnLoad .= $this->lfSetSelectedData($this->arrProducts, $this->arrForm, $arrErr, $target_product_id);525 } else {526 // カート「戻るボタン」用に保持527 $netURL = new Net_URL();528 //該当メソッドが無いため、$_SESSIONに直接セット529 $_SESSION['cart_referer_url'] = $netURL->getURL();530 }531 532 $this->tpl_javascript .= 'function fnOnLoad(){' . $js_fnOnLoad . '}';533 $this->tpl_onload .= 'fnOnLoad(); ';534 }535 518 }
Note: See TracChangeset
for help on using the changeset viewer.