Changeset 20076 for branches/version-2_5-dev/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_SearchProducts.php
- Timestamp:
- 2011/02/03 18:40:05 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_5-dev/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_SearchProducts.php
r19805 r20076 63 63 */ 64 64 function action() { 65 $arrSearch = array(); // 検索項目表示用66 $objDb = new SC_Helper_DB_Ex();67 65 // 選択中のカテゴリIDを判定する 68 $this->category_id = $ objDb->sfGetCategoryId($_GET['product_id'], $_GET['category_id']);66 $this->category_id = $this->lfGetSelectedCategoryId(); 69 67 // カテゴリ検索用選択リスト 70 $arrRet = $objDb->sfGetCategoryList('', true, ' '); 71 72 if(is_array($arrRet)) { 73 // 文字サイズを制限する 74 foreach($arrRet as $key => $val) { 75 $str = SC_Utils_Ex::sfCutString($val, SEARCH_CATEGORY_LEN, false); 76 $arrRet[$key] = preg_replace('/ /', " ", $str); 77 } 78 } 79 $this->arrCatList = $arrRet; 80 68 $this->arrCatList = $this->lfGetCategoryList(); 81 69 // 選択中のメーカーIDを判定する 82 $this->maker_id = $ objDb->sfGetMakerId($_GET['product_id'], $_GET['maker_id']);70 $this->maker_id = $this->lfGetSelectedMakerId(); 83 71 // メーカー検索用選択リスト 84 $arrRet = $objDb->sfGetMakerList('', true); 85 if(is_array($arrRet)) { 86 // 文字サイズを制限する 87 foreach($arrRet as $key => $val) { 88 $arrRet[$key] = SC_Utils_Ex::sfCutString($val, SEARCH_CATEGORY_LEN); 89 } 90 } 91 $this->arrMakerList = $arrRet; 72 $this->arrMakerList = $this->lfGetMakerList(); 92 73 } 93 74 … … 100 81 parent::destroy(); 101 82 } 83 84 /** 85 * 選択中のカテゴリIDを取得する 86 * 87 * @return array $arrCategoryId 選択中のカテゴリID 88 */ 89 function lfGetSelectedCategoryId() { 90 // 商品ID取得 91 if ( !isset($_GET['product_id']) || $_GET['product_id'] == '' || !is_numeric($_GET['product_id']) ) { 92 return array(); 93 } 94 $product_id = $_GET['product_id']; 95 // カテゴリID取得 96 if ( !isset($_GET['category_id']) || $_GET['category_id'] == '' || !is_numeric($_GET['category_id']) ) { 97 return array(); 98 } 99 $category_id = $_GET['category_id']; 100 // 選択中のカテゴリIDを判定する 101 $objDb = new SC_Helper_DB_Ex(); 102 $arrCategoryId = $objDb->sfGetCategoryId($product_id, $category_id); 103 return $arrCategoryId; 104 } 105 106 /** 107 * 選択中のメーカーIDを取得する 108 * 109 * @return array $arrMakerId 選択中のメーカーID 110 */ 111 function lfGetSelectedMakerId() { 112 // 商品ID取得 113 if ( !isset($_GET['product_id']) || $_GET['product_id'] == '' || !is_numeric($_GET['product_id']) ) { 114 return array(); 115 } 116 $product_id = $_GET['product_id']; 117 // メーカーID取得 118 if ( !isset($_GET['maker_id']) || $_GET['maker_id'] == '' || !is_numeric($_GET['maker_id']) ) { 119 return array(); 120 } 121 $maker_id = $_GET['maker_id']; 122 // 選択中のメーカーIDを判定する 123 $objDb = new SC_Helper_DB_Ex(); 124 $arrMakerId = $objDb->sfGetMakerId($product_id, $maker_id); 125 return $arrMakerId; 126 } 127 128 /** 129 * カテゴリ検索用選択リストを取得する 130 * 131 * @return array $arrCategoryList カテゴリ検索用選択リスト 132 */ 133 function lfGetCategoryList() { 134 $objDb = new SC_Helper_DB_Ex(); 135 // カテゴリ検索用選択リスト 136 $arrCategoryList = $objDb->sfGetCategoryList('', true, ' '); 137 if (is_array($arrCategoryList)) { 138 // 文字サイズを制限する 139 foreach($arrCategoryList as $key => $val) { 140 $truncate_str = SC_Utils_Ex::sfCutString($val, SEARCH_CATEGORY_LEN, false); 141 $arrCategoryList[$key] = preg_replace('/ /', " ", $truncate_str); 142 } 143 } 144 return $arrCategoryList; 145 } 146 147 /** 148 * メーカー検索用選択リストを取得する 149 * 150 * @return array $arrMakerList メーカー検索用選択リスト 151 */ 152 function lfGetMakerList() { 153 $objDb = new SC_Helper_DB_Ex(); 154 // メーカー検索用選択リスト 155 $arrMakerList = $objDb->sfGetMakerList('', true); 156 if (is_array($arrMakerList)) { 157 // 文字サイズを制限する 158 foreach($arrMakerList as $key => $val) { 159 $arrMakerList[$key] = SC_Utils_Ex::sfCutString($val, SEARCH_CATEGORY_LEN); 160 } 161 } 162 return $arrMakerList; 163 } 164 102 165 } 103 166 ?>
Note: See TracChangeset
for help on using the changeset viewer.