Changeset 16546 for branches/feature-module-update/data/class/pages
- Timestamp:
- 2007/10/24 14:01:35 (17 years ago)
- Location:
- branches/feature-module-update/data/class/pages
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/feature-module-update/data/class/pages/admin/products/LC_Page_Admin_Products.php
r16379 r16546 169 169 break; 170 170 case 'search_category_id': // カテゴリー 171 list($tmp_where, $tmp_arrval) = SC_Utils_Ex::sfGetCatWhere($val);171 list($tmp_where, $tmp_arrval) = $objDb->sfGetCatWhere($val); 172 172 if($tmp_where != "") { 173 $where.= " AND $tmp_where";174 $view_where.= " AND $tmp_where";173 $where.= " AND product_id IN (SELECT product_id FROM dtb_product_categories WHERE " . $tmp_where . ")"; 174 $view_where.= " AND product_id IN (SELECT product_id FROM dtb_product_categories WHERE " . $tmp_where . ")"; 175 175 $arrval = array_merge((array)$arrval, (array)$tmp_arrval); 176 176 } … … 260 260 // 読み込む列とテーブルの指定 261 261 $col = "product_id, name, category_id, main_list_image, status, product_code, price01, price02, stock, stock_unlimited"; 262 $from = "vw_products_nonclass AS noncls ";262 $from = "vw_products_nonclass AS allcls "; 263 263 264 264 // 行数の取得 -
branches/feature-module-update/data/class/pages/admin/products/LC_Page_Admin_Products_Product.php
r15556 r16546 312 312 $where = "product_id = ?"; 313 313 314 // viewも絞込み(mysql対応) TODO315 //sfViewWhere("&&noncls_where&&", $where, array($product_id));316 317 314 $arrRet = $objQuery->select($col, $table, $where, array($product_id)); 315 316 // カテゴリID を取得 317 $arrRet[0]['category_id'] = $objQuery->getCol("dtb_product_categories", 318 "category_id", 319 "product_id = ?", 320 array($product_id)); 318 321 319 322 return $arrRet[0]; … … 327 330 list($this->arrCatVal, $this->arrCatOut) = $objDb->sfGetLevelCatList(false); 328 331 332 if (isset($this->arrForm['category_id']) && !is_array($this->arrForm['category_id'])) { 333 $this->arrForm['category_id'] = unserialize($this->arrForm['category_id']); 334 } 329 335 if($this->arrForm['status'] == "") { 330 336 $this->arrForm['status'] = 1; … … 351 357 } 352 358 353 $this->tpl_onload = "fnCheckSaleLimit('" . DISABLED_RGB . "'); fnCheckStockLimit('" . DISABLED_RGB . "'); " . $anchor_hash;359 $this->tpl_onload = "fnCheckSaleLimit('" . DISABLED_RGB . "'); fnCheckStockLimit('" . DISABLED_RGB . "'); fnMoveSelect('category_id_unselect', 'category_id');" . $anchor_hash; 354 360 } 355 361 … … 374 380 375 381 // 配列の添字を定義 376 $checkArray = array("name", " category_id", "status", "product_flag",382 $checkArray = array("name", "status", "product_flag", 377 383 "main_list_comment", "main_comment", "point_rate", 378 384 "deliv_fee", "comment1", "comment2", "comment3", … … 383 389 // INSERTする値を作成する。 384 390 $sqlval['name'] = $arrList['name']; 385 $sqlval['category_id'] = $arrList['category_id'];391 //$sqlval['category_id'] = $arrList['category_id']; 386 392 $sqlval['status'] = $arrList['status']; 387 393 $sqlval['product_flag'] = $arrList['product_flag']; … … 416 422 } 417 423 // カテゴリ内で最大のランクを割り当てる 418 $sqlval['rank'] = $objQuery->max("dtb_products", "rank", "category_id = ?", array($arrList['category_id'])) + 1; 424 //$sqlval['rank'] = $objQuery->max("dtb_products", "rank", "category_id = ?", array($arrList['category_id'])) + 1; 425 419 426 // INSERTの実行 420 427 $sqlval['create_date'] = "Now()"; 421 428 $objQuery->insert("dtb_products", $sqlval); 422 429 430 // カテゴリを更新 431 $objDb->updateProductCategories($arrList['category_id'], $sqlval['product_id']); 432 423 433 if (DB_TYPE == "mysql") { 424 434 $product_id = $objQuery->nextval("dtb_products", "product_id"); … … 427 437 428 438 // コピー商品の場合には規格もコピーする 429 if($_POST["copy_product_id"] != "" and sfIsInt($_POST["copy_product_id"])){439 if($_POST["copy_product_id"] != "" and SC_Utils_Ex::sfIsInt($_POST["copy_product_id"])){ 430 440 // dtb_products_class のカラムを取得 431 441 $dbFactory = SC_DB_DBFactory::getInstance(); … … 449 459 $this->objUpFile->deleteDBFile($arrRet); 450 460 451 // カテゴリ内ランクの調整処理 452 $old_catid = $objQuery->get("dtb_products", "category_id", "product_id = ?", array($arrList['product_id'])); 453 $objDb->sfMoveCatRank($objQuery, "dtb_products", "product_id", "category_id", $old_catid, $arrList['category_id'], $arrList['product_id']); 454 461 $arrList['category_id'] = unserialize($arrList['category_id']); 455 462 // UPDATEの実行 456 463 $where = "product_id = ?"; 457 464 $objQuery->update("dtb_products", $sqlval, $where, array($arrList['product_id'])); 465 466 // カテゴリを更新 467 $objDb->updateProductCategories($arrList['category_id'], $arrList['product_id']); 458 468 } 459 469 … … 526 536 $objErr = new SC_CheckError($array); 527 537 $objErr->doFunc(array("商品名", "name", STEXT_LEN), array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK")); 528 $objErr->doFunc(array("商品カテゴリ", "category_id", STEXT_LEN), array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK"));538 //$objErr->doFunc(array("商品カテゴリ", "category_id", STEXT_LEN), array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK")); 529 539 $objErr->doFunc(array("一覧-メインコメント", "main_list_comment", MTEXT_LEN), array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK")); 530 540 $objErr->doFunc(array("詳細-メインコメント", "main_comment", LLTEXT_LEN), array("EXIST_CHECK", "SPTAB_CHECK", "MAX_LENGTH_CHECK")); … … 549 559 $objErr->doFunc(array("購入制限", "sale_limit", AMOUNT_LEN), array("EXIST_CHECK", "SPTAB_CHECK", "ZERO_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK")); 550 560 } 551 561 /* 552 562 if(isset($objErr->arrErr['category_id'])) { 553 563 // 自動選択を防ぐためにダミー文字を入れておく 554 564 $this->arrForm['category_id'] = "#"; 555 565 } 556 566 */ 557 567 for ($cnt = 1; $cnt <= PRODUCTSUB_MAX; $cnt++) { 558 568 $objErr->doFunc(array("詳細-サブタイトル$cnt", "sub_title$cnt", STEXT_LEN), array("SPTAB_CHECK", "MAX_LENGTH_CHECK")); … … 572 582 } 573 583 584 // カテゴリID のチェック 585 if (empty($array['category_id'])) { 586 $objErr->arrErr['category_id'] = "※ カテゴリが選択されていません。<br />"; 587 } else { 588 $arrCategory_id = array(); 589 for ($i = 0; $i < count($array['category_id']); $i++) { 590 $arrCategory_id['category_id' . $i] = $array['category_id'][$i]; 591 } 592 $objCheckCategory = new SC_CheckError($arrCategory_id); 593 for ($i = 0; $i < count($array['category_id']); $i++) { 594 $objCheckCategory->doFunc(array("商品カテゴリ", "category_id" . $i, STEXT_LEN), array("SPTAB_CHECK", "MAX_LENGTH_CHECK")); 595 } 596 if (!empty($objCheckCategory->arrErr)) { 597 $objErr->arrErr = array_merge($objErr->arrErr, 598 $objCheckCategory->arrErr); 599 } 600 } 574 601 return $objErr->arrErr; 575 602 } … … 579 606 $this->tpl_mainpage = 'products/confirm.tpl'; 580 607 $this->arrForm['mode'] = 'complete'; 608 581 609 $objDb = new SC_Helper_DB_Ex(); 582 // カテゴリの読込 583 $this->arrCatList = $objDb->sfGetCategoryList(); 610 611 // カテゴリ表示 612 $this->arrCategory_id = $this->arrForm['category_id']; 613 $this->arrCatList = array(); 614 list($arrCatVal, $arrCatOut) = $objDb->sfGetLevelCatList(false); 615 for ($i = 0; $i < count($arrCatVal); $i++) { 616 $this->arrCatList[$arrCatVal[$i]] = $arrCatOut[$i]; 617 } 618 619 // hidden に渡す値は serialize する 620 $this->arrForm['category_id'] = serialize($this->arrForm['category_id']); 621 584 622 // Form用配列を渡す。 585 623 $this->arrFile = $this->objUpFile->getFormFileList(IMAGE_TEMP_URL, IMAGE_SAVE_URL); -
branches/feature-module-update/data/class/pages/admin/products/LC_Page_Admin_Products_ProductRank.php
r15532 r16546 58 58 switch($_POST['mode']) { 59 59 case 'up': 60 $where = "category_id = " . addslashes($_POST['parent_category_id']);61 $objDb->sfRankUp("dtb_product s", "product_id", $_POST['product_id'], $where);60 $where = "category_id = " . SC_Utils_Ex::sfQuoteSmart($_POST['parent_category_id']); 61 $objDb->sfRankUp("dtb_product_categories", "product_id", $_POST['product_id'], $where); 62 62 break; 63 63 case 'down': 64 $where = "category_id = " . addslashes($_POST['parent_category_id']);65 $objDb->sfRankDown("dtb_product s", "product_id", $_POST['product_id'], $where);64 $where = "category_id = " . SC_Utils_Ex::sfQuoteSmart($_POST['parent_category_id']); 65 $objDb->sfRankDown("dtb_product_categories", "product_id", $_POST['product_id'], $where); 66 66 break; 67 67 case 'move': … … 69 69 $input_pos = mb_convert_kana($_POST[$key], "n"); 70 70 if(SC_Utils_Ex::sfIsInt($input_pos)) { 71 $where = "category_id = " . addslashes($_POST['parent_category_id']);72 $objDb->sfMoveRank("dtb_product s", "product_id", $_POST['product_id'], $input_pos, $where);71 $where = "category_id = " . SC_Utils_Ex::sfQuoteSmart($_POST['parent_category_id']); 72 $objDb->sfMoveRank("dtb_product_categories", "product_id", $_POST['product_id'], $input_pos, "category_id = ?"); 73 73 } 74 74 break; … … 101 101 function lfGetProduct($category_id) { 102 102 $objQuery = new SC_Query(); 103 $col = "product_id, name, main_list_image, rank , product_code";104 $table = "vw_products_ nonclass AS noncls ";103 $col = "product_id, name, main_list_image, rank"; 104 $table = "vw_products_allclass "; 105 105 $where = "del_flg = 0 AND category_id = ?"; 106 106 107 107 // 行数の取得 108 $linemax = $objQuery->count("dtb_product s", $where, array($category_id));108 $linemax = $objQuery->count("dtb_product_categories", "category_id = ?", array($category_id)); 109 109 // 順位、該当件数表示用 110 110 $this->tpl_linemax = $linemax; -
branches/feature-module-update/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_Best5.php
r16530 r16546 88 88 $objQuery = new SC_Query(); 89 89 90 $col = " A.*, name, price02_min, price01_min, main_list_image ";90 $col = "DISTINCT A.*, name, price02_min, price01_min, main_list_image "; 91 91 $from = "dtb_best_products AS A INNER JOIN vw_products_allclass AS allcls using(product_id)"; 92 92 $where = "status = 1"; -
branches/feature-module-update/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_Category.php
r16530 r16546 42 42 43 43 // 選択中のカテゴリIDを判定する 44 $ category_id = $objDb->sfGetCategoryId($_GET['product_id'], $_GET['category_id']);44 $arrCategory_id = $objDb->sfGetCategoryId($_GET['product_id'], $_GET['category_id']); 45 45 46 46 // 選択中のカテゴリID 47 $this->tpl_category_id = $category_id;48 $ objPage = $this->lfGetCatTree($category_id, true, $this);47 $this->tpl_category_id = empty($arrCategory_id) ? array(0) : $arrCategory_id;; 48 $this->lfGetCatTree($this->tpl_category_id, true, $this); 49 49 50 $objSubView->assignobj($ objPage);50 $objSubView->assignobj($this); 51 51 $objSubView->display($this->tpl_mainpage); 52 52 } … … 86 86 87 87 // カテゴリツリーの取得 88 function lfGetCatTree($ parent_category_id, $count_check = false, $objSubPage) {88 function lfGetCatTree($arrParent_category_id, $count_check = false) { 89 89 $objQuery = new SC_Query(); 90 90 $objDb = new SC_Helper_DB_Ex(); … … 100 100 $arrRet = $objQuery->select($col, $from, $where); 101 101 102 $arrParentID = $objDb->sfGetParents($objQuery, 'dtb_category', 'parent_category_id', 'category_id', $parent_category_id); 103 $arrBrothersID = SC_Utils_Ex::sfGetBrothersArray($arrRet, 'parent_category_id', 'category_id', $arrParentID); 104 $arrChildrenID = SC_Utils_Ex::sfGetUnderChildrenArray($arrRet, 'parent_category_id', 'category_id', $parent_category_id); 102 foreach ($arrParent_category_id as $category_id) { 103 $arrParentID = $objDb->sfGetParents($objQuery, 'dtb_category', 'parent_category_id', 'category_id', $category_id); 104 $arrBrothersID = SC_Utils_Ex::sfGetBrothersArray($arrRet, 'parent_category_id', 'category_id', $arrParentID); 105 $arrChildrenID = SC_Utils_Ex::sfGetUnderChildrenArray($arrRet, 'parent_category_id', 'category_id', $category_id); 105 106 106 $objSubPage->root_parent_id= $arrParentID[0];107 $this->root_parent_id[] = $arrParentID[0]; 107 108 108 $arrDispID = array_merge($arrBrothersID, $arrChildrenID);109 $arrDispID = array_merge($arrBrothersID, $arrChildrenID); 109 110 110 foreach($arrRet as $key => $array) { 111 foreach($arrDispID as $val) { 112 if($array['category_id'] == $val) { 113 $arrRet[$key]['display'] = 1; 114 break; 111 foreach($arrRet as $key => $array) { 112 foreach($arrDispID as $val) { 113 if($array['category_id'] == $val) { 114 $arrRet[$key]['display'] = 1; 115 break; 116 } 115 117 } 116 118 } 117 119 } 118 120 119 $objSubPage->arrTree = $arrRet; 120 return $objSubPage; 121 $this->arrTree = $arrRet; 121 122 } 122 123 -
branches/feature-module-update/data/class/pages/products/LC_Page_Products_CategoryList.php
r16166 r16546 88 88 $objDb = new SC_Helper_DB_Ex(); 89 89 // カテゴリーの正しいIDを取得する。 90 $category_id = $objDb->sfGetCategoryId('', $category_id); 90 $arrCategory_id = $objDb->sfGetCategoryId('', $category_id); 91 $category_id = $arrCategory_id[0]; 91 92 if ($category_id == 0) { 92 93 SC_Utils_Ex::sfDispSiteError(CATEGORY_NOT_FOUND, "", false, "", true); -
branches/feature-module-update/data/class/pages/products/LC_Page_Products_Detail.php
r16398 r16546 188 188 189 189 // サブタイトルを取得 190 $arrFirstCat = $objDb->sfGetFirstCat($arrRet[0]['category_id']); 190 $arrCategory_id = $objDb->sfGetCategoryId($arrRet[0]['product_id']); 191 $arrFirstCat = $objDb->sfGetFirstCat($arrCategory_id[0]); 191 192 $this->tpl_subtitle = $arrFirstCat['name']; 192 193 … … 621 622 $arrSele1 = array(); 622 623 $arrSele2 = array(); 623 $arrList = array();624 625 $list_id = 0;626 $arrList[0] = "\tlist0 = new Array('選択してください'";627 $arrVal[0] = "\tval0 = new Array(''";628 624 629 625 for ($i = 0; $i < $count; $i++) { … … 637 633 // 規格1のセレクトボックス用 638 634 if($classcat_id1 != $arrProductsClass[$i]['classcategory_id1']){ 639 $arrList[$list_id].=");\n";640 $arrVal[$list_id].=");\n";641 635 $classcat_id1 = $arrProductsClass[$i]['classcategory_id1']; 642 636 $arrSele1[$classcat_id1] = $arrClassCatName[$classcat_id1]; … … 648 642 $arrSele2[$classcat_id2] = $arrClassCatName[$classcat_id2]; 649 643 } 650 651 $list_id++; 652 653 // セレクトボックス表示値 654 if($arrList[$list_id] == "") { 655 $arrList[$list_id] = "\tlist".$list_id." = new Array('選択してください', '".$arrClassCatName[$classcat_id2]."'"; 656 } else { 657 $arrList[$list_id].= ", '".$arrClassCatName[$classcat_id2]."'"; 658 } 659 660 // セレクトボックスPOST値 661 if($arrVal[$list_id] == "") { 662 $arrVal[$list_id] = "\tval".$list_id." = new Array('', '".$classcat_id2."'"; 663 } else { 664 $arrVal[$list_id].= ", '".$classcat_id2."'"; 665 } 666 } 667 668 //$arrList[$list_id].=");\n"; 669 $arrVal[$list_id].=");\n"; 644 } 670 645 671 646 // 規格1 … … 718 693 $max = count($arrRet); 719 694 $no = 0; 695 $from = "vw_products_allclass AS T1 " 696 . " JOIN (" 697 . " SELECT max(T2.rank) AS product_rank, " 698 . " T2.product_id" 699 . " FROM dtb_product_categories T2 " 700 . " GROUP BY product_id) AS T3 USING (product_id)"; 701 $objQuery->setorder("product_rank DESC"); 720 702 for($i = 0; $i < $max; $i++) { 721 703 $where = "del_flg = 0 AND product_id = ? AND status = 1"; 722 $arrProductInfo = $objQuery->select(" main_list_image, price02_min, price02_max, price01_min, price01_max, name, point_rate", "vw_products_allclass AS allcls", $where, array($arrRet[$i]['recommend_product_id']));704 $arrProductInfo = $objQuery->select("DISTINCT main_list_image, price02_min, price02_max, price01_min, price01_max, name, point_rate, product_rank", $from, $where, array($arrRet[$i]['recommend_product_id'])); 723 705 724 706 if(count($arrProductInfo) > 0) { … … 760 742 } 761 743 762 //この商品を買った人はこんな商品も買っています 744 //この商品を買った人はこんな商品も買っています FIXME 763 745 function lfGetRelateProducts($tmp_id) { 764 746 $objQuery = new SC_Query; -
branches/feature-module-update/data/class/pages/products/LC_Page_Products_List.php
r16270 r16546 73 73 74 74 // GETのカテゴリIDを元に正しいカテゴリIDを取得する。 75 $ category_id = $objDb->sfGetCategoryId("", $_GET['category_id']);75 $arrCategory_id = $objDb->sfGetCategoryId("", $_GET['category_id']); 76 76 77 77 if (!isset($_GET['mode'])) $_GET['mode'] = ""; 78 78 if (!isset($_GET['name'])) $_GET['name'] = ""; 79 79 if (!isset($_POST['orderby'])) $_POST['orderby'] = ""; 80 if (empty($arrCategory_id)) $arrCategory_id = array(""); 80 81 81 82 // タイトル編集 … … 83 84 if ($_GET['mode'] == 'search') { 84 85 $tpl_subtitle = "検索結果"; 85 } elseif ( $category_id == "") {86 } elseif (empty($arrCategory_id)) { 86 87 $tpl_subtitle = "全商品"; 87 88 } else { 88 $arrFirstCat = $objDb->sfGetFirstCat($ category_id);89 $arrFirstCat = $objDb->sfGetFirstCat($arrCategory_id[0]); 89 90 $tpl_subtitle = $arrFirstCat['name']; 90 91 } 91 92 92 93 $objQuery = new SC_Query(); 93 $count = $objQuery->count("dtb_best_products", "category_id = ?", array($category_id));94 $count = $objQuery->count("dtb_best_products", "category_id = ?", $arrCategory_id); 94 95 95 96 // 以下の条件でBEST商品を表示する … … 97 98 // ・カテゴリIDがルートIDである。 98 99 // ・検索モードでない。 99 if(($count >= BEST_MIN) && $this->lfIsRootCategory($ category_id) && ($_GET['mode'] != 'search') ) {100 if(($count >= BEST_MIN) && $this->lfIsRootCategory($arrCategory_id[0]) && ($_GET['mode'] != 'search') ) { 100 101 // 商品TOPの表示処理 101 $this->arrBestItems = SC_Utils_Ex::sfGetBestProducts($conn, $ category_id);102 $this->arrBestItems = SC_Utils_Ex::sfGetBestProducts($conn, $arrCategory_id[0]); 102 103 $this->BEST_ROOP_MAX = ceil((BEST_MAX-1)/2); 103 104 } else { 104 105 if ($_GET['mode'] == 'search' && strlen($_GET['category_id']) == 0 ){ 105 106 // 検索時にcategory_idがGETに存在しない場合は、仮に埋めたIDを空白に戻す 106 $ category_id = '';107 $arrCategory_id = array(0); 107 108 } 108 109 109 110 // 商品一覧の表示処理 110 $this->lfDispProductsList($ category_id, $_GET['name'], $this->disp_number, $_POST['orderby']);111 $this->lfDispProductsList($arrCategory_id[0], $_GET['name'], $this->disp_number, $_POST['orderby']); 111 112 112 113 // 検索条件を画面に表示 … … 115 116 $arrSearch['category'] = "指定なし"; 116 117 }else{ 117 $arrCat = $conn->getOne("SELECT category_name FROM dtb_category WHERE category_id = ?", array($category_id));118 $arrCat = $conn->getOne("SELECT category_name FROM dtb_category WHERE category_id = ?", $arrCategory_id); 118 119 $arrSearch['category'] = $arrCat; 119 120 } … … 171 172 $this->lfConvertParam(); 172 173 173 $this->category_id = $ category_id;174 $this->category_id = $arrCategory_id[0]; 174 175 $this->arrSearch = $arrSearch; 175 176 … … 210 211 211 212 // GETのカテゴリIDを元に正しいカテゴリIDを取得する。 212 $ category_id = $objDb->sfGetCategoryId("", $_GET['category_id']);213 $arrCategory_id = $objDb->sfGetCategoryId("", $_GET['category_id']); 213 214 214 215 // タイトル編集 … … 224 225 $tpl_subtitle = "検索結果"; 225 226 $tpl_search_mode = true; 226 }elseif ( $category_id == "") {227 }elseif (empty($arrCategory_id)) { 227 228 $tpl_subtitle = "全商品"; 228 229 }else{ 229 $arrFirstCat = $objDb->sfGetFirstCat($ category_id);230 $arrFirstCat = $objDb->sfGetFirstCat($arrCategory_id); 230 231 $tpl_subtitle = $arrFirstCat['name']; 231 232 } 232 233 233 234 $objQuery = new SC_Query(); 234 $count = $objQuery->count("dtb_best_products", "category_id = ?", array($category_id));235 $count = $objQuery->count("dtb_best_products", "category_id = ?", $arrCategory_id); 235 236 236 237 // 以下の条件でBEST商品を表示する … … 238 239 // ・カテゴリIDがルートIDである。 239 240 // ・検索モードでない。 240 if(($count >= BEST_MIN) && $this->lfIsRootCategory($ category_id) && ($_GET['mode'] != 'search') ) {241 if(($count >= BEST_MIN) && $this->lfIsRootCategory($arrCategory_id[0]) && ($_GET['mode'] != 'search') ) { 241 242 // 商品TOPの表示処理 242 /** 必ず指定する **/ 243 244 $this->arrBestItems = SC_Utils_Ex::sfGetBestProducts($conn, $category_id); 243 244 $this->arrBestItems = SC_Utils_Ex::sfGetBestProducts($conn, $arrCategory_id[0]); 245 245 $this->BEST_ROOP_MAX = ceil((BEST_MAX-1)/2); 246 246 } else { 247 247 if ($_GET['mode'] == 'search' && strlen($_GET['category_id']) == 0 ){ 248 248 // 検索時にcategory_idがGETに存在しない場合は、仮に埋めたIDを空白に戻す 249 $ category_id = '';249 $arrCategory_id = array(""); 250 250 } 251 251 252 252 // 商品一覧の表示処理 253 $this->lfDispProductsList($ category_id, $_GET['name'], $this->disp_number, $_REQUEST['orderby']);253 $this->lfDispProductsList($arrCategory_id[0], $_GET['name'], $this->disp_number, $_REQUEST['orderby']); 254 254 255 255 // 検索条件を画面に表示 … … 269 269 } 270 270 } 271 272 // レイアウトデザインを取得273 //$layout = new SC_Helper_PageLayout_Ex();274 //$layout->sfGetPageLayout($this, false, "products/list.php");275 271 276 272 if($_POST['mode'] == "cart" && $_POST['product_id'] != "") { … … 331 327 $this->arrForm = $_POST; 332 328 333 $this->category_id = $ category_id;329 $this->category_id = $arrCategory_id[0]; 334 330 $this->arrSearch = $arrSearch; 335 331 $this->tpl_mainpage = MOBILE_TEMPLATE_DIR . "products/list.tpl"; … … 365 361 //表示順序 366 362 switch($orderby) { 363 367 364 //価格順 368 365 case 'price': 369 $order = "price02_min ASC"; 366 $distinct = "DISTINCT ON (price02_min, product_id)"; 367 $col = $distinct . " *"; 368 $from = "vw_products_allclass "; 369 $order = "price02_min ASC, product_id ASC"; 370 370 break; 371 371 372 //新着順 372 373 case 'date': 373 $order = "create_date DESC"; 374 $distinct = "DISTINCT ON (create_date, product_id)"; 375 $col = $distinct . " *"; 376 $from = "vw_products_allclass "; 377 $order = "create_date DESC, product_id ASC"; 374 378 break; 379 375 380 default: 376 $order = "category_rank DESC, rank DESC"; 381 $col = "DISTINCT product_id, product_code_min, product_code_max," 382 . " price01_min, price01_max, price02_min, price02_max, " 383 . " stock_min, stock_max, stock_unlimited_min, " 384 . " stock_unlimited_max, del_flg, status, name, comment1, " 385 . " comment2, comment3, main_list_comment, main_image, " 386 . " main_list_image, product_flag, deliv_date_id, sale_limit," 387 . " point_rate, sale_unlimited, create_date, deliv_fee, " 388 . " T4.product_rank, T4.category_rank"; 389 $from = "vw_products_allclass AS T1 " 390 . " JOIN (" 391 . " SELECT max(T3.rank) AS category_rank, " 392 . " max(T2.rank) AS product_rank, " 393 . " T2.product_id" 394 . " FROM dtb_product_categories T2 " 395 . " JOIN dtb_category T3 USING (category_id) " 396 . " GROUP BY product_id) AS T4 USING (product_id)"; 397 $order = "T4.category_rank DESC, T4.product_rank DESC"; 377 398 break; 378 399 } … … 400 421 $arrval = array(); 401 422 } 423 402 424 // 行数の取得 403 $linemax = $objQuery->count("vw_products_allclass AS allcls", $where, $arrval); 425 $linemax = count($objQuery->getAll("SELECT DISTINCT product_id " 426 . "FROM vw_products_allclass AS allcls " 427 . (!empty($where) ? " WHERE " . $where 428 : ""), $arrval)); 429 404 430 $this->tpl_linemax = $linemax; // 何件が該当しました。表示用 405 431 … … 419 445 420 446 // 検索結果の取得 421 $this->arrProducts = $objQuery->select( "*", "vw_products_allclass AS allcls", $where, $arrval);447 $this->arrProducts = $objQuery->select($col, $from, $where, $arrval); 422 448 423 449 // 規格名一覧 … … 425 451 // 規格分類名一覧 426 452 $arrClassCatName = $objDb->sfGetIDValueList("dtb_classcategory", "classcategory_id", "name"); 427 // 企画セレクトボックス設定453 // 規格セレクトボックス設定 428 454 if($disp_num == 15) { 429 455 for($i = 0; $i < count($this->arrProducts); $i++) { … … 433 459 } 434 460 } 435 436 return $this;437 461 } 438 462
Note: See TracChangeset
for help on using the changeset viewer.