Changeset 17853
- Timestamp:
- 2009/02/28 02:41:32 (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/comu-ver2/data/class/pages/products/LC_Page_Products_List.php
r17744 r17853 391 391 $objDb = new SC_Helper_DB_Ex(); 392 392 $this->tpl_pageno = defined("MOBILE_SITE") ? @$_GET['pageno'] : @$_POST['pageno']; 393 393 $arrval = array(); 394 $arrval_order = array(); 395 396 // カテゴリからのWHERE文字列取得 397 if ( $category_id ) { 398 list($tmp_where, $arrval_category) = $objDb->sfGetCatWhere($category_id); 399 if (strlen($tmp_where) >= 1) { 400 $where_category = "AND $tmp_where"; 401 } 402 } 403 404 $col = <<< __EOS__ 405 product_id 406 ,product_code_min 407 ,product_code_max 408 ,name 409 ,comment1 410 ,comment2 411 ,comment3 412 ,main_list_comment 413 ,main_image 414 ,main_list_image 415 ,price01_min 416 ,price01_max 417 ,price02_min 418 ,price02_max 419 ,stock_min 420 ,stock_max 421 ,stock_unlimited_min 422 ,stock_unlimited_max 423 ,point_rate 424 ,sale_limit 425 ,sale_unlimited 426 ,deliv_date_id 427 ,deliv_fee 428 ,status 429 ,product_flag 430 ,del_flg 431 __EOS__; 432 $from = "vw_products_allclass AS allcls"; 433 394 434 //表示順序 395 435 switch($orderby) { 396 436 397 //販売価格順 398 case 'price': 399 $col = "DISTINCT price02_min, product_id, product_code_min, product_code_max," 400 . " name, comment1, comment2, comment3," 401 . " main_list_comment, main_image, main_list_image," 402 . " price01_min, price01_max, price02_max," 403 . " stock_min, stock_max, stock_unlimited_min, stock_unlimited_max," 404 . " point_rate, sale_limit, sale_unlimited, deliv_date_id, deliv_fee," 405 . " status, product_flag, create_date, del_flg"; 406 $from = "vw_products_allclass AS allcls"; 407 $order = "price02_min, product_id"; 408 break; 409 410 //新着順 411 case 'date': 412 $col = "DISTINCT create_date, product_id, product_code_min, product_code_max," 413 . " name, comment1, comment2, comment3," 414 . " main_list_comment, main_image, main_list_image," 415 . " price01_min, price01_max, price02_min, price02_max," 416 . " stock_min, stock_max, stock_unlimited_min, stock_unlimited_max," 417 . " point_rate, sale_limit, sale_unlimited, deliv_date_id, deliv_fee," 418 . " status, product_flag, del_flg"; 419 $from = "vw_products_allclass AS allcls"; 420 $order = "create_date DESC, product_id"; 421 break; 422 423 default: 424 $col = "DISTINCT allcls.product_id, product_code_min, product_code_max," 425 . " price01_min, price01_max, price02_min, price02_max," 426 . " stock_min, stock_max, stock_unlimited_min," 427 . " stock_unlimited_max, del_flg, status, name, comment1," 428 . " comment2, comment3, main_list_comment, main_image," 429 . " main_list_image, product_flag, deliv_date_id, sale_limit," 430 . " point_rate, sale_unlimited, create_date, deliv_fee, " 431 . " T4.product_rank, T4.category_rank"; 432 $from = "vw_products_allclass AS allcls" 433 . " JOIN (" 434 . " SELECT max(T3.rank) AS category_rank," 435 . " max(T2.rank) AS product_rank," 436 . " T2.product_id" 437 . " FROM dtb_product_categories T2" 438 . " JOIN dtb_category T3 USING (category_id)" 439 . " GROUP BY product_id) AS T4 USING (product_id)"; 440 $order = "T4.category_rank DESC, T4.product_rank DESC"; 441 break; 437 //販売価格順 438 case 'price': 439 $order = "price02_min, product_id"; 440 break; 441 442 //新着順 443 case 'date': 444 $order = "create_date DESC, product_id"; 445 break; 446 447 default: 448 $order = <<< __EOS__ 449 ( 450 SELECT 451 T3.rank 452 FROM 453 dtb_product_categories T2 454 JOIN dtb_category T3 455 USING (category_id) 456 WHERE T2.product_id = allcls.product_id 457 $where_category 458 ORDER BY T3.rank DESC, T2.rank DESC 459 LIMIT 1 460 ) DESC 461 ,( 462 SELECT 463 T2.rank 464 FROM 465 dtb_product_categories T2 466 JOIN dtb_category T3 467 USING (category_id) 468 WHERE T2.product_id = allcls.product_id 469 $where_category 470 ORDER BY T3.rank DESC, T2.rank DESC 471 LIMIT 1 472 ) DESC 473 ,product_id 474 __EOS__; 475 $arrval_order = array_merge($arrval_category, $arrval_category); 476 break; 442 477 } 443 478 … … 450 485 } 451 486 452 // カテゴリからのWHERE文字列取得 453 if ( $category_id ) { 454 list($tmp_where, $arrval) = $objDb->sfGetCatWhere($category_id); 455 if($tmp_where != "") { 456 $where.= " AND $tmp_where"; 457 } 487 if (strlen($where_category) >= 1) { 488 $where.= " $where_category"; 489 $arrval = array_merge($arrval, $arrval_category); 458 490 } 459 491 … … 479 511 $arrval[] = $maker_id; 480 512 } 481 482 if (empty($arrval)) { 483 $arrval = array(); 484 } 485 513 486 514 // 行数の取得 487 515 $linemax = count($objQuery->getAll("SELECT DISTINCT product_id " … … 507 535 508 536 // 検索結果の取得 509 $this->arrProducts = $objQuery->select($col, $from, $where, $arrval);537 $this->arrProducts = $objQuery->select($col, $from, $where, array_merge($arrval, $arrval_order)); 510 538 511 539 // 規格名一覧
Note: See TracChangeset
for help on using the changeset viewer.