- 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/mobile/products/list.php
r12157 r15078 7 7 * 8 8 * 9 * ¥â¥Ð¥¤¥ë¥µ¥¤¥È/¾¦ÉÊ°ìÍ÷9 * モバイルサイト/商品一覧 10 10 */ 11 11 … … 23 23 $this->arrPRODUCTLISTMAX = $arrPRODUCTLISTMAX; 24 24 /* 25 session_start »þ¤Îno-cache¥Ø¥Ã¥À¡¼¤òÍÞÀ©¤¹¤ë¤³¤È¤Ç26 ¡ÖÌá¤ë¡×¥Ü¥¿¥ó»ÈÍÑ»þ¤Î͸ú´ü¸ÂÀÚ¤ìɽ¼¨¤òÍÞÀ©¤¹¤ë¡£27 private-no-expire: ¥¯¥é¥¤¥¢¥ó¥È¤Î¥¥ã¥Ã¥·¥å¤òµö²Ä¤¹¤ë¡£25 session_start時のno-cacheヘッダーを抑制することで 26 「戻る」ボタン使用時の有効期限切れ表示を抑制する。 27 private-no-expire:クライアントのキャッシュを許可する。 28 28 */ 29 29 session_cache_limiter('private-no-expire'); … … 34 34 $conn = new SC_DBConn(); 35 35 36 // ɽ¼¨·ï¿ô¤ÎÁªÂò36 //表示件数の選択 37 37 if(sfIsInt($_REQUEST['disp_number'])) { 38 38 $objPage->disp_number = $_REQUEST['disp_number']; 39 39 } else { 40 // ºÇ¾®É½¼¨·ï¿ô¤òÁªÂò40 //最小表示件数を選択 41 41 $objPage->disp_number = current(array_keys($arrPRODUCTLISTMAX)); 42 42 } 43 43 44 // ɽ¼¨½ç½ø¤ÎÊݸ44 //表示順序の保存 45 45 $objPage->orderby = $_REQUEST['orderby']; 46 46 47 // GET ¤Î¥«¥Æ¥´¥êID¤ò¸µ¤ËÀµ¤·¤¤¥«¥Æ¥´¥êID¤ò¼èÆÀ¤¹¤ë¡£47 // GETのカテゴリIDを元に正しいカテゴリIDを取得する。 48 48 $category_id = sfGetCategoryId("", $_GET['category_id']); 49 49 50 // ¥¿¥¤¥È¥ëÊÔ½¸50 // タイトル編集 51 51 $tpl_subtitle = ""; 52 52 $tpl_search_mode = false; 53 53 if($_GET['mode'] == 'search'){ 54 $tpl_subtitle = " ¸¡º÷·ë²Ì";54 $tpl_subtitle = "検索結果"; 55 55 $tpl_search_mode = true; 56 56 }elseif ($category_id == "" ) { 57 $tpl_subtitle = " Á´¾¦ÉÊ";57 $tpl_subtitle = "全商品"; 58 58 }else{ 59 59 $arrFirstCat = sfGetFirstCat($category_id); … … 64 64 $count = $objQuery->count("dtb_best_products", "category_id = ?", array($category_id)); 65 65 66 // °Ê²¼¤Î¾ò·ï¤ÇBEST¾¦Éʤòɽ¼¨¤¹¤ë67 // ¡¦BESTºÇÂç¿ô¤Î¾¦Éʤ¬ÅÐÏ¿¤µ¤ì¤Æ¤¤¤ë¡£68 // ¡¦¥«¥Æ¥´¥êID¤¬¥ë¡¼¥ÈID¤Ç¤¢¤ë¡£69 // ¡¦¸¡º÷¥â¡¼¥É¤Ç¤Ê¤¤¡£66 // 以下の条件でBEST商品を表示する 67 // ・BEST最大数の商品が登録されている。 68 // ・カテゴリIDがルートIDである。 69 // ・検索モードでない。 70 70 if(($count >= BEST_MIN) && lfIsRootCategory($category_id) && ($_GET['mode'] != 'search') ) { 71 // ¾¦ÉÊTOP¤Îɽ¼¨½èÍý72 /** ɬ¤º»ØÄꤹ¤ë**/73 $objPage->tpl_mainpage = "products/list.tpl"; // ¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È71 // 商品TOPの表示処理 72 /** 必ず指定する **/ 73 $objPage->tpl_mainpage = "products/list.tpl"; // メインテンプレート 74 74 75 75 $objPage->arrBestItems = sfGetBestProducts($conn, $category_id); … … 77 77 } else { 78 78 if ($_GET['mode'] == 'search' && strlen($_GET['category_id']) == 0 ){ 79 // ¸¡º÷»þ¤Ëcategory_id¤¬GET¤Ë¸ºß¤·¤Ê¤¤¾ì¹ç¤Ï¡¢²¾¤ËËä¤á¤¿ID¤ò¶õÇò¤ËÌ᤹79 // 検索時にcategory_idがGETに存在しない場合は、仮に埋めたIDを空白に戻す 80 80 $category_id = ''; 81 81 } 82 82 83 // ¾¦ÉÊ°ìÍ÷¤Îɽ¼¨½èÍý83 // 商品一覧の表示処理 84 84 $objPage = lfDispProductsList($category_id, $_GET['name'], $objPage->disp_number, $_REQUEST['orderby']); 85 85 86 // ¸¡º÷¾ò·ï¤ò²èÌ̤Ëɽ¼¨87 // ¥«¥Æ¥´¥ê¡¼¸¡º÷¾ò·ï86 // 検索条件を画面に表示 87 // カテゴリー検索条件 88 88 if (strlen($_GET['category_id']) == 0) { 89 $arrSearch['category'] = " »ØÄê¤Ê¤·";89 $arrSearch['category'] = "指定なし"; 90 90 }else{ 91 91 $arrCat = $conn->getOne("SELECT category_name FROM dtb_category WHERE category_id = ?",array($category_id)); … … 93 93 } 94 94 95 // ¾¦ÉÊ̾¸¡º÷¾ò·ï95 // 商品名検索条件 96 96 if ($_GET['name'] === "") { 97 $arrSearch['name'] = " »ØÄê¤Ê¤·";97 $arrSearch['name'] = "指定なし"; 98 98 }else{ 99 99 $arrSearch['name'] = $_GET['name']; … … 101 101 } 102 102 103 // ¥ì¥¤¥¢¥¦¥È¥Ç¥¶¥¤¥ó¤ò¼èÆÀ103 // レイアウトデザインを取得 104 104 $objPage = sfGetPageLayout($objPage, false, "products/list.php"); 105 105 106 106 if($_POST['mode'] == "cart" && $_POST['product_id'] != "") { 107 // ÃͤÎÀµÅöÀ¥Á¥§¥Ã¥¯107 // 値の正当性チェック 108 108 if(!sfIsInt($_POST['product_id']) || !sfIsRecord("dtb_products", "product_id", $_POST['product_id'], "del_flg = 0 AND status = 1")) { 109 109 sfDispSiteError(PRODUCT_NOT_FOUND, "", false, "", true); 110 110 } else { 111 // ÆþÎÏÃͤÎÊÑ´¹111 // 入力値の変換 112 112 $objPage->arrErr = lfCheckError($_POST['product_id']); 113 113 if(count($objPage->arrErr) == 0) { … … 117 117 $classcategory_id2 = $_POST[$classcategory_id. '_2']; 118 118 $quantity = "quantity". $_POST['product_id']; 119 // µ¬³Ê1¤¬ÀßÄꤵ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç119 // 規格1が設定されていない場合 120 120 if(!$objPage->tpl_classcat_find1[$_POST['product_id']]) { 121 121 $classcategory_id1 = '0'; 122 122 } 123 // µ¬³Ê2¤¬ÀßÄꤵ¤ì¤Æ¤¤¤Ê¤¤¾ì¹ç123 // 規格2が設定されていない場合 124 124 if(!$objPage->tpl_classcat_find2[$_POST['product_id']]) { 125 125 $classcategory_id2 = '0'; … … 134 134 135 135 136 // ¥Ú¡¼¥¸Á÷¤êµ¡Ç½ÍѤÎURL¤òºîÀ®¤¹¤ë¡£136 // ページ送り機能用のURLを作成する。 137 137 $objURL = new Net_URL($_SERVER['PHP_SELF']); 138 138 foreach ($_REQUEST as $key => $value) { … … 156 156 $objPage->tpl_search_mode = $tpl_search_mode; 157 157 158 // »ÙʧÊýË¡¤Î¼èÆÀ158 // 支払方法の取得 159 159 $objPage->arrPayment = lfGetPayment(); 160 // ÆþÎϾðÊó¤òÅϤ¹160 // 入力情報を渡す 161 161 $objPage->arrForm = $_POST; 162 162 … … 167 167 168 168 //----------------------------------------------------------------------------------------------------------------------------------- 169 /* ¥«¥Æ¥´¥êID¤¬¥ë¡¼¥È¤«¤É¤¦¤«¤ÎȽÄê*/169 /* カテゴリIDがルートかどうかの判定 */ 170 170 function lfIsRootCategory($category_id) { 171 171 $objQuery = new SC_Query(); … … 177 177 } 178 178 179 /* ¾¦ÉÊ°ìÍ÷¤Îɽ¼¨*/179 /* 商品一覧の表示 */ 180 180 function lfDispProductsList($category_id, $name, $disp_num, $orderby) { 181 181 global $objPage; … … 183 183 $objPage->tpl_pageno = $_REQUEST['pageno']; 184 184 185 // ɽ¼¨·ï¿ô¤Ç¥Æ¥ó¥×¥ì¡¼¥È¤òÀÚ¤êÂؤ¨¤ë186 $objPage->tpl_mainpage = "products/list.tpl"; // ¥á¥¤¥ó¥Æ¥ó¥×¥ì¡¼¥È187 188 // ɽ¼¨½ç½ø185 //表示件数でテンプレートを切り替える 186 $objPage->tpl_mainpage = "products/list.tpl"; // メインテンプレート 187 188 //表示順序 189 189 switch($orderby) { 190 // ²Á³Ê½ç190 //価格順 191 191 case 'price': 192 192 $order = "price02_min ASC"; 193 193 break; 194 // ¿·Ãå½ç194 //新着順 195 195 case 'date': 196 196 $order = "create_date DESC"; … … 201 201 } 202 202 203 // ¾¦Éʸ¡º÷¾ò·ï¤ÎºîÀ®¡Ê̤ºï½ü¡¢É½¼¨¡Ë203 // 商品検索条件の作成(未削除、表示) 204 204 $where = "del_flg = 0 AND status = 1 "; 205 // ¥«¥Æ¥´¥ê¤«¤é¤ÎWHEREʸ»úÎó¼èÆÀ205 // カテゴリからのWHERE文字列取得 206 206 if ( $category_id ) { 207 207 $where .= 'AND category_id = ?'; … … 209 209 } 210 210 211 // ¾¦ÉÊ̾¤òwhereʸ¤Ë211 // 商品名をwhere文に 212 212 $name = ereg_replace(",", "", $name); 213 213 if ( strlen($name) > 0 ){ … … 218 218 } 219 219 220 // ¹Ô¿ô¤Î¼èÆÀ220 // 行数の取得 221 221 $linemax = $objQuery->count("vw_products_allclass AS allcls", $where, $arrval); 222 $objPage->tpl_linemax = $linemax; // ²¿·ï¤¬³ºÅö¤·¤Þ¤·¤¿¡£É½¼¨ÍÑ223 224 // ¥Ú¡¼¥¸Á÷¤ê¤Î¼èÆÀ222 $objPage->tpl_linemax = $linemax; // 何件が該当しました。表示用 223 224 // ページ送りの取得 225 225 $objNavi = new SC_PageNavi($_REQUEST['pageno'], $linemax, $disp_num, "fnNaviPage", NAVI_PMAX); 226 226 227 227 $strnavi = $objNavi->strnavi; 228 228 $strnavi = str_replace('onclick="fnNaviPage', 'onclick="form1.mode.value=\''.'\'; fnNaviPage', $strnavi); 229 $objPage->tpl_strnavi = $strnavi; // ɽ¼¨Ê¸»úÎó230 $startno = $objNavi->start_row; // ³«»Ï¹Ô231 232 // ¼èÆÀÈϰϤλØÄê(³«»Ï¹ÔÈֹ桢¹Ô¿ô¤Î¥»¥Ã¥È)229 $objPage->tpl_strnavi = $strnavi; // 表示文字列 230 $startno = $objNavi->start_row; // 開始行 231 232 // 取得範囲の指定(開始行番号、行数のセット) 233 233 $objQuery->setlimitoffset($disp_num, $startno); 234 // ɽ¼¨½ç½ø234 // 表示順序 235 235 $objQuery->setorder($order); 236 // ¸¡º÷·ë²Ì¤Î¼èÆÀ236 // 検索結果の取得 237 237 $objPage->arrProducts = $objQuery->select("*", "vw_products_allclass AS allcls", $where, $arrval); 238 238 239 // µ¬³Ê̾°ìÍ÷239 // 規格名一覧 240 240 $arrClassName = sfGetIDValueList("dtb_class", "class_id", "name"); 241 // µ¬³ÊʬÎà̾°ìÍ÷241 // 規格分類名一覧 242 242 $arrClassCatName = sfGetIDValueList("dtb_classcategory", "classcategory_id", "name"); 243 // ´ë²è¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹ÀßÄê243 // 企画セレクトボックス設定 244 244 if($disp_num == 15) { 245 245 for($i = 0; $i < count($objPage->arrProducts); $i++) { 246 246 $objPage = lfMakeSelect($objPage->arrProducts[$i]['product_id'], $arrClassName, $arrClassCatName); 247 // ¹ØÆþÀ©¸Â¿ô¤ò¼èÆÀ247 // 購入制限数を取得 248 248 $objPage = lfGetSaleLimit($objPage->arrProducts[$i]); 249 249 } … … 254 254 } 255 255 256 /* µ¬³Ê¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹¤ÎºîÀ®*/256 /* 規格セレクトボックスの作成 */ 257 257 function lfMakeSelect($product_id, $arrClassName, $arrClassCatName) { 258 258 global $objPage; … … 260 260 $classcat_find1 = false; 261 261 $classcat_find2 = false; 262 // ºß¸Ë¤¢¤ê¤Î¾¦ÉʤÎÍ̵262 // 在庫ありの商品の有無 263 263 $stock_find = false; 264 264 265 // ¾¦Éʵ¬³Ê¾ðÊó¤Î¼èÆÀ265 // 商品規格情報の取得 266 266 $arrProductsClass = lfGetProductsClass($product_id); 267 267 268 // µ¬³Ê1¥¯¥é¥¹Ì¾¤Î¼èÆÀ268 // 規格1クラス名の取得 269 269 $objPage->tpl_class_name1[$product_id] = $arrClassName[$arrProductsClass[0]['class_id1']]; 270 // µ¬³Ê2¥¯¥é¥¹Ì¾¤Î¼èÆÀ270 // 規格2クラス名の取得 271 271 $objPage->tpl_class_name2[$product_id] = $arrClassName[$arrProductsClass[0]['class_id2']]; 272 272 273 // ¤¹¤Ù¤Æ¤ÎÁȤ߹ç¤ï¤»¿ô273 // すべての組み合わせ数 274 274 $count = count($arrProductsClass); 275 275 … … 280 280 281 281 $list_id = 0; 282 $arrList[0] = "\tlist". $product_id. "_0 = new Array(' ÁªÂò¤·¤Æ¤¯¤À¤µ¤¤'";282 $arrList[0] = "\tlist". $product_id. "_0 = new Array('選択してください'"; 283 283 $arrVal[0] = "\tval". $product_id. "_0 = new Array(''"; 284 284 285 285 for ($i = 0; $i < $count; $i++) { 286 // ºß¸Ë¤Î¥Á¥§¥Ã¥¯286 // 在庫のチェック 287 287 if($arrProductsClass[$i]['stock'] <= 0 && $arrProductsClass[$i]['stock_unlimited'] != '1') { 288 288 continue; … … 291 291 $stock_find = true; 292 292 293 // µ¬³Ê1¤Î¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹ÍÑ293 // 規格1のセレクトボックス用 294 294 if($classcat_id1 != $arrProductsClass[$i]['classcategory_id1']){ 295 295 $arrList[$list_id].=");\n"; … … 300 300 } 301 301 302 // µ¬³Ê2¤Î¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹ÍÑ302 // 規格2のセレクトボックス用 303 303 $classcat_id2 = $arrProductsClass[$i]['classcategory_id2']; 304 304 305 // ¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹É½¼¨ÃÍ305 // セレクトボックス表示値 306 306 if($arrList[$list_id] == "") { 307 $arrList[$list_id] = "\tlist". $product_id. "_". $list_id. " = new Array(' ÁªÂò¤·¤Æ¤¯¤À¤µ¤¤', '". $arrClassCatName[$classcat_id2]. "'";307 $arrList[$list_id] = "\tlist". $product_id. "_". $list_id. " = new Array('選択してください', '". $arrClassCatName[$classcat_id2]. "'"; 308 308 } else { 309 309 $arrList[$list_id].= ", '".$arrClassCatName[$classcat_id2]."'"; 310 310 } 311 311 312 // ¥»¥ì¥¯¥È¥Ü¥Ã¥¯¥¹POSTÃÍ312 // セレクトボックスPOST値 313 313 if($arrVal[$list_id] == "") { 314 314 $arrVal[$list_id] = "\tval". $product_id. "_". $list_id. " = new Array('', '". $classcat_id2. "'"; … … 321 321 $arrVal[$list_id].=");\n"; 322 322 323 // µ¬³Ê1323 // 規格1 324 324 $objPage->arrClassCat1[$product_id] = $arrSele; 325 325 … … 350 350 $objPage->tpl_javascript.= $vals.");\n"; 351 351 352 // ÁªÂò¤µ¤ì¤Æ¤¤¤ëµ¬³Ê2ID352 // 選択されている規格2ID 353 353 $classcategory_id = "classcategory_id". $product_id; 354 354 $objPage->tpl_onload .= "lnSetSelect('".$classcategory_id."_1','".$classcategory_id."_2','".$product_id."','".$_POST[$classcategory_id."_2"]."'); "; 355 355 356 // µ¬³Ê1¤¬ÀßÄꤵ¤ì¤Æ¤¤¤ë356 // 規格1が設定されている 357 357 if($arrProductsClass[0]['classcategory_id1'] != '0') { 358 358 $classcat_find1 = true; 359 359 } 360 360 361 // µ¬³Ê2¤¬ÀßÄꤵ¤ì¤Æ¤¤¤ë361 // 規格2が設定されている 362 362 if($arrProductsClass[0]['classcategory_id2'] != '0') { 363 363 $classcat_find2 = true; … … 370 370 return $objPage; 371 371 } 372 /* ¾¦Éʵ¬³Ê¾ðÊó¤Î¼èÆÀ*/372 /* 商品規格情報の取得 */ 373 373 function lfGetProductsClass($product_id) { 374 374 $arrRet = array(); 375 375 if(sfIsInt($product_id)) { 376 // ¾¦Éʵ¬³Ê¼èÆÀ376 // 商品規格取得 377 377 $objQuery = new SC_Query(); 378 378 $col = "product_class_id, classcategory_id1, classcategory_id2, class_id1, class_id2, stock, stock_unlimited"; … … 385 385 } 386 386 387 /* ÆþÎÏÆâÍƤΥÁ¥§¥Ã¥¯*/387 /* 入力内容のチェック */ 388 388 function lfCheckError($id) { 389 389 global $objPage; 390 390 391 // ÆþÎϥǡ¼¥¿¤òÅϤ¹¡£391 // 入力データを渡す。 392 392 $objErr = new SC_CheckError(); 393 393 … … 395 395 $classcategory_id2 = "classcategory_id". $id. "_2"; 396 396 $quantity = "quantity". $id; 397 // Ê£¿ô¹àÌÜ¥Á¥§¥Ã¥¯397 // 複数項目チェック 398 398 if ($objPage->tpl_classcat_find1[$id]) { 399 $objErr->doFunc(array(" µ¬³Ê1", $classcategory_id1, INT_LEN), array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));399 $objErr->doFunc(array("規格1", $classcategory_id1, INT_LEN), array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK")); 400 400 } 401 401 if ($objPage->tpl_classcat_find2[$id]) { 402 $objErr->doFunc(array(" µ¬³Ê2", $classcategory_id2, INT_LEN), array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));403 } 404 $objErr->doFunc(array(" ¸Ä¿ô", $quantity, INT_LEN), array("EXIST_CHECK", "ZERO_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK"));402 $objErr->doFunc(array("規格2", $classcategory_id2, INT_LEN), array("EXIST_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK")); 403 } 404 $objErr->doFunc(array("個数", $quantity, INT_LEN), array("EXIST_CHECK", "ZERO_CHECK", "NUM_CHECK", "MAX_LENGTH_CHECK")); 405 405 406 406 return $objErr->arrErr; 407 407 } 408 408 409 // ¹ØÆþÀ©¸Â¿ô¤ÎÀßÄê409 // 購入制限数の設定 410 410 function lfGetSaleLimit($product) { 411 411 global $objPage; 412 // ºß¸Ë¤¬Ìµ¸Â¤Þ¤¿¤Ï¹ØÆþÀ©¸ÂÃͤ¬ÀßÄêÃͤè¤êÂ礤¤¾ì¹ç412 //在庫が無限または購入制限値が設定値より大きい場合 413 413 if($product['sale_unlimited'] == 1 || $product['sale_limit'] > SALE_LIMIT_MAX) { 414 414 $objPage->tpl_sale_limit[$product['product_id']] = SALE_LIMIT_MAX; … … 420 420 } 421 421 422 // »ÙʧÊýË¡¤Î¼èÆÀ423 //payment_id 1: Âå¶â°ú´¹¡¡2:¶ä¹Ô¿¶¤ê¹þ¤ß¡¡3:¸½¶â½ñα422 //支払方法の取得 423 //payment_id 1:代金引換 2:銀行振り込み 3:現金書留 424 424 function lfGetPayment() { 425 425 $objQuery = new SC_Query;
Note: See TracChangeset
for help on using the changeset viewer.