Changeset 17777
- Timestamp:
- 2009/02/13 22:18:44 (15 years ago)
- Location:
- branches/version-2_4/data/class/pages/admin/products
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_4/data/class/pages/admin/products/LC_Page_Admin_Products.php
r17719 r17777 222 222 if ($element != ""){ 223 223 if ($tmp_where == ""){ 224 $tmp_where.="AND (status =? ";224 $tmp_where.="AND (status LIKE ? "; 225 225 }else{ 226 $tmp_where.="OR status =? ";226 $tmp_where.="OR status LIKE ? "; 227 227 } 228 228 $arrval[]=$element; -
branches/version-2_4/data/class/pages/admin/products/LC_Page_Admin_Products_ProductSelect.php
r17202 r17777 62 62 $objSess = new SC_Session(); 63 63 $objDb = new SC_Helper_DB_Ex(); 64 $objQuery = new SC_Query(); 64 65 65 66 // 認証可否の判定 … … 67 68 68 69 if (!isset($_POST['mode'])) $_POST['mode'] = ""; 70 71 if ($_GET['no'] != '') { 72 $this->tpl_no = strval($_GET['no']); 73 }elseif ($_POST['no'] != '') { 74 $this->tpl_no = strval($_POST['no']); 75 } 69 76 70 77 if ($_POST['mode'] == "search") { … … 82 89 continue; 83 90 } 84 85 91 switch ($key) { 86 92 case 'search_name': … … 104 110 } 105 111 112 113 /* 106 114 $order = "update_date DESC, product_id DESC "; 107 115 … … 109 117 $col = "product_id, name, category_id, main_list_image, status, product_code, price01, stock, stock_unlimited"; 110 118 $from = "vw_products_nonclass AS noncls "; 119 */ 120 $col = "DISTINCT T1.product_id, product_code_min, product_code_max," 121 . " price01_min, price01_max, price02_min, price02_max," 122 . " stock_min, stock_max, stock_unlimited_min," 123 . " stock_unlimited_max, del_flg, status, name, comment1," 124 . " comment2, comment3, main_list_comment, main_image," 125 . " main_list_image, product_flag, deliv_date_id, sale_limit," 126 . " point_rate, sale_unlimited, create_date, deliv_fee, " 127 . " T4.product_rank, T4.category_rank"; 128 $from = "vw_products_allclass AS T1" 129 . " JOIN (" 130 . " SELECT max(T3.rank) AS category_rank," 131 . " max(T2.rank) AS product_rank," 132 . " T2.product_id" 133 . " FROM dtb_product_categories T2" 134 . " JOIN dtb_category T3 USING (category_id)" 135 . " GROUP BY product_id) AS T4 USING (product_id)"; 136 $order = "T4.category_rank DESC, T4.product_rank DESC"; 111 137 112 138 $objQuery = new SC_Query(); … … 141 167 // 検索結果の取得 142 168 $this->arrProducts = $objQuery->select($col, $from, $where, $arrval); 169 170 // 規格名一覧 171 $arrClassName = $objDb->sfGetIDValueList("dtb_class", "class_id", "name"); 172 173 // 規格分類名一覧 174 $arrClassCatName = $objDb->sfGetIDValueList("dtb_classcategory", "classcategory_id", "name"); 175 176 // 規格セレクトボックス設定 177 for($i = 0; $i < count($this->arrProducts); $i++) { 178 $this->lfMakeSelect($this->arrProducts[$i]['product_id'], $arrClassName, $arrClassCatName); 179 // 購入制限数を取得 180 $this->lfGetSaleLimit($this->arrProducts[$i]); 181 } 143 182 } 144 183 … … 180 219 } 181 220 } 221 222 /* 規格セレクトボックスの作成 */ 223 function lfMakeSelect($product_id, $arrClassName, $arrClassCatName) { 224 225 $classcat_find1 = false; 226 $classcat_find2 = false; 227 // 在庫ありの商品の有無 228 $stock_find = false; 229 230 // 商品規格情報の取得 231 $arrProductsClass = $this->lfGetProductsClass($product_id); 232 233 // 規格1クラス名の取得 234 $this->tpl_class_name1[$product_id] = 235 isset($arrClassName[$arrProductsClass[0]['class_id1']]) 236 ? $arrClassName[$arrProductsClass[0]['class_id1']] 237 : ""; 238 239 // 規格2クラス名の取得 240 $this->tpl_class_name2[$product_id] = 241 isset($arrClassName[$arrProductsClass[0]['class_id2']]) 242 ? $arrClassName[$arrProductsClass[0]['class_id2']] 243 : ""; 244 245 // すべての組み合わせ数 246 $count = count($arrProductsClass); 247 248 $classcat_id1 = ""; 249 250 $arrSele = array(); 251 $arrList = array(); 252 253 $list_id = 0; 254 $arrList[0] = "\tlist". $product_id. "_0 = new Array('選択してください'"; 255 $arrVal[0] = "\tval". $product_id. "_0 = new Array(''"; 256 257 for ($i = 0; $i < $count; $i++) { 258 // 在庫のチェック 259 if($arrProductsClass[$i]['stock'] <= 0 && $arrProductsClass[$i]['stock_unlimited'] != '1') { 260 continue; 261 } 262 263 $stock_find = true; 264 265 // 規格1のセレクトボックス用 266 if($classcat_id1 != $arrProductsClass[$i]['classcategory_id1']){ 267 $arrList[$list_id].=");\n"; 268 $arrVal[$list_id].=");\n"; 269 $classcat_id1 = $arrProductsClass[$i]['classcategory_id1']; 270 $arrSele[$classcat_id1] = $arrClassCatName[$classcat_id1]; 271 $list_id++; 272 273 $arrList[$list_id] = ""; 274 $arrVal[$list_id] = ""; 275 } 276 277 // 規格2のセレクトボックス用 278 $classcat_id2 = $arrProductsClass[$i]['classcategory_id2']; 279 280 // セレクトボックス表示値 281 if($arrList[$list_id] == "") { 282 $arrList[$list_id] = "\tlist". $product_id. "_". $list_id. " = new Array('選択してください', '". $arrClassCatName[$classcat_id2]. "'"; 283 } else { 284 $arrList[$list_id].= ", '".$arrClassCatName[$classcat_id2]."'"; 285 } 286 287 // セレクトボックスPOST値 288 if($arrVal[$list_id] == "") { 289 $arrVal[$list_id] = "\tval". $product_id. "_". $list_id. " = new Array('', '". $classcat_id2. "'"; 290 } else { 291 $arrVal[$list_id].= ", '".$classcat_id2."'"; 292 } 293 } 294 295 $arrList[$list_id].=");\n"; 296 $arrVal[$list_id].=");\n"; 297 298 // 規格1 299 $this->arrClassCat1[$product_id] = $arrSele; 300 301 $lists = "\tlists".$product_id. " = new Array("; 302 $no = 0; 303 foreach($arrList as $val) { 304 $this->tpl_javascript.= $val; 305 if ($no != 0) { 306 $lists.= ",list". $product_id. "_". $no; 307 } else { 308 $lists.= "list". $product_id. "_". $no; 309 } 310 $no++; 311 } 312 $this->tpl_javascript.= $lists.");\n"; 313 314 $vals = "\tvals".$product_id. " = new Array("; 315 $no = 0; 316 foreach($arrVal as $val) { 317 $this->tpl_javascript.= $val; 318 if ($no != 0) { 319 $vals.= ",val". $product_id. "_". $no; 320 } else { 321 $vals.= "val". $product_id. "_". $no; 322 } 323 $no++; 324 } 325 $this->tpl_javascript.= $vals.");\n"; 326 327 // 選択されている規格2ID 328 $classcategory_id = "classcategory_id". $product_id; 329 330 $classcategory_id_2 = $classcategory_id . "_2"; 331 if (!isset($classcategory_id_2)) $classcategory_id_2 = ""; 332 if (!isset($_POST[$classcategory_id_2])) $_POST[$classcategory_id_2] = ""; 333 334 $this->tpl_onload .= "lnSetSelect('" . $classcategory_id ."_1', " 335 . "'" . $classcategory_id_2 . "'," 336 . "'" . $product_id . "'," 337 . "'" . $_POST[$classcategory_id_2] ."'); "; 338 339 // 規格1が設定されている 340 if($arrProductsClass[0]['classcategory_id1'] != '0') { 341 $classcat_find1 = true; 342 } 343 344 // 規格2が設定されている 345 if($arrProductsClass[0]['classcategory_id2'] != '0') { 346 $classcat_find2 = true; 347 } 348 349 $this->tpl_classcat_find1[$product_id] = $classcat_find1; 350 $this->tpl_classcat_find2[$product_id] = $classcat_find2; 351 $this->tpl_stock_find[$product_id] = $stock_find; 352 } 353 354 /* 商品規格情報の取得 */ 355 function lfGetProductsClass($product_id) { 356 $arrRet = array(); 357 if(SC_Utils_Ex::sfIsInt($product_id)) { 358 // 商品規格取得 359 $objQuery = new SC_Query(); 360 $col = "product_class_id, classcategory_id1, classcategory_id2, class_id1, class_id2, stock, stock_unlimited"; 361 $table = "vw_product_class AS prdcls"; 362 $where = "product_id = ?"; 363 $objQuery->setorder("rank1 DESC, rank2 DESC"); 364 $arrRet = $objQuery->select($col, $table, $where, array($product_id)); 365 } 366 return $arrRet; 367 } 368 369 // 購入制限数の設定 370 function lfGetSaleLimit($product) { 371 //在庫が無限または購入制限値が設定値より大きい場合 372 if($product['sale_unlimited'] == 1 || $product['sale_limit'] > SALE_LIMIT_MAX) { 373 $this->tpl_sale_limit[$product['product_id']] = SALE_LIMIT_MAX; 374 } else { 375 $this->tpl_sale_limit[$product['product_id']] = $product['sale_limit']; 376 } 377 } 182 378 } 183 379 ?>
Note: See TracChangeset
for help on using the changeset viewer.