Changeset 15078 for branches/feature-module-update/html/products/list.php
- Timestamp:
- 2007/07/20 15:58:59 (17 years ago)
- Location:
- branches/feature-module-update
- Files:
-
- 1 edited
- 2 copied
Legend:
- Unmodified
- Added
- Removed
-
branches/feature-module-update
-
Property
svn:ignore
set to
.cache
.settings
.projectOptions
-
Property
svn:ignore
set to
-
branches/feature-module-update/html/products/list.php
r13581 r15078 20 20 $this->arrPRODUCTLISTMAX = $arrPRODUCTLISTMAX; 21 21 /* 22 session_start »þ¤Îno-cache¥Ø¥Ã¥À¡¼¤òÍÞÀ©¤¹¤ë¤³¤È¤Ç23 ¡ÖÌá¤ë¡×¥Ü¥¿¥ó»ÈÍÑ»þ¤Î͸ú´ü¸ÂÀÚ¤ìɽ¼¨¤òÍÞÀ©¤¹¤ë¡£24 private-no-expire: ¥¯¥é¥¤¥¢¥ó¥È¤Î¥¥ã¥Ã¥·¥å¤òµö²Ä¤¹¤ë¡£22 session_start時のno-cacheヘッダーを抑制することで 23 「戻る」ボタン使用時の有効期限切れ表示を抑制する。 24 private-no-expire:クライアントのキャッシュを許可する。 25 25 */ 26 26 session_cache_limiter('private-no-expire'); … … 31 31 $conn = new SC_DBConn(); 32 32 33 // ɽ¼¨·ï¿ô¤ÎÁªÂò33 //表示件数の選択 34 34 if(sfIsInt($_POST['disp_number'])) { 35 35 $objPage->disp_number = $_POST['disp_number']; 36 36 } else { 37 // ºÇ¾®É½¼¨·ï¿ô¤òÁªÂò37 //最小表示件数を選択 38 38 $objPage->disp_number = current(array_keys($arrPRODUCTLISTMAX)); 39 39 } 40 40 41 // ɽ¼¨½ç½ø¤ÎÊݸ41 //表示順序の保存 42 42 $objPage->orderby = $_POST['orderby']; 43 43 44 // GET ¤Î¥«¥Æ¥´¥êID¤ò¸µ¤ËÀµ¤·¤¤¥«¥Æ¥´¥êID¤ò¼èÆÀ¤¹¤ë¡£44 // GETのカテゴリIDを元に正しいカテゴリIDを取得する。 45 45 $category_id = sfGetCategoryId("", $_GET['category_id']); 46 46 47 // ¥¿¥¤¥È¥ëÊÔ½¸47 // タイトル編集 48 48 $tpl_subtitle = ""; 49 49 if($_GET['mode'] == 'search'){ 50 $tpl_subtitle = " ¸¡º÷·ë²Ì";50 $tpl_subtitle = "検索結果"; 51 51 }elseif ($category_id == "" ) { 52 $tpl_subtitle = " Á´¾¦ÉÊ";52 $tpl_subtitle = "全商品"; 53 53 }else{ 54 54 $arrFirstCat = sfGetFirstCat($category_id); … … 59 59 $count = $objQuery->count("dtb_best_products", "category_id = ?", array($category_id)); 60 60 61 // °Ê²¼¤Î¾ò·ï¤ÇBEST¾¦Éʤòɽ¼¨¤¹¤ë62 // ¡¦BESTºÇÂç¿ô¤Î¾¦Éʤ¬ÅÐÏ¿¤µ¤ì¤Æ¤¤¤ë¡£63 // ¡¦¥«¥Æ¥´¥êID¤¬¥ë¡¼¥ÈID¤Ç¤¢¤ë¡£64 // ¡¦¸¡º÷¥â¡¼¥É¤Ç¤Ê¤¤¡£61 // 以下の条件でBEST商品を表示する 62 // ・BEST最大数の商品が登録されている。 63 // ・カテゴリIDがルートIDである。 64 // ・検索モードでない。 65 65 if(($count >= BEST_MIN) && lfIsRootCategory($category_id) && ($_GET['mode'] != 'search') ) { 66 // ¾¦ÉÊTOP¤Îɽ¼¨½èÍý67 /** ɬ¤º»ØÄꤹ¤ë**/68 $objPage->tpl_mainpage = HTML_PATH . "user_data/templates/list.tpl"; // ¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È66 // 商品TOPの表示処理 67 /** 必ず指定する **/ 68 $objPage->tpl_mainpage = HTML_PATH . "user_data/templates/list.tpl"; // メインテンプレート 69 69 70 70 $objPage->arrBestItems = sfGetBestProducts($conn, $category_id); … … 72 72 } else { 73 73 if ($_GET['mode'] == 'search' && strlen($_GET['category_id']) == 0 ){ 74 // ¸¡º÷»þ¤Ëcategory_id¤¬GET¤Ë¸ºß¤·¤Ê¤¤¾ì¹ç¤Ï¡¢²¾¤ËËä¤á¤¿ID¤ò¶õÇò¤ËÌ᤹74 // 検索時にcategory_idがGETに存在しない場合は、仮に埋めたIDを空白に戻す 75 75 $category_id = ''; 76 76 } 77 77 78 // ¾¦ÉÊ°ìÍ÷¤Îɽ¼¨½èÍý78 // 商品一覧の表示処理 79 79 $objPage = lfDispProductsList($category_id, $_GET['name'], $objPage->disp_number, $_POST['orderby']); 80 80 81 // ¸¡º÷¾ò·ï¤ò²èÌ̤Ëɽ¼¨82 // ¥«¥Æ¥´¥ê¡¼¸¡º÷¾ò·ï81 // 検索条件を画面に表示 82 // カテゴリー検索条件 83 83 if (strlen($_GET['category_id']) == 0) { 84 $arrSearch['category'] = " »ØÄê¤Ê¤·";84 $arrSearch['category'] = "指定なし"; 85 85 }else{ 86 86 $arrCat = $conn->getOne("SELECT category_name FROM dtb_category WHERE category_id = ?",array($category_id)); … … 88 88 } 89 89 90 // ¾¦ÉÊ̾¸¡º÷¾ò·ï90 // 商品名検索条件 91 91 if ($_GET['name'] === "") { 92 $arrSearch['name'] = " »ØÄê¤Ê¤·";92 $arrSearch['name'] = "指定なし"; 93 93 }else{ 94 94 $arrSearch['name'] = $_GET['name']; … … 96 96 } 97 97 98 // ¥ì¥¤¥¢¥¦¥È¥Ç¥¶¥¤¥ó¤ò¼èÆÀ98 // レイアウトデザインを取得 99 99 $objPage = sfGetPageLayout($objPage, false, "products/list.php"); 100 100 101 101 if($_POST['mode'] == "cart" && $_POST['product_id'] != "") { 102 // ÃͤÎÀµÅöÀ¥Á¥§¥Ã¥¯102 // 値の正当性チェック 103 103 if(!sfIsInt($_POST['product_id']) || !sfIsRecord("dtb_products", "product_id", $_POST['product_id'], "del_flg = 0 AND status = 1")) { 104 104 sfDispSiteError(PRODUCT_NOT_FOUND); 105 105 } else { 106 // ÆþÎÏÃͤÎÊÑ´¹106 // 入力値の変換 107 107 $objPage->arrErr = lfCheckError($_POST['product_id']); 108 108 if(count($objPage->arrErr) == 0) { … … 112 112 $classcategory_id2 = $_POST[$classcategory_id. '_2']; 113 113 $quantity = "quantity". $_POST['product_id']; 114 // µ¬³Ê1¤¬ÀßÄꤵ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç114 // 規格1が設定されていない場合 115 115 if(!$objPage->tpl_classcat_find1[$_POST['product_id']]) { 116 116 $classcategory_id1 = '0'; 117 117 } 118 // µ¬³Ê2¤¬ÀßÄꤵ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç118 // 規格2が設定されていない場合 119 119 if(!$objPage->tpl_classcat_find2[$_POST['product_id']]) { 120 120 $classcategory_id2 = '0'; … … 131 131 $objPage->tpl_subtitle = $tpl_subtitle; 132 132 133 // »ÙʧÊýË¡¤Î¼èÆÀ133 // 支払方法の取得 134 134 $objPage->arrPayment = lfGetPayment(); 135 // ÆþÎϾðÊó¤òÅϤ¹135 // 入力情報を渡す 136 136 $objPage->arrForm = $_POST; 137 137 … … 144 144 145 145 //----------------------------------------------------------------------------------------------------------------------------------- 146 /* ¥«¥Æ¥´¥êID¤¬¥ë¡¼¥È¤«¤É¤¦¤«¤ÎȽÄê*/146 /* カテゴリIDがルートかどうかの判定 */ 147 147 function lfIsRootCategory($category_id) { 148 148 $objQuery = new SC_Query(); … … 154 154 } 155 155 156 /* ¾¦ÉÊ°ìÍ÷¤Îɽ¼¨*/156 /* 商品一覧の表示 */ 157 157 function lfDispProductsList($category_id, $name, $disp_num, $orderby) { 158 158 global $objPage; … … 160 160 $objPage->tpl_pageno = $_POST['pageno']; 161 161 162 // ɽ¼¨·ï¿ô¤Ç¥Æ¥ó¥×¥ì¡¼¥È¤òÀÚ¤êÂؤ¨¤ë163 $objPage->tpl_mainpage = HTML_PATH . "user_data/templates/list.tpl"; // ¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È164 165 // ɽ¼¨½ç½ø162 //表示件数でテンプレートを切り替える 163 $objPage->tpl_mainpage = HTML_PATH . "user_data/templates/list.tpl"; // メインテンプレート 164 165 //表示順序 166 166 switch($orderby) { 167 // ²Á³Ê½ç167 //価格順 168 168 case 'price': 169 169 $order = "price02_min ASC"; 170 170 break; 171 // ¿·Ãå½ç171 //新着順 172 172 case 'date': 173 173 $order = "create_date DESC"; … … 178 178 } 179 179 180 // ¾¦Éʸ¡º÷¾ò·ï¤ÎºîÀ®¡Ê̤ºï½ü¡¢É½¼¨¡Ë180 // 商品検索条件の作成(未削除、表示) 181 181 $where = "del_flg = 0 AND status = 1 "; 182 // ¥«¥Æ¥´¥ê¤«¤é¤ÎWHEREʸ»úÎó¼èÆÀ182 // カテゴリからのWHERE文字列取得 183 183 if ( $category_id ) { 184 184 list($tmp_where, $arrval) = sfGetCatWhere($category_id); … … 188 188 } 189 189 190 // ¾¦ÉÊ̾¤òwhereʸ¤Ë190 // 商品名をwhere文に 191 191 $name = ereg_replace(",", "", $name); 192 192 if ( strlen($name) > 0 ){ … … 197 197 } 198 198 199 // ¹Ô¿ô¤Î¼èÆÀ199 // 行数の取得 200 200 $linemax = $objQuery->count("vw_products_allclass AS allcls", $where, $arrval); 201 $objPage->tpl_linemax = $linemax; // ²¿·ï¤¬³ºÅö¤·¤Þ¤·¤¿¡£É½¼¨ÍÑ202 203 // ¥Ú¡¼¥¸Á÷¤ê¤Î¼èÆÀ201 $objPage->tpl_linemax = $linemax; // 何件が該当しました。表示用 202 203 // ページ送りの取得 204 204 $objNavi = new SC_PageNavi($_POST['pageno'], $linemax, $disp_num, "fnNaviPage", NAVI_PMAX); 205 205 206 206 $strnavi = $objNavi->strnavi; 207 207 $strnavi = str_replace('onclick="fnNaviPage', 'onclick="form1.mode.value=\''.'\'; fnNaviPage', $strnavi); 208 $objPage->tpl_strnavi = $strnavi; // ɽ¼¨Ê¸»úÎó209 $startno = $objNavi->start_row; // ³«»Ï¹Ô210 211 // ¼èÆÀÈϰϤλØÄê(³«»Ï¹ÔÈֹ桢¹Ô¿ô¤Î¥»¥Ã¥È)208 $objPage->tpl_strnavi = $strnavi; // 表示文字列 209 $startno = $objNavi->start_row; // 開始行 210 211 // 取得範囲の指定(開始行番号、行数のセット) 212 212 $objQuery->setlimitoffset($disp_num, $startno); 213 // ɽ¼¨½ç½ø213 // 表示順序 214 214 $objQuery->setorder($order); 215 215 … … 221 221 222 222 223 // ¸¡º÷·ë²Ì¤Î¼èÆÀ223 // 検索結果の取得 224 224 $objPage->arrProducts = $objQuery->select("*", "vw_products_allclass AS allcls", $where, $arrval); 225 225 226 // µ¬³Ê̾°ìÍ÷226 // 規格名一覧 227 227 $arrClassName = sfGetIDValueList("dtb_class", "class_id", "name"); 228 // µ¬³ÊʬÎà̾°ìÍ÷228 // 規格分類名一覧 229 229 $arrClassCatName = sfGetIDValueList("dtb_classcategory", "classcategory_id", "name"); 230 // ´ë²è¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹ÀßÄê230 // 企画セレクトボックス設定 231 231 if($disp_num == 15) { 232 232 for($i = 0; $i < count($objPage->arrProducts); $i++) { 233 233 $objPage = lfMakeSelect($objPage->arrProducts[$i]['product_id'], $arrClassName, $arrClassCatName); 234 // ¹ØÆþÀ©¸Â¿ô¤ò¼èÆÀ234 // 購入制限数を取得 235 235 $objPage = lfGetSaleLimit($objPage->arrProducts[$i]); 236 236 } … … 240 240 } 241 241 242 /* µ¬³Ê¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹¤ÎºîÀ®*/242 /* 規格セレクトボックスの作成 */ 243 243 function lfMakeSelect($product_id, $arrClassName, $arrClassCatName) { 244 244 global $objPage; … … 246 246 $classcat_find1 = false; 247 247 $classcat_find2 = false; 248 // ºß¸Ë¤¢¤ê¤Î¾¦ÉʤÎÍ̵248 // 在庫ありの商品の有無 249 249 $stock_find = false; 250 250 251 // ¾¦Éʵ¬³Ê¾ðÊó¤Î¼èÆÀ251 // 商品規格情報の取得 252 252 $arrProductsClass = lfGetProductsClass($product_id); 253 253 254 // µ¬³Ê1¥¯¥é¥¹Ì¾¤Î¼èÆÀ254 // 規格1クラス名の取得 255 255 $objPage->tpl_class_name1[$product_id] = $arrClassName[$arrProductsClass[0]['class_id1']]; 256 // µ¬³Ê2¥¯¥é¥¹Ì¾¤Î¼èÆÀ256 // 規格2クラス名の取得 257 257 $objPage->tpl_class_name2[$product_id] = $arrClassName[$arrProductsClass[0]['class_id2']]; 258 258 259 // ¤¹¤Ù¤Æ¤ÎÁȤ߹ç¤ï¤»¿ô259 // すべての組み合わせ数 260 260 $count = count($arrProductsClass); 261 261 … … 266 266 267 267 $list_id = 0; 268 $arrList[0] = "\tlist". $product_id. "_0 = new Array(' ÁªÂò¤·¤Æ¤¯¤À¤µ¤¤'";268 $arrList[0] = "\tlist". $product_id. "_0 = new Array('選択してください'"; 269 269 $arrVal[0] = "\tval". $product_id. "_0 = new Array(''"; 270 270 271 271 for ($i = 0; $i < $count; $i++) { 272 // ºß¸Ë¤Î¥Á¥§¥Ã¥¯272 // 在庫のチェック 273 273 if($arrProductsClass[$i]['stock'] <= 0 && $arrProductsClass[$i]['stock_unlimited'] != '1') { 274 274 continue; … … 277 277 $stock_find = true; 278 278 279 // µ¬³Ê1¤Î¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹ÍÑ279 // 規格1のセレクトボックス用 280 280 if($classcat_id1 != $arrProductsClass[$i]['classcategory_id1']){ 281 281 $arrList[$list_id].=");\n"; … … 286 286 } 287 287 288 // µ¬³Ê2¤Î¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹ÍÑ288 // 規格2のセレクトボックス用 289 289 $classcat_id2 = $arrProductsClass[$i]['classcategory_id2']; 290 290 291 // ¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹É½¼¨ÃÍ291 // セレクトボックス表示値 292 292 if($arrList[$list_id] == "") { 293 $arrList[$list_id] = "\tlist". $product_id. "_". $list_id. " = new Array(' ÁªÂò¤·¤Æ¤¯¤À¤µ¤¤', '". $arrClassCatName[$classcat_id2]. "'";293 $arrList[$list_id] = "\tlist". $product_id. "_". $list_id. " = new Array('選択してください', '". $arrClassCatName[$classcat_id2]. "'"; 294 294 } else { 295 295 $arrList[$list_id].= ", '".$arrClassCatName[$classcat_id2]."'"; 296 296 } 297 297 298 // ¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹POSTÃÍ298 // セレクトボックスPOST値 299 299 if($arrVal[$list_id] == "") { 300 300 $arrVal[$list_id] = "\tval". $product_id. "_". $list_id. " = new Array('', '". $classcat_id2. "'"; … … 307 307 $arrVal[$list_id].=");\n"; 308 308 309 // µ¬³Ê1309 // 規格1 310 310 $objPage->arrClassCat1[$product_id] = $arrSele; 311 311 … … 336 336 $objPage->tpl_javascript.= $vals.");\n"; 337 337 338 // ÁªÂò¤µ¤ì¤Æ¤¤¤ëµ¬³Ê2ID338 // 選択されている規格2ID 339 339 $classcategory_id = "classcategory_id". $product_id; 340 340 $objPage->tpl_onload .= "lnSetSelect('".$classcategory_id."_1','".$classcategory_id."_2','".$product_id."','".$_POST[$classcategory_id."_2"]."'); "; 341 341 342 // µ¬³Ê1¤¬ÀßÄꤵ¤ì¤Æ¤¤¤ë342 // 規格1が設定されている 343 343 if($arrProductsClass[0]['classcategory_id1'] != '0') { 344 344 $classcat_find1 = true; 345 345 } 346 346 347 // µ¬³Ê2¤¬ÀßÄꤵ¤ì¤Æ¤¤¤ë347 // 規格2が設定されている 348 348 if($arrProductsClass[0]['classcategory_id2'] != '0') { 349 349 $classcat_find2 = true; … … 356 356 return $objPage; 357 357 } 358 /* ¾¦Éʵ¬³Ê¾ðÊó¤Î¼èÆÀ*/358 /* 商品規格情報の取得 */ 359 359 function lfGetProductsClass($product_id) { 360 360 $arrRet = array(); 361 361 if(sfIsInt($product_id)) { 362 // ¾¦Éʵ¬³Ê¼èÆÀ362 // 商品規格取得 363 363 $objQuery = new SC_Query(); 364 364 $col = "product_class_id, classcategory_id1, classcategory_id2, class_id1, class_id2, stock, stock_unlimited"; … … 371 371 } 372 372 373 /* ÆþÎÏÆâÍƤΥÁ¥§¥Ã¥¯*/373 /* 入力内容のチェック */ 374 374 function lfCheckError($id) { 375 375 global $objPage; 376 376 377 // ÆþÎϥǡ¼¥¿¤òÅϤ¹¡£377 // 入力データを渡す。 378 378 $objErr = new SC_CheckError(); 379 379 … … 381 381 $classcategory_id2 = "classcategory_id". $id. "_2"; 382 382 $quantity = "quantity". $id; 383 // Ê£¿ô¹àÌÜ¥Á¥§¥Ã¥¯383 // 複数項目チェック 384 384 if ($objPage->tpl_classcat_find1[$id]) { 385 $objErr->doFunc(array(" µ¬³Ê1", $classcategory_id1, INT_LEN), array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));385 $objErr->doFunc(array("規格1", $classcategory_id1, INT_LEN), array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK")); 386 386 } 387 387 if ($objPage->tpl_classcat_find2[$id]) { 388 $objErr->doFunc(array(" µ¬³Ê2", $classcategory_id2, INT_LEN), array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));389 } 390 $objErr->doFunc(array(" ¸Ä¿ô", $quantity, INT_LEN), array("EXIST_CHECK", "ZERO_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));388 $objErr->doFunc(array("規格2", $classcategory_id2, INT_LEN), array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK")); 389 } 390 $objErr->doFunc(array("個数", $quantity, INT_LEN), array("EXIST_CHECK", "ZERO_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK")); 391 391 392 392 return $objErr->arrErr; 393 393 } 394 394 395 // ¹ØÆþÀ©¸Â¿ô¤ÎÀßÄê395 // 購入制限数の設定 396 396 function lfGetSaleLimit($product) { 397 397 global $objPage; 398 // ºß¸Ë¤¬Ìµ¸Â¤Þ¤¿¤Ï¹ØÆþÀ©¸ÂÃͤ¬ÀßÄêÃͤè¤êÂ礤¤¾ì¹ç398 //在庫が無限または購入制限値が設定値より大きい場合 399 399 if($product['sale_unlimited'] == 1 || $product['sale_limit'] > SALE_LIMIT_MAX) { 400 400 $objPage->tpl_sale_limit[$product['product_id']] = SALE_LIMIT_MAX; … … 406 406 } 407 407 408 // »ÙʧÊýË¡¤Î¼èÆÀ409 //payment_id 1: Âå¶â°ú´¹¡¡2:¶ä¹Ô¿¶¤ê¹þ¤ß¡¡3:¸½¶â½ñα408 //支払方法の取得 409 //payment_id 1:代金引換 2:銀行振り込み 3:現金書留 410 410 function lfGetPayment() { 411 411 $objQuery = new SC_Query;
Note: See TracChangeset
for help on using the changeset viewer.