Ignore:
Timestamp:
2012/05/01 15:17:59 (12 years ago)
Author:
tokuhiro
Message:

refs #1789
おすすめ商品管理に並べ替え機能を追加

Location:
branches/version-2_12-dev/data
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_12-dev/data/Smarty/templates/admin/contents/recommend.tpl

    r21539 r21802  
    6464} 
    6565 
     66function lfnSortItem(mode,data){ 
     67    var flag = true; 
     68    var checkRank = '<!--{$checkRank|h}-->'; 
     69    if ( checkRank ){ 
     70        if( ! window.confirm('さきほど選択した<!--{$checkRank|h}-->位の情報は破棄されます。宜しいでしょうか')){ 
     71            flag = false; 
     72        } 
     73    } 
     74     
     75    if ( flag ){ 
     76        document.form1["mode"].value = mode; 
     77        document.form1["rank"].value = data; 
     78        document.form1.submit(); 
     79    } 
     80} 
     81 
    6682//--> 
    6783</script> 
    68  
    6984 
    7085        <!--{section name=cnt loop=$tpl_disp_max}--> 
     
    8196            <th>編集</th> 
    8297            <th>削除</th> 
     98            <th>並び替え</th> 
    8399        </tr> 
    84100 
     
    137153                <!--{/if}--> 
    138154            </td> 
     155            <td> 
     156                <!--{* 移動 *}--> 
     157                <!--{if $smarty.section.cnt.iteration != 1 && $arrItems[$smarty.section.cnt.iteration].product_id}--> 
     158                    <a href="?" onclick="lfnSortItem('up',<!--{$arrItems[$smarty.section.cnt.iteration].rank}-->); return false;">上へ</a><br>&nbsp; 
     159                <!--{/if}--> 
     160                <!--{if $smarty.section.cnt.iteration != $tpl_disp_max && $arrItems[$smarty.section.cnt.iteration].product_id}--> 
     161                    <a href="?" onclick="lfnSortItem('down',<!--{$arrItems[$smarty.section.cnt.iteration].rank}-->); return false;">下へ</a> 
     162                <!--{/if}--> 
     163            </td> 
    139164        </tr> 
    140165 
  • branches/version-2_12-dev/data/class/pages/admin/contents/LC_Page_Admin_Contents_Recommend.php

    r21743 r21802  
    6969     */ 
    7070    function action() { 
    71  
    7271        $objFormParam = new SC_FormParam_Ex(); 
    7372        $this->lfInitParam($objFormParam); 
    7473        $objFormParam->setParam($_POST); 
    7574        $objFormParam->convParam(); 
     75        $objQuery =& SC_Query_Ex::getSingletonInstance(); 
     76        $objDb = new SC_Helper_DB_Ex(); 
    7677 
    7778        switch ($this->getMode()) { 
     79            case 'down': //商品の並び替えをする。おすすめはデータベースの登録が昇順なので、Modeを逆にする。 
     80                $arrRet = $objQuery->select("best_id", "dtb_best_products", "rank = ?", array($_POST["rank"])); //おすすめidの取得 
     81                $best_id = $arrRet[0]["best_id"]; 
     82                $objDb->sfRankUp('dtb_best_products','best_id',$best_id); 
     83                $arrPost = $objFormParam->getHashArray(); 
     84                $arrItems = $this->getRecommendProducts(); 
     85                break; 
     86             
     87            case 'up': //商品の並び替えをする。おすすめのみデータベースの登録が昇順なので、Modeを逆にする。 
     88                $arrRet = $objQuery->select("best_id", "dtb_best_products", "rank = ?", array($_POST["rank"])); //おすすめidの取得 
     89                $best_id = $arrRet[0]["best_id"]; 
     90                $objDb->sfRankDown('dtb_best_products','best_id',$best_id); 
     91                $arrPost = $objFormParam->getHashArray(); 
     92                $arrItems = $this->getRecommendProducts(); 
     93                break; 
     94 
    7895            case 'regist': // 商品を登録する。 
    7996                $this->arrErr = $this->lfCheckError($objFormParam); 
Note: See TracChangeset for help on using the changeset viewer.