Changeset 20191
- Timestamp:
- 2011/02/18 14:03:46 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_5-dev/data/class/pages/admin/products/LC_Page_Admin_Products_ProductSelect.php
r20116 r20191 82 82 // 入力文字の強制変換 83 83 $this->lfConvertParam(); 84 85 $where = "del_flg = 0"; 86 87 /* 入力エラーなし */ 88 foreach ($this->arrForm as $key => $val) { 89 if($val == "") { 90 continue; 91 } 92 93 switch ($key) { 94 case 'search_name': 95 $where .= " AND name ILIKE ?"; 96 $arrval[] = "%$val%"; 97 break; 98 case 'search_category_id': 99 list($tmp_where, $tmp_arrval) = $objDb->sfGetCatWhere($val); 100 if($tmp_where != "") { 101 $where.= " AND product_id IN (SELECT product_id FROM dtb_product_categories WHERE " . $tmp_where . ")"; 102 $arrval = array_merge((array)$arrval, (array)$tmp_arrval); 103 } 104 break; 105 case 'search_product_code': 106 $where .= " AND product_id IN (SELECT product_id FROM dtb_products_class WHERE product_code LIKE ? GROUP BY product_id)"; 107 $arrval[] = "$val%"; 108 break; 109 default: 110 break; 111 } 112 } 113 114 $order = "update_date DESC, product_id DESC "; 115 116 $objQuery = new SC_Query(); 117 // 行数の取得 118 if (empty($arrval)) { 119 $arrval = array(); 120 } 121 $linemax = $objQuery->count("dtb_products", $where, $arrval); 122 $this->tpl_linemax = $linemax; // 何件が該当しました。表示用 123 124 // ページ送りの処理 125 if(isset($_POST['search_page_max']) 126 && is_numeric($_POST['search_page_max'])) { 127 $page_max = $_POST['search_page_max']; 128 } else { 129 $page_max = SEARCH_PMAX; 130 } 131 132 // ページ送りの取得 133 $objNavi = new SC_PageNavi($_POST['search_pageno'], $linemax, $page_max, "fnNaviSearchOnlyPage", NAVI_PMAX); 134 $this->tpl_strnavi = $objNavi->strnavi; // 表示文字列 135 $startno = $objNavi->start_row; 136 137 // 取得範囲の指定(開始行番号、行数のセット) 138 $objQuery->setLimitOffset($page_max, $startno); 139 // 表示順序 140 $objQuery->setOrder($order); 141 142 // 検索結果の取得 143 // FIXME 商品コードの表示 144 $this->arrProducts = $objQuery->select("*", SC_Product::alldtlSQL(), $where, $arrval); 84 $this->arrProducts = $this->lfGetProducts($objDb); 145 85 break; 146 86 default: … … 182 122 } 183 123 } 124 125 /* 商品検索結果取得 */ 126 function lfGetProducts(&$objDb) { 127 $where = "del_flg = 0"; 128 129 /* 入力エラーなし */ 130 foreach ($this->arrForm AS $key=>$val) { 131 if($val == "") continue; 132 133 switch ($key) { 134 case 'search_name': 135 $where .= " AND name ILIKE ?"; 136 $arrval[] = "%$val%"; 137 break; 138 case 'search_category_id': 139 list($tmp_where, $tmp_arrval) = $objDb->sfGetCatWhere($val); 140 if($tmp_where != "") { 141 $where.= " AND product_id IN (SELECT product_id FROM dtb_product_categories WHERE " . $tmp_where . ")"; 142 $arrval = array_merge((array)$arrval, (array)$tmp_arrval); 143 } 144 break; 145 case 'search_product_code': 146 $where .= " AND product_id IN (SELECT product_id FROM dtb_products_class WHERE product_code LIKE ? GROUP BY product_id)"; 147 $arrval[] = "$val%"; 148 break; 149 default: 150 break; 151 } 152 } 153 154 $order = "update_date DESC, product_id DESC "; 155 156 $objQuery = new SC_Query(); 157 // 行数の取得 158 if (empty($arrval)) { 159 $arrval = array(); 160 } 161 $linemax = $objQuery->count("dtb_products", $where, $arrval); 162 $this->tpl_linemax = $linemax; // 何件が該当しました。表示用 163 164 // ページ送りの処理 165 if(isset($_POST['search_page_max']) 166 && is_numeric($_POST['search_page_max'])) { 167 $page_max = $_POST['search_page_max']; 168 } else { 169 $page_max = SEARCH_PMAX; 170 } 171 172 // ページ送りの取得 173 $objNavi = new SC_PageNavi($_POST['search_pageno'], $linemax, $page_max, "fnNaviSearchOnlyPage", NAVI_PMAX); 174 $this->tpl_strnavi = $objNavi->strnavi; // 表示文字列 175 $startno = $objNavi->start_row; 176 177 // 取得範囲の指定(開始行番号、行数のセット) 178 $objQuery->setLimitOffset($page_max, $startno); 179 // 表示順序 180 $objQuery->setOrder($order); 181 182 // 検索結果の取得 183 // FIXME 商品コードの表示 184 $arrProducts = $objQuery->select("*", SC_Product::alldtlSQL(), $where, $arrval); 185 return $arrProducts; 186 } 184 187 } 185 188 ?>
Note: See TracChangeset
for help on using the changeset viewer.