Changeset 18252


Ignore:
Timestamp:
2009/08/04 12:47:34 (15 years ago)
Author:
Seasoft
Message:

フロント機能「商品一覧」画面を改訂。

  • 全パラメータをGETに統一
    • #532(現在のカゴの中から[前のページへ戻る]で、並び順の指定が解除される)を改修
    • #533(商品一覧の1ページ目しかクロールされない)を改善
  • 利用の無い処理の削除
Location:
branches/comu-ver2
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • branches/comu-ver2/data/Smarty/templates/default/list.tpl

    r18240 r18252  
    5252<!--▼CONTENTS--> 
    5353<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        <!--{* ▲検索条件 *}--> 
    5661        <input type="hidden" name="orderby" value="<!--{$orderby|escape}-->" /> 
    5762        <input type="hidden" name="disp_number" value="<!--{$disp_number|escape}-->" /> 
     63        <input type="hidden" name="pageno" value="<!--{$tpl_pageno|escape}-->" /> 
    5864        <input type="hidden" name="product_id" value="" /> 
    5965         
     
    6571            <ul class="pagecondarea"> 
    6672                <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}--> 
    6874                <li><strong>商品名:</strong><!--{$arrSearch.name|escape}--></li> 
    6975            </ul> 
     
    192198                                <dt>数量:</dt> 
    193199                                <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}-->" /> 
    195201                                    <!--{if $arrErr[$quantity] != ""}--> 
    196202                                        <br /><span class="attention"><!--{$arrErr[$quantity]}--></span> 
     
    199205                            </dl> 
    200206                            <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                                > 
    202213                                    <img src="<!--{$TPL_DIR}-->img/products/b_cartin.gif" width="115" height="25" alt="カゴに入れる" name="cart<!--{$id}-->" id="cart<!--{$id}-->" /></a> 
    203214                            </div> 
  • branches/comu-ver2/data/class/SC_PageNavi.php

    r16741 r18252  
    3535*/ 
    3636class 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(); // ページ 
    4242 
    4343    // コンストラクタ 
    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 = '') { 
    4545        $this->arrPagenavi['mode'] = 'search'; 
    46         $ps = htmlspecialchars($_SERVER['PHP_SELF'], ENT_QUOTES); 
    4746 
    4847        //現在ページ($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) { 
    5049            $this->now_page = 1; 
    5150        } else { 
     
    5857 
    5958        // 最終ページよりも現在ページが大きい場合は、最初に戻す。 
    60         if($this->max_page < $this->now_page) { 
     59        if ($this->max_page < $this->now_page) { 
    6160            $this->now_page = 1; 
    6261        } 
     
    6968        } 
    7069 
    71         if($all_row > 1) { 
     70        if ($all_row > 1) { 
    7271 
    7372            //「前へ」「次へ」の設定 
     
    7574            $next = ""; 
    7675            if ($this->now_page > 1) { 
    77                 $before="<a href=\"". $ps . "\" onclick=\"$func_name('" . (($this->now_page) - 1) . "'); return false;\">&lt;&lt;前へ</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;\">&lt;&lt;前へ</a> "; 
     80            } else { 
    8081                $this->arrPagenavi['before'] = $this->now_page; 
    8182            } 
    8283 
    8384            if ($this->now_page < $this->max_page) { 
    84                 $next=" <a href=\"". $ps . "\" onclick=\"$func_name('" . (($this->now_page) + 1) ."'); return false;\">次へ&gt;&gt;</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;\">次へ&gt;&gt;</a>"; 
     89            } else { 
    8790                $this->arrPagenavi['next'] = $this->now_page; 
    8891            } 
    8992 
    9093            // 表示する最大ナビ数を決める。 
    91             if($navi_max == "" || $navi_max > $this->max_page) { 
     94            if ($navi_max == "" || $navi_max > $this->max_page) { 
    9295                // 制限ナビ数の指定がない。ページ最大数が制限ナビ数より少ない。 
    9396                $disp_max = $this->max_page; 
     
    9699                $disp_max = $this->now_page + $navi_max - 1; 
    97100                // ページ最大数を超えている場合は、ページ最大数に合わせる。 
    98                 if($disp_max > $this->max_page) { 
     101                if ($disp_max > $this->max_page) { 
    99102                    $disp_max = $this->max_page; 
    100103                } 
     
    102105 
    103106            // 表示する最小ナビ数を決める。 
    104             if($navi_max == "" || $navi_max > $this->now_page) { 
     107            if ($navi_max == "" || $navi_max > $this->now_page) { 
    105108                // 制限ナビ数の指定がない。現在ページ番号が制限ナビ数より少ない。 
    106109                $disp_min = 1; 
     
    114117            for ($i=$disp_min; $i <= $disp_max; $i++) { 
    115118 
    116                 if($i != $disp_max) { 
     119                if ($i != $disp_max) { 
    117120                    $sep = " | "; 
    118121                } else { 
     
    123126                    $page_number .= "<strong>$i</strong>"; 
    124127                } 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>"; 
    126131                } 
    127132 
    128                 $page_number.=$sep; 
     133                $page_number .= $sep; 
    129134 
    130135                $this->arrPagenavi['arrPageno'][$i] = $i; 
     
    134139                $this->strnavi = $before .$page_number .$next; 
    135140            } 
    136         }else{ 
     141        } else { 
    137142            $this->arrPagenavi['arrPageno'][0] = 1; 
    138143            $this->arrPagenavi['before'] = 1; 
  • branches/comu-ver2/data/class/pages/products/LC_Page_Products_List.php

    r18250 r18252  
    3737 
    3838    /** テンプレートクラス名1 */ 
    39     var $tpl_class_name1; 
     39    var $tpl_class_name1 = array(); 
    4040 
    4141    /** テンプレートクラス名2 */ 
    42     var $tpl_class_name2; 
     42    var $tpl_class_name2 = array(); 
    4343 
    4444    /** JavaScript テンプレート */ 
    4545    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 = ''; 
    4658 
    4759    // }}} 
     
    6173        $this->arrDELIVERYDATE = $masterData->getMasterData("mtb_delivery_date"); 
    6274        $this->arrPRODUCTLISTMAX = $masterData->getMasterData("mtb_product_list_max"); 
    63  
    64         $this->tpl_class_name1 = array(); 
    65         $this->tpl_class_name2 = array(); 
    6675    } 
    6776 
     
    7281     */ 
    7382    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'); 
    7886        $conn = new SC_DBConn(); 
    7987        $objDb = new SC_Helper_DB_Ex(); 
    8088 
    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  
    10989        // タイトル編集 
    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']; 
    11897        } 
    11998 
    12099        $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']; 
    162126        } 
    163127 
     
    166130        $layout->sfGetPageLayout($this, false, "products/list.php"); 
    167131 
    168         if(isset($_POST['mode']) && $_POST['mode'] == "cart" 
    169            && $_POST['product_id'] != "") { 
    170  
     132        if ($this->mode == 'cart') { 
    171133            // 値の正当性チェック 
    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")) { 
    173135                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'; 
    195147                } 
    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        } 
    210158 
    211159        $objView->assignobj($this); 
     
    230178     */ 
    231179    function mobileProcess() { 
    232         // カテゴリIDの正当性チェック 
    233         $this->lfCheckCategoryId(); 
     180        $this->lfLoadParam(); 
    234181 
    235182        $objView = new SC_MobileView(); 
     
    237184        $objDb = new SC_Helper_DB_Ex(); 
    238185 
    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  
    255186        // タイトル編集 
    256         $tpl_subtitle = ""; 
    257187        $tpl_search_mode = false; 
    258188 
    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 = "検索結果"; 
    267191            $tpl_search_mode = true; 
    268         }elseif (empty($arrCategory_id[0])) { 
    269             $tpl_subtitle = "全商品"; 
    270         }else{ 
    271             $arrCat = $objDb->sfGetCat($arrCategory_id[0]); 
    272             $tpl_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']; 
    273197        } 
    274198 
    275199        $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        } 
    342220 
    343221        // ページ送り機能用のURLを作成する。 
     
    359237        } 
    360238 
    361         $this->tpl_subtitle = $tpl_subtitle; 
    362239        $this->tpl_search_mode = $tpl_search_mode; 
    363240 
    364         // 支払方法の取得 
    365         $this->arrPayment = $this->lfGetPayment(); 
    366         // 入力情報を渡す 
    367         $this->arrForm = $_POST; 
    368  
    369         $this->category_id = $arrCategory_id[0]; 
    370         $this->arrSearch = $arrSearch; 
    371241        $this->tpl_mainpage = MOBILE_TEMPLATE_DIR . "products/list.tpl"; 
    372242 
     
    384254    } 
    385255 
    386     /* カテゴリIDの正当性チェック */ 
    387     function lfCheckCategoryId() { 
     256    /** 
     257     * カテゴリIDの取得 
     258     * 
     259     * @return integer カテゴリID 
     260     */ 
     261    function lfGetCategoryId($category_id) { 
    388262        $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        ) { 
    394278            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]; 
    405289    } 
    406290 
    407291    /* 商品一覧の表示 */ 
    408     function lfDispProductsList($category_id, $name, $maker_id, $disp_number, $orderby) { 
     292    function lfDispProductsList() { 
    409293 
    410294        $objQuery = new SC_Query(); 
    411295        $objDb = new SC_Helper_DB_Ex(); 
    412         $this->tpl_pageno = @$_GET['pageno']; 
    413296        $arrval = array(); 
    414297        $arrval_order = array(); 
     
    416299         
    417300        // カテゴリからの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']); 
    420303        } 
    421304         
     
    435318 
    436319        // 商品名をwhere文に 
     320        $name = $this->arrSearchData['name']; 
    437321        $name = ereg_replace(",", "", $name);// XXX 
    438322        // 全角スペースを半角スペースに変換 
     
    442326        // 分割したキーワードを一つずつwhere文に追加 
    443327        foreach ($names as $val) { 
    444             if ( strlen($val) > 0 ){ 
     328            if ( strlen($val) > 0 ) { 
    445329                $where .= " AND ( name ILIKE ? OR comment3 ILIKE ?) "; 
    446330                $ret = SC_Utils_Ex::sfManualEscape($val); 
     
    451335 
    452336        // メーカーらのWHERE文字列取得 
    453         if ( $maker_id ) { 
     337        if ($this->arrSearchData['maker_id']) { 
    454338            $where .= " AND maker_id = ? "; 
    455             $arrval[] = $maker_id; 
     339            $arrval[] = $this->arrSearchData['maker_id']; 
    456340        } 
    457341         
     
    465349 
    466350        // ページ送りの取得 
    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#'); 
    468352        $strnavi = $this->objNavi->strnavi; 
    469         $query_string = htmlentities($_SERVER['QUERY_STRING'], ENT_QUOTES, CHAR_CODE); 
    470         if (preg_match('|&amp;pageno=|', $query_string)) 
    471             $query_string = preg_replace('|&amp;pageno=[0-9]+|', '', $query_string); 
    472         $strnavi = preg_replace('|list\.php.*?\'([0-9]+)\'.*?\"|', 'list.php?' . $query_string . '&amp;pageno=$1"', $strnavi);  
    473353 
    474354        // 表示文字列 
     
    518398         
    519399        // 表示順序 
    520         switch ($orderby) { 
     400        switch ($this->orderby) { 
    521401 
    522402            // 販売価格順 
     
    566446         
    567447        // 取得範囲の指定(開始行番号、行数のセット) 
    568         $objQuery->setlimitoffset($disp_number, $startno); 
     448        $objQuery->setlimitoffset($this->disp_number, $startno); 
    569449        // 表示順序 
    570450        $objQuery->setorder($order); 
     
    623503        for ($i = 0; $i < $count; $i++) { 
    624504            // 在庫のチェック 
    625             if($arrProductsClass[$i]['stock'] <= 0 && $arrProductsClass[$i]['stock_unlimited'] != '1') { 
     505            if ($arrProductsClass[$i]['stock'] <= 0 && $arrProductsClass[$i]['stock_unlimited'] != '1') { 
    626506                continue; 
    627507            } 
     
    630510 
    631511            // 規格1のセレクトボックス用 
    632             if($classcat_id1 != $arrProductsClass[$i]['classcategory_id1']){ 
     512            if ($classcat_id1 != $arrProductsClass[$i]['classcategory_id1']) { 
    633513                $arrList[$list_id].=");\n"; 
    634514                $arrVal[$list_id].=");\n"; 
     
    645525 
    646526            // セレクトボックス表示値 
    647             if($arrList[$list_id] == "") { 
     527            if ($arrList[$list_id] == "") { 
    648528                $arrList[$list_id] = "\tlist". $product_id. "_". $list_id. " = new Array('選択してください', '". $arrClassCatName[$classcat_id2]. "'"; 
    649529            } else { 
     
    652532 
    653533            // セレクトボックスPOST値 
    654             if($arrVal[$list_id] == "") { 
     534            if ($arrVal[$list_id] == "") { 
    655535                $arrVal[$list_id] = "\tval". $product_id. "_". $list_id. " = new Array('', '". $classcat_id2. "'"; 
    656536            } else { 
     
    696576        $classcategory_id_2 = $classcategory_id . "_2"; 
    697577        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] = ""; 
    699579 
    700580        $this->tpl_onload .= "lnSetSelect('" . $classcategory_id ."_1', " 
    701581            . "'" . $classcategory_id_2 . "'," 
    702582            . "'" . $product_id . "'," 
    703             . "'" . $_POST[$classcategory_id_2] ."'); "; 
     583            . "'" . $this->arrForm[$classcategory_id_2] ."'); "; 
    704584 
    705585        // 規格1が設定されている 
    706         if($arrProductsClass[0]['classcategory_id1'] != '0') { 
     586        if ($arrProductsClass[0]['classcategory_id1'] != '0') { 
    707587            $classcat_find1 = true; 
    708588        } 
    709589 
    710590        // 規格2が設定されている 
    711         if($arrProductsClass[0]['classcategory_id2'] != '0') { 
     591        if ($arrProductsClass[0]['classcategory_id2'] != '0') { 
    712592            $classcat_find2 = true; 
    713593        } 
     
    721601    function lfGetProductsClass($product_id) { 
    722602        $arrRet = array(); 
    723         if(SC_Utils_Ex::sfIsInt($product_id)) { 
     603        if (SC_Utils_Ex::sfIsInt($product_id)) { 
    724604            // 商品規格取得 
    725605            $objQuery = new SC_Query(); 
     
    737617 
    738618        // 入力データを渡す。 
    739         $objErr = new SC_CheckError(); 
     619        $objErr = new SC_CheckError($this->arrForm); 
    740620 
    741621        $classcategory_id1 = "classcategory_id". $id. "_1"; 
     
    757637    function lfGetSaleLimit($product) { 
    758638        //在庫が無限または購入制限値が設定値より大きい場合 
    759         if($product['sale_unlimited'] == 1 || $product['sale_limit'] > SALE_LIMIT_MAX) { 
     639        if ($product['sale_unlimited'] == 1 || $product['sale_limit'] > SALE_LIMIT_MAX) { 
    760640            $this->tpl_sale_limit[$product['product_id']] = SALE_LIMIT_MAX; 
    761641        } else { 
     
    764644    } 
    765645 
    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']; 
    786670    } 
    787671} 
  • branches/comu-ver2/data/class/util/SC_Utils.php

    r18234 r18252  
    942942    } 
    943943 
    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 allcls 
    950                 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  
    963944    // 特殊制御文字の手動エスケープ 
    964945    function sfManualEscape($data) { 
  • branches/comu-ver2/data/module/Mail/smtp.php

    r16300 r18252  
    7878     * @var mixed 
    7979     */ 
    80     var $auth = false; 
     80    var $auth = true; 
    8181 
    8282    /** 
     
    8484     * @var string 
    8585     */ 
    86     var $username = ''; 
     86    var $username = 'eccube_smtp'; 
    8787 
    8888    /** 
     
    9090     * @var string 
    9191     */ 
    92     var $password = ''; 
     92    var $password = 'ecpw09'; 
    9393 
    9494    /** 
  • branches/comu-ver2/data/mtb_constants_init.php

    r18242 r18252  
    491491/** おすすめ商品表示数 */ 
    492492define('RECOMMEND_NUM', 8); 
    493 /** ベスト商品の最大登録数 */ 
    494 define('BEST_MAX', 5); 
    495 /** ベスト商品の最小登録数(登録数が満たない場合は表示しない。) */ 
    496 define('BEST_MIN', 3); 
    497493/** お届け可能日以降のプルダウン表示最大日数 */ 
    498494define('DELIV_DATE_END_MAX', 21); 
  • branches/comu-ver2/html/install/sql/insert_data.sql

    r18242 r18252  
    10241024INSERT INTO mtb_constants VALUES ('RECOMMEND_PRODUCT_MAX','6',268,'関連商品表示数'); 
    10251025INSERT 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,'ベスト商品の最小登録数(登録数が満たない場合は表示しない。)'); 
    10281026INSERT INTO mtb_constants VALUES ('DELIV_DATE_END_MAX','21',272,'お届け可能日以降のプルダウン表示最大日数'); 
    10291027INSERT INTO mtb_constants VALUES ('PURCHASE_CUSTOMER_REGIST','0',273,'購入時強制会員登録(1:有効 0:無効)'); 
Note: See TracChangeset for help on using the changeset viewer.