Changeset 16970


Ignore:
Timestamp:
2008/01/10 13:35:00 (16 years ago)
Author:
satou
Message:

#198,#199 複数カテゴリ対応による[商品並び替え]のバグを改修

Location:
branches/feature-module-update
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/feature-module-update/data/class/helper/SC_Helper_DB.php

    r16741 r16970  
    761761                                    array($category_id)); 
    762762 
    763         $max = 0; 
     763        $max = "0"; 
    764764        foreach ($arrCat as $val) { 
    765765            // 同一商品が存在する場合は登録しない 
     
    768768            } 
    769769            // 最上位ランクを取得 
    770             $max = ($max > $val["rank"]) ? $val["rank"] : $max; 
    771         } 
    772         $sqlval["rank"] = $max; 
     770            $max = ($max < $val["rank"]) ? $val["rank"] : $max; 
     771        } 
     772        $sqlval["rank"] = $max + 1; 
    773773        $objQuery->insert("dtb_product_categories", $sqlval); 
    774774    } 
     
    10961096            // ランク入れ替えの実行 
    10971097            $sqlup = "UPDATE $table SET rank = ? WHERE $colname = ?"; 
     1098            if($andwhere != "") { 
     1099                $sqlup.= " AND $andwhere"; 
     1100            } 
    10981101            $objQuery->exec($sqlup, array($rank + 1, $id)); 
    10991102            $objQuery->exec($sqlup, array($rank, $up_id)); 
     
    11321135            // ランク入れ替えの実行 
    11331136            $sqlup = "UPDATE $table SET rank = ? WHERE $colname = ?"; 
     1137            if($andwhere != "") { 
     1138                $sqlup.= " AND $andwhere"; 
     1139            } 
    11341140            $objQuery->exec($sqlup, array($rank - 1, $id)); 
    11351141            $objQuery->exec($sqlup, array($rank, $down_id)); 
  • branches/feature-module-update/html/install/sql/insert_data.sql

    r16952 r16970  
    358358 
    359359INSERT INTO dtb_product_categories (product_id,category_id,rank) VALUES (1,5,1); 
    360 INSERT INTO dtb_product_categories (product_id,category_id,rank) VALUES (2,4,2); 
     360INSERT INTO dtb_product_categories (product_id,category_id,rank) VALUES (2,4,1); 
    361361 
    362362INSERT INTO dtb_category_count VALUES (4, 1, now()); 
Note: See TracChangeset for help on using the changeset viewer.