Changeset 18252
- Timestamp:
- 2009/08/04 12:47:34 (15 years ago)
- Location:
- branches/comu-ver2
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/comu-ver2/data/Smarty/templates/default/list.tpl
r18240 r18252 52 52 <!--▼CONTENTS--> 53 53 <div id="undercolumn" class="product product_list"> 54 <form name="form1" id="form1" method="post" action="<!--{$smarty.server.REQUEST_URI|escape}-->"> 55 <input type="hidden" name="mode" value="" /> 54 <form name="form1" id="form1" method="get" action="?"> 55 <input type="hidden" name="mode" value="<!--{$mode|escape}-->" /> 56 <!--{* ▼検索条件 *}--> 57 <input type="hidden" name="category_id" value="<!--{$arrSearchData.category_id|escape}-->" /> 58 <input type="hidden" name="maker_id" value="<!--{$arrSearchData.maker_id|escape}-->" /> 59 <input type="hidden" name="name" value="<!--{$arrSearchData.name|escape}-->" /> 60 <!--{* ▲検索条件 *}--> 56 61 <input type="hidden" name="orderby" value="<!--{$orderby|escape}-->" /> 57 62 <input type="hidden" name="disp_number" value="<!--{$disp_number|escape}-->" /> 63 <input type="hidden" name="pageno" value="<!--{$tpl_pageno|escape}-->" /> 58 64 <input type="hidden" name="product_id" value="" /> 59 65 … … 65 71 <ul class="pagecondarea"> 66 72 <li><strong>商品カテゴリ:</strong><!--{$arrSearch.category|escape}--></li> 67 <!--{if $arrSearch.maker }--><li><strong>メーカー:</strong><!--{$arrSearch.maker|escape}--></li><!--{/if}-->73 <!--{if $arrSearch.maker|strlen >= 1}--><li><strong>メーカー:</strong><!--{$arrSearch.maker|escape}--></li><!--{/if}--> 68 74 <li><strong>商品名:</strong><!--{$arrSearch.name|escape}--></li> 69 75 </ul> … … 192 198 <dt>数量:</dt> 193 199 <dd> 194 <input type="text" name="<!--{$quantity }-->" size="3" class="box54" value="<!--{$arrForm[$quantity]|default:1}-->" maxlength="<!--{$smarty.const.INT_LEN}-->" style="<!--{$arrErr[$quantity]|sfGetErrorColor}-->" />200 <input type="text" name="<!--{$quantity|escape}-->" size="3" class="box54" value="<!--{$arrForm[$quantity]|default:1|escape}-->" maxlength="<!--{$smarty.const.INT_LEN}-->" style="<!--{$arrErr[$quantity]|sfGetErrorColor}-->" /> 195 201 <!--{if $arrErr[$quantity] != ""}--> 196 202 <br /><span class="attention"><!--{$arrErr[$quantity]}--></span> … … 199 205 </dl> 200 206 <div class="cartbtn"> 201 <a href="<!--{$smarty.server.REQUEST_URI|escape}-->#product<!--{$id}-->" onclick="fnChangeAction('<!--{$smarty.server.REQUEST_URI|escape}-->#product<!--{$id}-->'); fnModeSubmit('cart','product_id','<!--{$id}-->'); return false;" onmouseover="chgImg('<!--{$TPL_DIR}-->img/products/b_cartin_on.gif','cart<!--{$id}-->');" onmouseout="chgImg('<!--{$TPL_DIR}-->img/products/b_cartin.gif','cart<!--{$id}-->');"> 207 <a 208 href="?" 209 onclick="fnChangeAction('?#product<!--{$id}-->'); fnModeSubmit('cart','product_id','<!--{$id}-->'); return false;" 210 onmouseover="chgImg('<!--{$TPL_DIR}-->img/products/b_cartin_on.gif','cart<!--{$id}-->');" 211 onmouseout="chgImg('<!--{$TPL_DIR}-->img/products/b_cartin.gif','cart<!--{$id}-->');" 212 > 202 213 <img src="<!--{$TPL_DIR}-->img/products/b_cartin.gif" width="115" height="25" alt="カゴに入れる" name="cart<!--{$id}-->" id="cart<!--{$id}-->" /></a> 203 214 </div> -
branches/comu-ver2/data/class/SC_PageNavi.php
r16741 r18252 35 35 */ 36 36 class SC_PageNavi { 37 var $now_page; 38 var $max_page; 39 var $start_row; 40 var $strnavi; 41 var $arrPagenavi = array(); 37 var $now_page; // 現在のページ番号 38 var $max_page; // 最終のページ番号 39 var $start_row; // 開始レコード 40 var $strnavi; // ページ送り文字列 41 var $arrPagenavi = array(); // ページ 42 42 43 43 // コンストラクタ 44 function SC_PageNavi($now_page, $all_row, $page_row, $func_name, $navi_max = NAVI_PMAX ) {44 function SC_PageNavi($now_page, $all_row, $page_row, $func_name, $navi_max = NAVI_PMAX, $urlParam = '') { 45 45 $this->arrPagenavi['mode'] = 'search'; 46 $ps = htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES);47 46 48 47 //現在ページ($now_page)が正しい数値でない場合 49 if (!eregi("^[[:digit:]]+$", $now_page) || $now_page < 1 || $now_page == "") {48 if (!eregi("^[[:digit:]]+$", $now_page) || $now_page < 1 || strlen($now_page) == 0) { 50 49 $this->now_page = 1; 51 50 } else { … … 58 57 59 58 // 最終ページよりも現在ページが大きい場合は、最初に戻す。 60 if ($this->max_page < $this->now_page) {59 if ($this->max_page < $this->now_page) { 61 60 $this->now_page = 1; 62 61 } … … 69 68 } 70 69 71 if ($all_row > 1) {70 if ($all_row > 1) { 72 71 73 72 //「前へ」「次へ」の設定 … … 75 74 $next = ""; 76 75 if ($this->now_page > 1) { 77 $before="<a href=\"". $ps . "\" onclick=\"$func_name('" . (($this->now_page) - 1) . "'); return false;\"><<前へ</a> "; 78 $this->arrPagenavi['before'] = ($this->now_page) - 1; 79 }else{ 76 $this->arrPagenavi['before'] = $this->now_page - 1; 77 $urlParamThis = str_replace('#page#', $this->arrPagenavi['before'], $urlParam); 78 $urlParamThis = htmlentities($urlParamThis, ENT_QUOTES); 79 $before = "<a href=\"?$urlParamThis\" onclick=\"$func_name('{$this->arrPagenavi['before']}'); return false;\"><<前へ</a> "; 80 } else { 80 81 $this->arrPagenavi['before'] = $this->now_page; 81 82 } 82 83 83 84 if ($this->now_page < $this->max_page) { 84 $next=" <a href=\"". $ps . "\" onclick=\"$func_name('" . (($this->now_page) + 1) ."'); return false;\">次へ>></a>"; 85 $this->arrPagenavi['next'] = ($this->now_page) + 1; 86 }else{ 85 $this->arrPagenavi['next'] = $this->now_page + 1; 86 $urlParamThis = str_replace('#page#', $this->arrPagenavi['next'], $urlParam); 87 $urlParamThis = htmlentities($urlParamThis, ENT_QUOTES); 88 $next = " <a href=\"?$urlParamThis\" onclick=\"$func_name('{$this->arrPagenavi['next']}'); return false;\">次へ>></a>"; 89 } else { 87 90 $this->arrPagenavi['next'] = $this->now_page; 88 91 } 89 92 90 93 // 表示する最大ナビ数を決める。 91 if ($navi_max == "" || $navi_max > $this->max_page) {94 if ($navi_max == "" || $navi_max > $this->max_page) { 92 95 // 制限ナビ数の指定がない。ページ最大数が制限ナビ数より少ない。 93 96 $disp_max = $this->max_page; … … 96 99 $disp_max = $this->now_page + $navi_max - 1; 97 100 // ページ最大数を超えている場合は、ページ最大数に合わせる。 98 if ($disp_max > $this->max_page) {101 if ($disp_max > $this->max_page) { 99 102 $disp_max = $this->max_page; 100 103 } … … 102 105 103 106 // 表示する最小ナビ数を決める。 104 if ($navi_max == "" || $navi_max > $this->now_page) {107 if ($navi_max == "" || $navi_max > $this->now_page) { 105 108 // 制限ナビ数の指定がない。現在ページ番号が制限ナビ数より少ない。 106 109 $disp_min = 1; … … 114 117 for ($i=$disp_min; $i <= $disp_max; $i++) { 115 118 116 if ($i != $disp_max) {119 if ($i != $disp_max) { 117 120 $sep = " | "; 118 121 } else { … … 123 126 $page_number .= "<strong>$i</strong>"; 124 127 } else { 125 $page_number.="<a href=\"". $ps . "\" onclick=\"$func_name('$i'); return false;\">$i</a>"; 128 $urlParamThis = str_replace('#page#', $i, $urlParam); 129 $urlParamThis = htmlentities($urlParamThis, ENT_QUOTES); 130 $page_number .= "<a href=\"?$urlParamThis\" onclick=\"$func_name('$i'); return false;\">$i</a>"; 126 131 } 127 132 128 $page_number .=$sep;133 $page_number .= $sep; 129 134 130 135 $this->arrPagenavi['arrPageno'][$i] = $i; … … 134 139 $this->strnavi = $before .$page_number .$next; 135 140 } 136 } else{141 } else { 137 142 $this->arrPagenavi['arrPageno'][0] = 1; 138 143 $this->arrPagenavi['before'] = 1; -
branches/comu-ver2/data/class/pages/products/LC_Page_Products_List.php
r18250 r18252 37 37 38 38 /** テンプレートクラス名1 */ 39 var $tpl_class_name1 ;39 var $tpl_class_name1 = array(); 40 40 41 41 /** テンプレートクラス名2 */ 42 var $tpl_class_name2 ;42 var $tpl_class_name2 = array(); 43 43 44 44 /** JavaScript テンプレート */ 45 45 var $tpl_javascript; 46 47 var $orderby; 48 49 var $mode; 50 51 /* 検索条件(内部データ) */ 52 var $arrSearchData = array(); 53 54 /* 検索条件(表示用) */ 55 var $arrSearch = array(); 56 57 var $tpl_subtitle = ''; 46 58 47 59 // }}} … … 61 73 $this->arrDELIVERYDATE = $masterData->getMasterData("mtb_delivery_date"); 62 74 $this->arrPRODUCTLISTMAX = $masterData->getMasterData("mtb_product_list_max"); 63 64 $this->tpl_class_name1 = array();65 $this->tpl_class_name2 = array();66 75 } 67 76 … … 72 81 */ 73 82 function process() { 74 // カテゴリIDの正当性チェック 75 $this->lfCheckCategoryId(); 76 77 $objView = new SC_SiteView(); 83 $this->lfLoadParam(); 84 85 $objView = new SC_SiteView($this->mode != 'cart'); 78 86 $conn = new SC_DBConn(); 79 87 $objDb = new SC_Helper_DB_Ex(); 80 88 81 // 表示件数・順序の初期化82 if (!isset($_GET['pageno'])) unset($_SESSION['products_list']);83 84 // 表示件数の取得85 if (isset($_POST['disp_number']) && SC_Utils_Ex::sfIsInt($_POST['disp_number'])) {86 $this->disp_number = $_SESSION['products_list']['disp_number'] = $_POST['disp_number'];87 } else {88 $this->disp_number = isset($_SESSION['products_list']['disp_number'])89 ? $_SESSION['products_list']['disp_number']90 : current(array_keys($this->arrPRODUCTLISTMAX));91 }92 93 // 表示順序の取得94 if (isset($_POST['orderby'])) {95 $this->orderby = $_SESSION['products_list']['orderby'] = $_POST['orderby'];96 } else {97 $this->orderby = isset($_SESSION['products_list']['orderby'])98 ? $_SESSION['products_list']['orderby']99 : "";100 }101 102 // GETのカテゴリIDを元に正しいカテゴリIDを取得する。103 $arrCategory_id = $objDb->sfGetCategoryId("", $_GET['category_id']);104 105 if (!isset($_GET['mode'])) $_GET['mode'] = "";106 if (!isset($_GET['name'])) $_GET['name'] = "";107 if (empty($arrCategory_id)) $arrCategory_id = array("0");108 109 89 // タイトル編集 110 $tpl_subtitle = ""; 111 if ($_GET['mode'] == 'search') { 112 $tpl_subtitle = "検索結果"; 113 } elseif (empty($arrCategory_id[0])) { 114 $tpl_subtitle = "全商品"; 115 } else { 116 $arrCat = $objDb->sfGetCat($arrCategory_id[0]); 117 $tpl_subtitle = $arrCat['name']; 90 if ($this->mode == 'search') { 91 $this->tpl_subtitle = "検索結果"; 92 } elseif ($this->arrSearchData['category_id'] == 0) { 93 $this->tpl_subtitle = "全商品"; 94 } else { 95 $arrCat = $objDb->sfGetCat($this->arrSearchData['category_id']); 96 $this->tpl_subtitle = $arrCat['name']; 118 97 } 119 98 120 99 $objQuery = new SC_Query(); 121 $count = $objQuery->count("dtb_best_products", "category_id = ?", $arrCategory_id); 122 123 // 以下の条件でBEST商品を表示する 124 // ・BEST最大数の商品が登録されている。 125 // ・カテゴリIDがルートIDである。 126 // ・検索モードでない。 127 if(($count >= BEST_MIN) && $this->lfIsRootCategory($arrCategory_id[0]) && ($_GET['mode'] != 'search') ) { 128 // 商品TOPの表示処理 129 $this->arrBestItems = SC_Utils_Ex::sfGetBestProducts($conn, $arrCategory_id[0]); 130 $this->BEST_ROOP_MAX = ceil((BEST_MAX-1)/2); 131 } else { 132 if ($_GET['mode'] == 'search' && strlen($_GET['category_id']) == 0 ){ 133 // 検索時にcategory_idがGETに存在しない場合は、仮に埋めたIDを空白に戻す 134 $arrCategory_id = array(0); 135 } 136 137 // 商品一覧の表示処理 138 $this->lfDispProductsList($arrCategory_id[0], $_GET['name'], $_GET['maker_id'], $this->disp_number, $this->orderby); 139 140 // 検索条件を画面に表示 141 // カテゴリー検索条件 142 if (strlen($_GET['category_id']) == 0) { 143 $arrSearch['category'] = "指定なし"; 144 }else{ 145 $arrCat = $conn->getOne("SELECT category_name FROM dtb_category WHERE category_id = ?", $arrCategory_id); 146 $arrSearch['category'] = $arrCat; 147 } 148 149 // メーカー検索条件 150 if (strlen($_GET['maker_id']) == 0) { 151 $arrSearch['maker'] = "指定なし"; 152 }else{ 153 $arrSearch['maker'] = $name = $conn->getOne("SELECT name FROM dtb_maker WHERE maker_id = ?", $_GET['maker_id']); 154 } 155 156 // 商品名検索条件 157 if ($_GET['name'] === "") { 158 $arrSearch['name'] = "指定なし"; 159 }else{ 160 $arrSearch['name'] = $_GET['name']; 161 } 100 $count = $objQuery->count("dtb_best_products", "category_id = ?", array($this->arrSearchData['category_id'])); 101 102 // 商品一覧の表示処理 103 $this->lfDispProductsList(); 104 105 // 検索条件を画面に表示 106 // カテゴリー検索条件 107 if ($this->arrSearchData['category_id'] == 0) { 108 $this->arrSearch['category'] = "指定なし"; 109 } else { 110 $arrCat = $conn->getOne("SELECT category_name FROM dtb_category WHERE category_id = ?", array($this->arrSearchData['category_id'])); 111 $this->arrSearch['category'] = $arrCat; 112 } 113 114 // メーカー検索条件 115 if (strlen($this->arrSearchData['maker_id']) == 0) { 116 $this->arrSearch['maker'] = "指定なし"; 117 } else { 118 $this->arrSearch['maker'] = $name = $conn->getOne("SELECT name FROM dtb_maker WHERE maker_id = ?", $this->arrSearchData['maker_id']); 119 } 120 121 // 商品名検索条件 122 if (strlen($this->arrSearchData['name']) == 0) { 123 $this->arrSearch['name'] = "指定なし"; 124 } else { 125 $this->arrSearch['name'] = $this->arrSearchData['name']; 162 126 } 163 127 … … 166 130 $layout->sfGetPageLayout($this, false, "products/list.php"); 167 131 168 if(isset($_POST['mode']) && $_POST['mode'] == "cart" 169 && $_POST['product_id'] != "") { 170 132 if ($this->mode == 'cart') { 171 133 // 値の正当性チェック 172 if (!SC_Utils_Ex::sfIsInt($_POST['product_id']) || !$objDb->sfIsRecord("dtb_products", "product_id", $_POST['product_id'], "del_flg = 0 AND status = 1")) {134 if (!SC_Utils_Ex::sfIsInt($this->arrForm['product_id']) || !$objDb->sfIsRecord("dtb_products", "product_id", $this->arrForm['product_id'], "del_flg = 0 AND status = 1")) { 173 135 SC_Utils_Ex::sfDispSiteError(PRODUCT_NOT_FOUND); 174 } else { 175 // 入力値の変換 176 $this->arrErr = $this->lfCheckError($_POST['product_id']); 177 if(count($this->arrErr) == 0) { 178 $objCartSess = new SC_CartSession(); 179 $classcategory_id = "classcategory_id". $_POST['product_id']; 180 $classcategory_id1 = $_POST[$classcategory_id. '_1']; 181 $classcategory_id2 = $_POST[$classcategory_id. '_2']; 182 $quantity = "quantity". $_POST['product_id']; 183 // 規格1が設定されていない場合 184 if(!$this->tpl_classcat_find1[$_POST['product_id']]) { 185 $classcategory_id1 = '0'; 186 } 187 // 規格2が設定されていない場合 188 if(!$this->tpl_classcat_find2[$_POST['product_id']]) { 189 $classcategory_id2 = '0'; 190 } 191 $objCartSess->setPrevURL($_SERVER['REQUEST_URI']); 192 $objCartSess->addProduct(array($_POST['product_id'], $classcategory_id1, $classcategory_id2), $_POST[$quantity]); 193 $this->sendRedirect($this->getLocation(URL_CART_TOP)); 194 exit; 136 } 137 // 入力値の変換 138 $this->arrErr = $this->lfCheckError($this->arrForm['product_id']); 139 if (count($this->arrErr) == 0) { 140 $classcategory_id = "classcategory_id". $this->arrForm['product_id']; 141 $classcategory_id1 = $this->arrForm[$classcategory_id. '_1']; 142 $classcategory_id2 = $this->arrForm[$classcategory_id. '_2']; 143 $quantity = "quantity". $this->arrForm['product_id']; 144 // 規格1が設定されていない場合 145 if (!$this->tpl_classcat_find1[$this->arrForm['product_id']]) { 146 $classcategory_id1 = '0'; 195 147 } 196 } 197 } 198 199 $this->tpl_subtitle = $tpl_subtitle; 200 201 // 支払方法の取得 202 $this->arrPayment = $this->lfGetPayment(); 203 // 入力情報を渡す 204 $this->arrForm = $_POST; 205 206 $this->lfConvertParam(); 207 208 $this->category_id = $arrCategory_id[0]; 209 $this->arrSearch = $arrSearch; 148 // 規格2が設定されていない場合 149 if (!$this->tpl_classcat_find2[$this->arrForm['product_id']]) { 150 $classcategory_id2 = '0'; 151 } 152 $objCartSess = new SC_CartSession(); 153 $objCartSess->addProduct(array($this->arrForm['product_id'], $classcategory_id1, $classcategory_id2), $this->arrForm[$quantity]); 154 $this->sendRedirect($this->getLocation(URL_CART_TOP)); 155 exit; 156 } 157 } 210 158 211 159 $objView->assignobj($this); … … 230 178 */ 231 179 function mobileProcess() { 232 // カテゴリIDの正当性チェック 233 $this->lfCheckCategoryId(); 180 $this->lfLoadParam(); 234 181 235 182 $objView = new SC_MobileView(); … … 237 184 $objDb = new SC_Helper_DB_Ex(); 238 185 239 //表示件数の選択240 if(isset($_REQUEST['disp_number'])241 && SC_Utils_Ex::sfIsInt($_REQUEST['disp_number'])) {242 $this->disp_number = $_REQUEST['disp_number'];243 } else {244 //最小表示件数を選択245 $this->disp_number = current(array_keys($this->arrPRODUCTLISTMAX));246 }247 248 //表示順序の保存249 $this->orderby = isset($_REQUEST['orderby']) ? $_REQUEST['orderby'] : "";250 251 // GETのカテゴリIDを元に正しいカテゴリIDを取得する。252 $arrCategory_id = $objDb->sfGetCategoryId("", $_GET['category_id']);253 254 255 186 // タイトル編集 256 $tpl_subtitle = "";257 187 $tpl_search_mode = false; 258 188 259 if (!isset($_GET['mode'])) $_GET['mode'] = ""; 260 if (!isset($_POST['mode'])) $_POST['mode'] = ""; 261 if (!isset($_GET['name'])) $_GET['name'] = ""; 262 if (!isset($_REQUEST['orderby'])) $_REQUEST['orderby'] = ""; 263 if (empty($arrCategory_id)) $arrCategory_id = array("0"); 264 265 if($_GET['mode'] == 'search'){ 266 $tpl_subtitle = "検索結果"; 189 if ($this->mode == 'search') { 190 $this->tpl_subtitle = "検索結果"; 267 191 $tpl_search_mode = true; 268 } elseif (empty($arrCategory_id[0])) {269 $t pl_subtitle = "全商品";270 } else{271 $arrCat = $objDb->sfGetCat($ arrCategory_id[0]);272 $t pl_subtitle = $arrCat['name'];192 } elseif ($this->arrSearchData['category_id'] == 0) { 193 $this->tpl_subtitle = "全商品"; 194 } else { 195 $arrCat = $objDb->sfGetCat($this->arrSearchData['category_id']); 196 $this->tpl_subtitle = $arrCat['name']; 273 197 } 274 198 275 199 $objQuery = new SC_Query(); 276 $count = $objQuery->count("dtb_best_products", "category_id = ?", $arrCategory_id); 277 278 // 以下の条件でBEST商品を表示する 279 // ・BEST最大数の商品が登録されている。 280 // ・カテゴリIDがルートIDである。 281 // ・検索モードでない。 282 if(($count >= BEST_MIN) && $this->lfIsRootCategory($arrCategory_id[0]) && ($_GET['mode'] != 'search') ) { 283 // 商品TOPの表示処理 284 285 $this->arrBestItems = SC_Utils_Ex::sfGetBestProducts($conn, $arrCategory_id[0]); 286 $this->BEST_ROOP_MAX = ceil((BEST_MAX-1)/2); 287 } else { 288 if ($_GET['mode'] == 'search' && strlen($_GET['category_id']) == 0 ){ 289 // 検索時にcategory_idがGETに存在しない場合は、仮に埋めたIDを空白に戻す 290 $arrCategory_id = array(""); 291 } 292 293 // 商品一覧の表示処理 294 $this->lfDispProductsList($arrCategory_id[0], $_GET['name'], $_GET['maker_id'], $this->disp_number, $_REQUEST['orderby']); 295 296 // 検索条件を画面に表示 297 // カテゴリー検索条件 298 if (strlen($_GET['category_id']) == 0) { 299 $arrSearch['category'] = "指定なし"; 300 }else{ 301 $arrCat = $conn->getOne("SELECT category_name FROM dtb_category WHERE category_id = ?",array($category_id)); 302 $arrSearch['category'] = $arrCat; 303 } 304 305 // 商品名検索条件 306 if ($_GET['name'] === "") { 307 $arrSearch['name'] = "指定なし"; 308 }else{ 309 $arrSearch['name'] = $_GET['name']; 310 } 311 } 312 313 if($_POST['mode'] == "cart" && $_POST['product_id'] != "") { 314 // 値の正当性チェック 315 if(!SC_Utils_Ex::sfIsInt($_POST['product_id']) || !SC_Utils_Ex::sfIsRecord("dtb_products", "product_id", $_POST['product_id'], "del_flg = 0 AND status = 1")) { 316 SC_Utils_Ex::sfDispSiteError(PRODUCT_NOT_FOUND, "", false, "", true); 317 } else { 318 // 入力値の変換 319 $this->arrErr = $this->lfCheckError($_POST['product_id']); 320 if(count($this->arrErr) == 0) { 321 $objCartSess = new SC_CartSession(); 322 $classcategory_id = "classcategory_id". $_POST['product_id']; 323 $classcategory_id1 = $_POST[$classcategory_id. '_1']; 324 $classcategory_id2 = $_POST[$classcategory_id. '_2']; 325 $quantity = "quantity". $_POST['product_id']; 326 // 規格1が設定されていない場合 327 if(!$this->tpl_classcat_find1[$_POST['product_id']]) { 328 $classcategory_id1 = '0'; 329 } 330 // 規格2が設定されていない場合 331 if(!$this->tpl_classcat_find2[$_POST['product_id']]) { 332 $classcategory_id2 = '0'; 333 } 334 $objCartSess->setPrevURL($_SERVER['REQUEST_URI']); 335 $objCartSess->addProduct(array($_POST['product_id'], $classcategory_id1, $classcategory_id2), $_POST[$quantity]); 336 $this->sendRedirect(MOBILE_URL_CART_TOP, array(session_name() => session_id())); 337 exit; 338 } 339 } 340 } 341 200 $count = $objQuery->count("dtb_best_products", "category_id = ?", array($this->arrSearchData['category_id'])); 201 202 // 商品一覧の表示処理 203 $this->lfDispProductsList(); 204 205 // 検索条件を画面に表示 206 // カテゴリー検索条件 207 if ($this->arrSearchData['category_id'] == 0) { 208 $this->arrSearch['category'] = "指定なし"; 209 } else { 210 $arrCat = $conn->getOne("SELECT category_name FROM dtb_category WHERE category_id = ?",array($category_id)); 211 $this->arrSearch['category'] = $arrCat; 212 } 213 214 // 商品名検索条件 215 if ($this->arrForm['name'] === "") { 216 $this->arrSearch['name'] = "指定なし"; 217 } else { 218 $this->arrSearch['name'] = $this->arrForm['name']; 219 } 342 220 343 221 // ページ送り機能用のURLを作成する。 … … 359 237 } 360 238 361 $this->tpl_subtitle = $tpl_subtitle;362 239 $this->tpl_search_mode = $tpl_search_mode; 363 240 364 // 支払方法の取得365 $this->arrPayment = $this->lfGetPayment();366 // 入力情報を渡す367 $this->arrForm = $_POST;368 369 $this->category_id = $arrCategory_id[0];370 $this->arrSearch = $arrSearch;371 241 $this->tpl_mainpage = MOBILE_TEMPLATE_DIR . "products/list.tpl"; 372 242 … … 384 254 } 385 255 386 /* カテゴリIDの正当性チェック */ 387 function lfCheckCategoryId() { 256 /** 257 * カテゴリIDの取得 258 * 259 * @return integer カテゴリID 260 */ 261 function lfGetCategoryId($category_id) { 388 262 $objDb = new SC_Helper_DB_Ex(); 389 $category_id = $_POST['category_id'] ? $_POST['category_id'] : $_GET['category_id']; 390 if ($category_id 391 && (!SC_Utils_Ex::sfIsInt($category_id) 392 || SC_Utils_Ex::sfIsZeroFilling($category_id) 393 || !$objDb->sfIsRecord('dtb_category', 'category_id', (array)$category_id, 'del_flg = 0'))) 263 264 // 指定なしの場合、0 を返す 265 if ( 266 strlen($category_id) == 0 267 || (String) $category_id == '0' 268 ) { 269 return 0; 270 } 271 272 // 正当性チェック 273 if ( 274 !SC_Utils_Ex::sfIsInt($category_id) 275 || SC_Utils_Ex::sfIsZeroFilling($category_id) 276 || !$objDb->sfIsRecord('dtb_category', 'category_id', (array)$category_id, 'del_flg = 0') 277 ) { 394 278 SC_Utils_Ex::sfDispSiteError(CATEGORY_NOT_FOUND); 395 }396 397 /* カテゴリIDがルートかどうかの判定 */398 function lfIsRootCategory($category_id) {399 $objQuery = new SC_Query();400 $level = $objQuery->get("dtb_category", "level", "category_id = ?", array($category_id));401 if($level == 1) {402 return true;403 }404 return false;279 } 280 281 // 指定されたカテゴリIDを元に正しいカテゴリIDを取得する。 282 $arrCategory_id = $objDb->sfGetCategoryId('', $category_id); 283 284 if (empty($arrCategory_id)) { 285 SC_Utils_Ex::sfDispSiteError(CATEGORY_NOT_FOUND); 286 } 287 288 return $arrCategory_id[0]; 405 289 } 406 290 407 291 /* 商品一覧の表示 */ 408 function lfDispProductsList( $category_id, $name, $maker_id, $disp_number, $orderby) {292 function lfDispProductsList() { 409 293 410 294 $objQuery = new SC_Query(); 411 295 $objDb = new SC_Helper_DB_Ex(); 412 $this->tpl_pageno = @$_GET['pageno'];413 296 $arrval = array(); 414 297 $arrval_order = array(); … … 416 299 417 300 // カテゴリからのWHERE文字列取得 418 if ( $category_id) {419 list($where_category, $arrval_category) = $objDb->sfGetCatWhere($ category_id);301 if ($this->arrSearchData['category_id'] != 0) { 302 list($where_category, $arrval_category) = $objDb->sfGetCatWhere($this->arrSearchData['category_id']); 420 303 } 421 304 … … 435 318 436 319 // 商品名をwhere文に 320 $name = $this->arrSearchData['name']; 437 321 $name = ereg_replace(",", "", $name);// XXX 438 322 // 全角スペースを半角スペースに変換 … … 442 326 // 分割したキーワードを一つずつwhere文に追加 443 327 foreach ($names as $val) { 444 if ( strlen($val) > 0 ) {328 if ( strlen($val) > 0 ) { 445 329 $where .= " AND ( name ILIKE ? OR comment3 ILIKE ?) "; 446 330 $ret = SC_Utils_Ex::sfManualEscape($val); … … 451 335 452 336 // メーカーらのWHERE文字列取得 453 if ( $maker_id) {337 if ($this->arrSearchData['maker_id']) { 454 338 $where .= " AND maker_id = ? "; 455 $arrval[] = $ maker_id;339 $arrval[] = $this->arrSearchData['maker_id']; 456 340 } 457 341 … … 465 349 466 350 // ページ送りの取得 467 $this->objNavi = new SC_PageNavi($this->tpl_pageno, $linemax, $ disp_number, "fnNaviPage", NAVI_PMAX);351 $this->objNavi = new SC_PageNavi($this->tpl_pageno, $linemax, $this->disp_number, "fnNaviPage", NAVI_PMAX, 'pageno=#page#'); 468 352 $strnavi = $this->objNavi->strnavi; 469 $query_string = htmlentities($_SERVER['QUERY_STRING'], ENT_QUOTES, CHAR_CODE);470 if (preg_match('|&pageno=|', $query_string))471 $query_string = preg_replace('|&pageno=[0-9]+|', '', $query_string);472 $strnavi = preg_replace('|list\.php.*?\'([0-9]+)\'.*?\"|', 'list.php?' . $query_string . '&pageno=$1"', $strnavi);473 353 474 354 // 表示文字列 … … 518 398 519 399 // 表示順序 520 switch ($ orderby) {400 switch ($this->orderby) { 521 401 522 402 // 販売価格順 … … 566 446 567 447 // 取得範囲の指定(開始行番号、行数のセット) 568 $objQuery->setlimitoffset($ disp_number, $startno);448 $objQuery->setlimitoffset($this->disp_number, $startno); 569 449 // 表示順序 570 450 $objQuery->setorder($order); … … 623 503 for ($i = 0; $i < $count; $i++) { 624 504 // 在庫のチェック 625 if ($arrProductsClass[$i]['stock'] <= 0 && $arrProductsClass[$i]['stock_unlimited'] != '1') {505 if ($arrProductsClass[$i]['stock'] <= 0 && $arrProductsClass[$i]['stock_unlimited'] != '1') { 626 506 continue; 627 507 } … … 630 510 631 511 // 規格1のセレクトボックス用 632 if ($classcat_id1 != $arrProductsClass[$i]['classcategory_id1']){512 if ($classcat_id1 != $arrProductsClass[$i]['classcategory_id1']) { 633 513 $arrList[$list_id].=");\n"; 634 514 $arrVal[$list_id].=");\n"; … … 645 525 646 526 // セレクトボックス表示値 647 if ($arrList[$list_id] == "") {527 if ($arrList[$list_id] == "") { 648 528 $arrList[$list_id] = "\tlist". $product_id. "_". $list_id. " = new Array('選択してください', '". $arrClassCatName[$classcat_id2]. "'"; 649 529 } else { … … 652 532 653 533 // セレクトボックスPOST値 654 if ($arrVal[$list_id] == "") {534 if ($arrVal[$list_id] == "") { 655 535 $arrVal[$list_id] = "\tval". $product_id. "_". $list_id. " = new Array('', '". $classcat_id2. "'"; 656 536 } else { … … 696 576 $classcategory_id_2 = $classcategory_id . "_2"; 697 577 if (!isset($classcategory_id_2)) $classcategory_id_2 = ""; 698 if (!isset($ _POST[$classcategory_id_2]) || !is_numeric($_POST[$classcategory_id_2])) $_POST[$classcategory_id_2] = "";578 if (!isset($this->arrForm[$classcategory_id_2]) || !is_numeric($this->arrForm[$classcategory_id_2])) $this->arrForm[$classcategory_id_2] = ""; 699 579 700 580 $this->tpl_onload .= "lnSetSelect('" . $classcategory_id ."_1', " 701 581 . "'" . $classcategory_id_2 . "'," 702 582 . "'" . $product_id . "'," 703 . "'" . $ _POST[$classcategory_id_2] ."'); ";583 . "'" . $this->arrForm[$classcategory_id_2] ."'); "; 704 584 705 585 // 規格1が設定されている 706 if ($arrProductsClass[0]['classcategory_id1'] != '0') {586 if ($arrProductsClass[0]['classcategory_id1'] != '0') { 707 587 $classcat_find1 = true; 708 588 } 709 589 710 590 // 規格2が設定されている 711 if ($arrProductsClass[0]['classcategory_id2'] != '0') {591 if ($arrProductsClass[0]['classcategory_id2'] != '0') { 712 592 $classcat_find2 = true; 713 593 } … … 721 601 function lfGetProductsClass($product_id) { 722 602 $arrRet = array(); 723 if (SC_Utils_Ex::sfIsInt($product_id)) {603 if (SC_Utils_Ex::sfIsInt($product_id)) { 724 604 // 商品規格取得 725 605 $objQuery = new SC_Query(); … … 737 617 738 618 // 入力データを渡す。 739 $objErr = new SC_CheckError( );619 $objErr = new SC_CheckError($this->arrForm); 740 620 741 621 $classcategory_id1 = "classcategory_id". $id. "_1"; … … 757 637 function lfGetSaleLimit($product) { 758 638 //在庫が無限または購入制限値が設定値より大きい場合 759 if ($product['sale_unlimited'] == 1 || $product['sale_limit'] > SALE_LIMIT_MAX) {639 if ($product['sale_unlimited'] == 1 || $product['sale_limit'] > SALE_LIMIT_MAX) { 760 640 $this->tpl_sale_limit[$product['product_id']] = SALE_LIMIT_MAX; 761 641 } else { … … 764 644 } 765 645 766 //支払方法の取得 767 //payment_id 1:代金引換 2:銀行振り込み 3:現金書留 768 function lfGetPayment() { 769 $objQuery = new SC_Query; 770 $col = "payment_id, rule, payment_method"; 771 $from = "dtb_payment"; 772 $where = "del_flg = 0"; 773 $order = "payment_id"; 774 $objQuery->setorder($order); 775 $arrRet = $objQuery->select($col, $from, $where); 776 return $arrRet; 777 } 778 779 function lfconvertParam () { 780 foreach ($this->arrForm as $key => $value) { 781 if (preg_match('/^quantity[0-9]+/', $key)) { 782 $this->arrForm[$key] 783 = htmlspecialchars($this->arrForm[$key], ENT_QUOTES, CHAR_CODE); 784 } 785 } 646 /** 647 * パラメータの読み込み 648 * 649 * @return void 650 */ 651 function lfLoadParam() { 652 $this->arrForm = $_GET; 653 654 $this->mode = $this->arrForm['mode']; 655 $this->arrSearchData['category_id'] = $this->lfGetCategoryId($this->arrForm['category_id']); 656 $this->arrSearchData['maker_id'] = $this->arrForm['maker_id']; 657 $this->arrSearchData['name'] = $this->arrForm['name']; 658 $this->orderby = $this->arrForm['orderby']; 659 // 表示件数 660 if ( 661 isset($this->arrForm['disp_number']) 662 && SC_Utils_Ex::sfIsInt($this->arrForm['disp_number']) 663 ) { 664 $this->disp_number = $this->arrForm['disp_number']; 665 } else { 666 //最小表示件数を選択 667 $this->disp_number = current(array_keys($this->arrPRODUCTLISTMAX)); 668 } 669 $this->tpl_pageno = $this->arrForm['pageno']; 786 670 } 787 671 } -
branches/comu-ver2/data/class/util/SC_Utils.php
r18234 r18252 942 942 } 943 943 944 // カテゴリ別おすすめ商品の取得945 function sfGetBestProducts( $conn, $category_id = 0){946 $sql = '';947 // 既に登録されている内容を取得する948 $sql .= "SELECT name, main_image, main_list_image, price01_min, price01_max, price02_min, price02_max, point_rate,949 A.product_id, A.comment FROM dtb_best_products as A LEFT JOIN vw_products_allclass AS allcls950 USING (product_id) WHERE A.category_id = ? AND A.del_flg = 0 AND allcls.del_flg = 0 AND allcls.status = 1";951 952 // 在庫無し商品の非表示953 if (NOSTOCK_HIDDEN === true) {954 $sql .= ' AND (allcls.stock_max >= 1 OR allcls.stock_unlimited_max = 1)';955 }956 957 $sql .= " ORDER BY A.rank";958 $arrItems = $conn->getAll($sql, array($category_id));959 960 return $arrItems;961 }962 963 944 // 特殊制御文字の手動エスケープ 964 945 function sfManualEscape($data) { -
branches/comu-ver2/data/module/Mail/smtp.php
r16300 r18252 78 78 * @var mixed 79 79 */ 80 var $auth = false;80 var $auth = true; 81 81 82 82 /** … … 84 84 * @var string 85 85 */ 86 var $username = ' ';86 var $username = 'eccube_smtp'; 87 87 88 88 /** … … 90 90 * @var string 91 91 */ 92 var $password = ' ';92 var $password = 'ecpw09'; 93 93 94 94 /** -
branches/comu-ver2/data/mtb_constants_init.php
r18242 r18252 491 491 /** おすすめ商品表示数 */ 492 492 define('RECOMMEND_NUM', 8); 493 /** ベスト商品の最大登録数 */494 define('BEST_MAX', 5);495 /** ベスト商品の最小登録数(登録数が満たない場合は表示しない。) */496 define('BEST_MIN', 3);497 493 /** お届け可能日以降のプルダウン表示最大日数 */ 498 494 define('DELIV_DATE_END_MAX', 21); -
branches/comu-ver2/html/install/sql/insert_data.sql
r18242 r18252 1024 1024 INSERT INTO mtb_constants VALUES ('RECOMMEND_PRODUCT_MAX','6',268,'関連商品表示数'); 1025 1025 INSERT INTO mtb_constants VALUES ('RECOMMEND_NUM','8',269,'おすすめ商品表示数'); 1026 INSERT INTO mtb_constants VALUES ('BEST_MAX','5',270,'ベスト商品の最大登録数');1027 INSERT INTO mtb_constants VALUES ('BEST_MIN','3',271,'ベスト商品の最小登録数(登録数が満たない場合は表示しない。)');1028 1026 INSERT INTO mtb_constants VALUES ('DELIV_DATE_END_MAX','21',272,'お届け可能日以降のプルダウン表示最大日数'); 1029 1027 INSERT INTO mtb_constants VALUES ('PURCHASE_CUSTOMER_REGIST','0',273,'購入時強制会員登録(1:有効 0:無効)');
Note: See TracChangeset
for help on using the changeset viewer.