Changeset 17601
- Timestamp:
- 2008/09/09 01:05:16 (16 years ago)
- Location:
- branches/comu-ver2
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/comu-ver2/data/Smarty/templates/default/admin/products/product_rank.tpl
r17596 r17601 76 76 <!--{$tpl_strnavi}--> 77 77 <!--{* ▲ページナビ *}--> 78 78 79 <!--{if $smarty.const.ADMIN_MODE == '1'}--> 80 <p class="right"><button type="button" onclick="fnModeSubmit('renumber', '', '');">内部順位再割り当て</button></p> 81 <!--{/if}--> 82 79 83 <table class="list"> 80 84 <tr> … … 88 92 <!--{section name=cnt loop=$arrProductsList}--> 89 93 <tr> 90 <!--{assign var=db_rank value="`$arrProductsList[cnt].rank`"}-->91 94 <!--{assign var=rank value=`$rank+1`}--> 92 <td align="center"><!--{$rank}--></td> 93 <td><!--{$arrProductsList[cnt].product_code|escape|default:"-"}--></td> 95 <td align="center"> 96 <!--{$rank}--> 97 <!--{if $arrProductsList[cnt].status == "2"}--><br />(非公開)<!--{/if}--> 98 </td> 99 <td><!--{from_to from=$arrProductsList[cnt].product_code_min to=$arrProductsList[cnt].product_code_max separator="~<br />"}--></td> 94 100 <td align="center"> 95 101 <!--{* 商品画像 *}--> -
branches/comu-ver2/data/class/pages/admin/products/LC_Page_Admin_Products_ProductRank.php
r17596 r17601 57 57 */ 58 58 function process() { 59 $ conn = new SC_DBConn();59 $objQuery = new SC_Query(); 60 60 $objView = new SC_AdminView(); 61 61 $objSess = new SC_Session(); … … 93 93 $this->tpl_pageno = ""; 94 94 break; 95 96 case 'renumber': 97 $sql = <<< __EOS__ 98 UPDATE dtb_product_categories tgt 99 SET 100 rank = 101 ( 102 SELECT COUNT(*) 103 FROM dtb_product_categories t_in 104 WHERE t_in.category_id = tgt.category_id 105 AND ( 106 t_in.rank < tgt.rank 107 OR ( 108 t_in.rank = tgt.rank 109 AND t_in.product_id < tgt.product_id 110 ) 111 ) 112 ) + 1 113 WHERE tgt.category_id = ? 114 __EOS__; 115 $objQuery->query($sql, array($_POST['parent_category_id'])); 116 break; 117 95 118 default: 96 119 break; … … 117 140 function lfGetProduct($category_id) { 118 141 $objQuery = new SC_Query(); 119 $col = "T2.product_id, name, main_list_image, T2.rank, product_code"; 120 $table = "vw_products_nonclass AS noncls " 121 . " LEFT JOIN dtb_product_categories AS T2 USING (product_id)"; 122 $where = "del_flg = 0 AND T2.category_id = ?"; 142 $col = "product_id, name, main_list_image, product_code_min, product_code_max, status"; 143 $table = "vw_products_allclass AS allcls"; 144 $where = "del_flg = 0 AND category_id = ?"; 123 145 124 146 // 行数の取得 … … 130 152 $startno = $objNavi->start_row; 131 153 $this->tpl_start_row = $objNavi->start_row; 132 $this->tpl_strnavi = $objNavi->strnavi; 133 $this->tpl_pagemax = $objNavi->max_page; 134 $this->tpl_disppage = $objNavi->now_page; 154 $this->tpl_strnavi = $objNavi->strnavi; // Navi表示文字列 155 $this->tpl_pagemax = $objNavi->max_page; // ページ最大数(「上へ下へ」表示判定用) 156 $this->tpl_disppage = $objNavi->now_page; // 表示ページ番号(「上へ下へ」表示判定用) 135 157 136 158 // 取得範囲の指定(開始行番号、行数のセット) 137 if(DB_TYPE != "mysql")$objQuery->setlimitoffset(SEARCH_PMAX, $startno);159 $objQuery->setlimitoffset(SEARCH_PMAX, $startno); 138 160 139 $objQuery->setorder(" rankDESC");161 $objQuery->setorder("product_rank DESC, product_id DESC"); 140 162 141 163 $arrRet = $objQuery->select($col, $table, $where, array($category_id)); -
branches/comu-ver2/html/install/sql/create_table_mysql.sql
r17522 r17601 386 386 product_id int4 NOT NULL, 387 387 category_id int4 NOT NULL, 388 rank int4 ,388 rank int4 NOT NULL, 389 389 PRIMARY KEY(product_id, category_id) 390 390 ) TYPE=InnoDB; -
branches/comu-ver2/html/install/sql/create_table_pgsql.sql
r17522 r17601 399 399 product_id int4 NOT NULL, 400 400 category_id int4 NOT NULL, 401 rank int4 ,401 rank int4 NOT NULL, 402 402 PRIMARY KEY(product_id, category_id) 403 403 );
Note: See TracChangeset
for help on using the changeset viewer.