Index: branches/version-2_13-dev/data/class_extends/helper_extends/SC_Helper_BestProducts_Ex.php
===================================================================
--- branches/version-2_13-dev/data/class_extends/helper_extends/SC_Helper_BestProducts_Ex.php	(revision 22735)
+++ branches/version-2_13-dev/data/class_extends/helper_extends/SC_Helper_BestProducts_Ex.php	(revision 22735)
@@ -0,0 +1,39 @@
+<?php
+/*
+ * This file is part of EC-CUBE
+ *
+ * Copyright(c) 2000-2013 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ */
+
+// {{{ requires
+require_once CLASS_REALDIR . 'helper/SC_Helper_BestProducts.php';
+
+/**
+ * おすすめ商品を管理するヘルパークラス(拡張).
+ *
+ * LC_Helper_Recommend をカスタマイズする場合はこのクラスを編集する.
+ *
+ * @package Helper
+ * @author pineray
+ * @version $Id:$
+ */
+class SC_Helper_BestProducts_Ex extends SC_Helper_BestProducts
+{
+    //put your code here
+}
Index: branches/version-2_13-dev/data/class_extends/helper_extends/SC_Helper_Recommend_Ex.php
===================================================================
--- branches/version-2_13-dev/data/class_extends/helper_extends/SC_Helper_Recommend_Ex.php	(revision 22582)
+++ 	(revision )
@@ -1,39 +1,0 @@
-<?php
-/*
- * This file is part of EC-CUBE
- *
- * Copyright(c) 2000-2013 LOCKON CO.,LTD. All Rights Reserved.
- *
- * http://www.lockon.co.jp/
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
- */
-
-// {{{ requires
-require_once CLASS_REALDIR . 'helper/SC_Helper_Recommend.php';
-
-/**
- * おすすめ商品を管理するヘルパークラス(拡張).
- *
- * LC_Helper_Recommend をカスタマイズする場合はこのクラスを編集する.
- *
- * @package Helper
- * @author pineray
- * @version $Id:$
- */
-class SC_Helper_Recommend_Ex extends SC_Helper_Recommend
-{
-    //put your code here
-}
Index: branches/version-2_13-dev/data/class/SC_Date.php
===================================================================
--- branches/version-2_13-dev/data/class/SC_Date.php	(revision 22576)
+++ branches/version-2_13-dev/data/class/SC_Date.php	(revision 22735)
@@ -199,6 +199,6 @@
     public function isHoliday($year, $month, $day)
     {
-        is_null(SC_Date_Ex::$arrHoliday) and $this->setArrHoliday();
-        is_null(SC_Date_Ex::$arrRegularHoliday) and $this->setRegularHoliday();
+        if (is_null(SC_Date_Ex::$arrHoliday)) $this->setArrHoliday();
+        if (is_null(SC_Date_Ex::$arrRegularHoliday)) $this->setRegularHoliday();
 
         if (!empty(SC_Date_Ex::$arrHoliday[$month])) {
Index: branches/version-2_13-dev/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_Recommend.php
===================================================================
--- branches/version-2_13-dev/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_Recommend.php	(revision 22582)
+++ branches/version-2_13-dev/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_Recommend.php	(revision 22735)
@@ -94,5 +94,5 @@
     function lfGetRanking()
     {
-        $objRecommend = new SC_Helper_Recommend_Ex();
+        $objRecommend = new SC_Helper_BestProducts_Ex();
 
         // おすすめ商品取得
Index: branches/version-2_13-dev/data/class/pages/products/LC_Page_Products_List.php
===================================================================
--- branches/version-2_13-dev/data/class/pages/products/LC_Page_Products_List.php	(revision 22730)
+++ branches/version-2_13-dev/data/class/pages/products/LC_Page_Products_List.php	(revision 22735)
@@ -317,5 +317,5 @@
         if (strlen($arrSearchData['maker_id']) > 0) {
             $objMaker = new SC_Helper_Maker_Ex();
-            $maker = $objMaker->get($arrSearchData['maker_id']);
+            $maker = $objMaker->getMaker($arrSearchData['maker_id']);
             $arrSearch['maker']     = $maker['name'];
         }
Index: branches/version-2_13-dev/data/class/pages/admin/contents/LC_Page_Admin_Contents.php
===================================================================
--- branches/version-2_13-dev/data/class/pages/admin/contents/LC_Page_Admin_Contents.php	(revision 22581)
+++ branches/version-2_13-dev/data/class/pages/admin/contents/LC_Page_Admin_Contents.php	(revision 22735)
@@ -116,5 +116,5 @@
 
             case 'pre_edit':
-                $news = $objNews->get($news_id);
+                $news = $objNews->getNews($news_id);
                 list($news['year'],$news['month'],$news['day']) = $this->splitNewsDate($news['cast_news_date']);
                 $objFormParam->setParam($news);
@@ -126,5 +126,5 @@
             case 'delete':
             //----　データ削除
-                $objNews->delete($news_id);
+                $objNews->deleteNews($news_id);
                 //自分にリダイレクト（再読込による誤動作防止）
                 SC_Response_Ex::reload();
@@ -219,5 +219,5 @@
         $sqlval['news_date'] = $this->getRegistDate($sqlval);
         unset($sqlval['year'], $sqlval['month'], $sqlval['day']);
-        return $objNews->save($sqlval);
+        return $objNews->saveNews($sqlval);
     }
 
Index: branches/version-2_13-dev/data/class/pages/admin/contents/LC_Page_Admin_Contents_Recommend.php
===================================================================
--- branches/version-2_13-dev/data/class/pages/admin/contents/LC_Page_Admin_Contents_Recommend.php	(revision 22582)
+++ branches/version-2_13-dev/data/class/pages/admin/contents/LC_Page_Admin_Contents_Recommend.php	(revision 22735)
@@ -79,5 +79,5 @@
         $arrPost = $objFormParam->getHashArray();
 
-        $objRecommend = new SC_Helper_Recommend_Ex();
+        $objRecommend = new SC_Helper_BestProducts_Ex();
 
         switch ($this->getMode()) {
@@ -175,5 +175,5 @@
      * @return Array $arrReturnProducts データベースに登録されているおすすめ商品の配列
      */
-    function getRecommendProducts(SC_Helper_Recommend_Ex &$objRecommend)
+    function getRecommendProducts(SC_Helper_BestProducts_Ex &$objRecommend)
     {
         $arrList = $objRecommend->getList();
@@ -203,5 +203,5 @@
      * @param Object $objRecommend
      */
-    function insertRecommendProduct($arrPost,$member_id, SC_Helper_Recommend_Ex &$objRecommend)
+    function insertRecommendProduct($arrPost,$member_id, SC_Helper_BestProducts_Ex &$objRecommend)
     {
         // 古いおすすめ商品のデータを削除する。
@@ -214,5 +214,5 @@
         $sqlval['comment'] = $arrPost['comment'];
         $sqlval['creator_id'] = $member_id;
-        $objRecommend->save($sqlval);
+        $objRecommend->saveBestProducts($sqlval);
     }
 
@@ -223,5 +223,5 @@
      * @return void
      */
-    function deleteProduct($arrPost, SC_Helper_Recommend_Ex &$objRecommend)
+    function deleteProduct($arrPost, SC_Helper_BestProducts_Ex &$objRecommend)
     {
         if ($arrPost['best_id']) {
@@ -231,5 +231,5 @@
             $target = $recommend['best_id'];
         }
-        $objRecommend->delete($target);
+        $objRecommend->deleteBestProducts($target);
     }
 
Index: branches/version-2_13-dev/data/class/pages/admin/basis/LC_Page_Admin_Basis_Kiyaku.php
===================================================================
--- branches/version-2_13-dev/data/class/pages/admin/basis/LC_Page_Admin_Basis_Kiyaku.php	(revision 22570)
+++ branches/version-2_13-dev/data/class/pages/admin/basis/LC_Page_Admin_Basis_Kiyaku.php	(revision 22735)
@@ -110,5 +110,5 @@
             // 削除
             case 'delete':
-                $objKiyaku->delete($kiyaku_id);
+                $objKiyaku->deleteKiyaku($kiyaku_id);
                 break;
 
@@ -116,5 +116,5 @@
             case 'pre_edit':
                 // 編集項目を取得する。
-                $arrKiyakuData = $objKiyaku->get($kiyaku_id);
+                $arrKiyakuData = $objKiyaku->getKiyaku($kiyaku_id);
                 $objFormParam->setParam($arrKiyakuData);
 
@@ -169,5 +169,5 @@
         $sqlval['kiyaku_id'] = $kiyaku_id;
         $sqlval['creator_id'] = $_SESSION['member_id'];
-        return $objKiyaku->save($sqlval);
+        return $objKiyaku->saveKiyaku($sqlval);
     }
 
Index: branches/version-2_13-dev/data/class/pages/admin/products/LC_Page_Admin_Products_Maker.php
===================================================================
--- branches/version-2_13-dev/data/class/pages/admin/products/LC_Page_Admin_Products_Maker.php	(revision 22578)
+++ branches/version-2_13-dev/data/class/pages/admin/products/LC_Page_Admin_Products_Maker.php	(revision 22735)
@@ -116,5 +116,5 @@
             // 編集前処理
             case 'pre_edit':
-                $maker = $objMaker->get($maker_id);
+                $maker = $objMaker->getMaker($maker_id);
                 $objFormParam->setParam($maker);
 
@@ -190,5 +190,5 @@
         $sqlval['maker_id'] = $maker_id;
         $sqlval['creator_id'] = $_SESSION['member_id'];
-        return $objMaker->save($sqlval);
+        return $objMaker->saveMaker($sqlval);
     }
 
@@ -208,5 +208,5 @@
             if (!SC_Utils_Ex::sfIsInt($arrForm['maker_id'])
                 || SC_Utils_Ex::sfIsZeroFilling($arrForm['maker_id'])
-                || !$objMaker->get($arrForm['maker_id'])
+                || !$objMaker->getMaker($arrForm['maker_id'])
             ) {
                 // maker_idが指定されていて、且つその値が不正と思われる場合はエラー
Index: branches/version-2_13-dev/data/class/pages/admin/products/LC_Page_Admin_Products.php
===================================================================
--- branches/version-2_13-dev/data/class/pages/admin/products/LC_Page_Admin_Products.php	(revision 22582)
+++ branches/version-2_13-dev/data/class/pages/admin/products/LC_Page_Admin_Products.php	(revision 22735)
@@ -277,5 +277,5 @@
         $objQuery->delete('dtb_customer_favorite_products', "product_id IN (SELECT product_id FROM dtb_products WHERE $where)", $arrParam);
 
-        $objRecomment = new SC_Helper_Recommend_Ex();
+        $objRecomment = new SC_Helper_BestProducts_Ex();
         $objRecomment->deleteByProductIDs($product_ids);
 
Index: branches/version-2_13-dev/data/class/helper/SC_Helper_News.php
===================================================================
--- branches/version-2_13-dev/data/class/helper/SC_Helper_News.php	(revision 22581)
+++ branches/version-2_13-dev/data/class/helper/SC_Helper_News.php	(revision 22735)
@@ -38,5 +38,5 @@
      * @return array
      */
-    public function get($news_id, $has_deleted = false)
+    public function getNews($news_id, $has_deleted = false)
     {
         $objQuery =& SC_Query_Ex::getSingletonInstance();
@@ -85,5 +85,5 @@
      * @return multiple 登録成功:ニュースID, 失敗:FALSE
      */
-    public function save($sqlval)
+    public function saveNews($sqlval)
     {
         $objQuery =& SC_Query_Ex::getSingletonInstance();
@@ -114,5 +114,5 @@
      * @return void
      */
-    public function delete($news_id)
+    public function deleteNews($news_id)
     {
         $objDb = new SC_Helper_DB_Ex();
Index: branches/version-2_13-dev/data/class/helper/SC_Helper_Bloc.php
===================================================================
--- branches/version-2_13-dev/data/class/helper/SC_Helper_Bloc.php	(revision 22610)
+++ branches/version-2_13-dev/data/class/helper/SC_Helper_Bloc.php	(revision 22735)
@@ -44,5 +44,5 @@
      * @return array
      */
-    public function get($bloc_id)
+    public function getBloc($bloc_id)
     {
         $objQuery =& SC_Query_Ex::getSingletonInstance();
@@ -109,5 +109,5 @@
         // 既存データの重複チェック
         if (!$is_new) {
-            $arrExists = $this->get($sqlval['bloc_id']);
+            $arrExists = $this->getBloc($sqlval['bloc_id']);
 
             // 既存のファイルが存在する場合は削除しておく
Index: branches/version-2_13-dev/data/class/helper/SC_Helper_BestProducts.php
===================================================================
--- branches/version-2_13-dev/data/class/helper/SC_Helper_BestProducts.php	(revision 22735)
+++ branches/version-2_13-dev/data/class/helper/SC_Helper_BestProducts.php	(revision 22735)
@@ -0,0 +1,186 @@
+<?php
+/*
+ * This file is part of EC-CUBE
+ *
+ * Copyright(c) 2000-2013 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ */
+
+/**
+ * おすすめ商品を管理するヘルパークラス.
+ *
+ * @package Helper
+ * @author pineray
+ * @version $Id:$
+ */
+class SC_Helper_BestProducts
+{
+    /**
+     * おすすめ商品の情報を取得.
+     * 
+     * @param integer $best_id おすすめ商品ID
+     * @param boolean $has_deleted 削除されたおすすめ商品も含む場合 true; 初期値 false
+     * @return array
+     */
+    public function getBestProducts($best_id, $has_deleted = false)
+    {
+        $objQuery =& SC_Query_Ex::getSingletonInstance();
+        $col = '*';
+        $where = 'best_id = ?';
+        if (!$has_deleted) {
+            $where .= ' AND del_flg = 0';
+        }
+        $arrRet = $objQuery->select($col, 'dtb_best_products', $where, array($best_id));
+        return $arrRet[0];
+    }
+
+    /**
+     * おすすめ商品の情報をランクから取得.
+     * 
+     * @param integer $rank ランク
+     * @param boolean $has_deleted 削除されたおすすめ商品も含む場合 true; 初期値 false
+     * @return array
+     */
+    public function getByRank($rank, $has_deleted = false)
+    {
+        $objQuery =& SC_Query_Ex::getSingletonInstance();
+        $col = '*';
+        $where = 'rank = ?';
+        if (!$has_deleted) {
+            $where .= ' AND del_flg = 0';
+        }
+        $arrRet = $objQuery->select($col, 'dtb_best_products', $where, array($rank));
+        return $arrRet[0];
+    }
+
+    /**
+     * おすすめ商品一覧の取得.
+     *
+     * @param integer $dispNumber 表示件数
+     * @param integer $pageNumber ページ番号
+     * @param boolean $has_deleted 削除されたおすすめ商品も含む場合 true; 初期値 false
+     * @return array
+     */
+    public function getList($dispNumber = 0, $pageNumber = 0, $has_deleted = false)
+    {
+        $objQuery =& SC_Query_Ex::getSingletonInstance();
+        $col = '*';
+        $where = '';
+        if (!$has_deleted) {
+            $where .= 'del_flg = 0';
+        }
+        $table = 'dtb_best_products';
+        $objQuery->setOrder('rank');
+        if ($dispNumber > 0) {
+            if ($pageNumber > 0) {
+                $objQuery->setLimitOffset($dispNumber, (($pageNumber - 1) * $dispNumber));
+            } else {
+                $objQuery->setLimit($dispNumber);
+            }
+        }
+        $arrRet = $objQuery->select($col, $table, $where);
+        return $arrRet;
+    }
+
+    /**
+     * おすすめ商品の登録.
+     * 
+     * @param array $sqlval
+     * @return multiple 登録成功:おすすめ商品ID, 失敗:FALSE
+     */
+    public function saveBestProducts($sqlval)
+    {
+        $objQuery =& SC_Query_Ex::getSingletonInstance();
+
+        $best_id = $sqlval['best_id'];
+        $sqlval['update_date'] = 'CURRENT_TIMESTAMP';
+        // 新規登録
+        if ($best_id == '') {
+            // INSERTの実行
+            if (!$sqlval['rank']) {
+                $sqlval['rank'] = $objQuery->max('rank', 'dtb_best_products') + 1;
+            }
+            $sqlval['create_date'] = 'CURRENT_TIMESTAMP';
+            $sqlval['best_id'] = $objQuery->nextVal('dtb_best_products_best_id');
+            $ret = $objQuery->insert('dtb_best_products', $sqlval);
+        // 既存編集
+        } else {
+            unset($sqlval['creator_id']);
+            unset($sqlval['create_date']);
+            $where = 'best_id = ?';
+            $ret = $objQuery->update('dtb_best_products', $sqlval, $where, array($best_id));
+        }
+        return ($ret) ? $sqlval['best_id'] : FALSE;
+    }
+
+    /**
+     * おすすめ商品の削除.
+     * 
+     * @param integer $best_id おすすめ商品ID
+     * @return void
+     */
+    public function deleteBestProducts($best_id)
+    {
+        $objDb = new SC_Helper_DB_Ex();
+        // ランク付きレコードの削除
+        $objDb->sfDeleteRankRecord('dtb_best_products', 'best_id', $best_id,'', TRUE);
+    }
+
+    /**
+     * 商品IDの配列からおすすめ商品を削除.
+     * 
+     * @param array $productIDs 商品ID
+     * @return void
+     */
+    public function deleteByProductIDs($productIDs)
+    {
+        $objDb = new SC_Helper_DB_Ex();
+        $arrList = $this->getList();
+        foreach ($arrList as $recommend) {
+            if (in_array($recommend['product_id'], $productIDs)) {
+                $objDb->sfDeleteRankRecord('dtb_best_products', 'best_id', $recommend['best_id'],'', TRUE);
+            }
+        }
+    }
+
+    /**
+     * おすすめ商品の表示順をひとつ上げる.
+     * 
+     * @param integer $best_id おすすめ商品ID
+     * @return void
+     */
+    public function rankUp($best_id)
+    {
+        $objDb = new SC_Helper_DB_Ex();
+        //おすすめはデータベースの登録が昇順なので、Modeを逆にする。
+        $objDb->sfRankDown('dtb_best_products', 'best_id', $best_id);
+    }
+
+    /**
+     * おすすめ商品の表示順をひとつ下げる.
+     * 
+     * @param integer $best_id おすすめ商品ID
+     * @return void
+     */
+    public function rankDown($best_id)
+    {
+        $objDb = new SC_Helper_DB_Ex();
+        //おすすめはデータベースの登録が昇順なので、Modeを逆にする。
+        $objDb->sfRankUp('dtb_best_products', 'best_id', $best_id);
+    }
+}
Index: branches/version-2_13-dev/data/class/helper/SC_Helper_DB.php
===================================================================
--- branches/version-2_13-dev/data/class/helper/SC_Helper_DB.php	(revision 22595)
+++ branches/version-2_13-dev/data/class/helper/SC_Helper_DB.php	(revision 22735)
@@ -56,5 +56,5 @@
      * カラムの生成も行う場合は, $col_type も必須となる.
      *
-     * @param string $table_name テーブル名
+     * @param string $$tableName テーブル名
      * @param string $column_name カラム名
      * @param string $col_type カラムのデータ型
@@ -65,5 +65,5 @@
      *               引数 $add == false でカラムが存在しない場合 false
      */
-    function sfColumnExists($table_name, $col_name, $col_type = '', $dsn = '', $add = false)
+    function sfColumnExists($tableName, $colName, $colType = '', $dsn = '', $add = false)
     {
         $dbFactory = SC_DB_DBFactory_Ex::getInstance();
@@ -73,12 +73,12 @@
 
         // テーブルが無ければエラー
-        if (!in_array($table_name, $objQuery->listTables())) return false;
+        if (!in_array($tableName, $objQuery->listTables())) return false;
 
         // 正常に接続されている場合
         if (!$objQuery->isError()) {
             // カラムリストを取得
-            $columns = $objQuery->listTableFields($table_name);
-
-            if (in_array($col_name, $columns)) {
+            $columns = $objQuery->listTableFields($tableName);
+
+            if (in_array($colName, $columns)) {
                 return true;
             }
@@ -87,22 +87,24 @@
         // カラムを追加する
         if ($add) {
-            $objQuery->query("ALTER TABLE $table_name ADD $col_name $col_type ");
-            return true;
+            return $this->sfColumnAdd($tableName, $colName, $colType);
         }
         return false;
     }
+    
+    function sfColumnAdd($tableName, $colName, $colType) {
+        $objQuery =& SC_Query_Ex::getSingletonInstance($dsn);
+        return $objQuery->query("ALTER TABLE $tableName ADD $colName $colType ");
+    }
 
     /**
      * データの存在チェックを行う.
      *
-     * @param string $table_name テーブル名
+     * @param string $tableName テーブル名
      * @param string $where データを検索する WHERE 句
-     * @param string $dsn データソース名
-     * @param string $sql @deprecated データの追加を行う場合の SQL文
-     * @param bool $add @deprecated データの追加も行う場合 true
+     * @param array $arrWhereVal WHERE句のプレースホルダ値
      * @return bool データが存在する場合 true, データの追加に成功した場合 true,
      *               $add == false で, データが存在しない場合 false
      */
-    function sfDataExists($table_name, $where, $arrWhereVal, $dsn = '', $sql = '', $add = false)
+    function sfDataExists($tableName, $where, $arrWhereVal)
     {
         $dbFactory = SC_DB_DBFactory_Ex::getInstance();
@@ -110,13 +112,9 @@
 
         $objQuery =& SC_Query_Ex::getSingletonInstance();
-        $exists = $objQuery->exists($table_name, $where, $arrWhereVal);
+        $exists = $objQuery->exists($tableName, $where, $arrWhereVal);
 
         // データが存在する場合 TRUE
         if ($exists) {
             return TRUE;
-        // $add が TRUE の場合はデータを追加する
-        } elseif ($add) {
-            return $objQuery->exec($sql);
-        // $add が FALSE で、データが存在しない場合 FALSE
         } else {
             return FALSE;
@@ -1160,48 +1158,20 @@
             $getWhere = "$keyIdColumn = ?";
         }
-        $rank = $objQuery->get('rank', $tableName, $getWhere, array($keyId));
+        $oldRank = $objQuery->get('rank', $tableName, $getWhere, array($keyId));
 
         $max = $objQuery->max('rank', $tableName, $where);
-
-        // 値の調整（逆順）
-        if ($pos > $max) {
-            $position = 1;
-        } else if ($pos < 1) {
-            $position = $max;
-        } else {
-            $position = $max - $pos + 1;
-        }
-
-        //入れ替え先の順位が入れ換え元の順位より大きい場合
-        if ($position > $rank) $term = 'rank - 1';
-
-        //入れ替え先の順位が入れ換え元の順位より小さい場合
-        if ($position < $rank) $term = 'rank + 1';
-
-        // XXX 入れ替え先の順位が入れ替え元の順位と同じ場合
-        if (!isset($term)) $term = 'rank';
-
-        // 指定した順位の商品から移動させる商品までのrankを１つずらす
-        $sqlval = array();
-        $arrRawSql = array(
-            'rank' => $term,
-        );
-        $str_where = 'rank BETWEEN ? AND ?';
-        if ($where != '') {
-            $str_where .= " AND $where";
-        }
-
-        if ($position > $rank) {
-            $arrWhereVal = array($rank + 1, $position);
-            $objQuery->update($tableName, $sqlval, $str_where, $arrWhereVal, $arrRawSql);
-        }
-        if ($position < $rank) {
-            $arrWhereVal = array($position, $rank - 1);
-            $objQuery->update($tableName, $sqlval, $str_where, $arrWhereVal, $arrRawSql);
+        
+        // 更新するランク値を取得
+        $newRank = $this->getNewRank($pos, $max);
+        // 他のItemのランクを調整する 
+        $ret = $this->moveOtherItemRank($newRank, $oldRank, $objQuery, $tableName, $where);
+        if (!$ret) {
+            // 他のランク変更がなければ処理を行わない
+            return;
         }
 
         // 指定した順位へrankを書き換える。
         $sqlval = array(
-            'rank' => $position,
+            'rank' => $newRank,
         );
         $str_where = "$keyIdColumn = ?";
@@ -1214,4 +1184,60 @@
         $objQuery->commit();
     }
+    
+    /**
+     * 指定された位置の値をDB用のRANK値に変換する
+     * 指定位置が1番目に移動なら、newRankは最大値
+     * 指定位置が1番下へ移動なら、newRankは1
+     * 
+     * @param int $position 指定された位置
+     * @param int $maxRank 現在のランク最大値
+     * @return int $newRank DBに登録するRANK値
+     */ 
+    function getNewRank($position, $maxRank) {
+        
+        if ($position > $maxRank) {
+            $newRank = 1;
+        } else if ($position < 1) {
+            $newRank = $maxRank;
+        } else {
+            $newRank = $maxRank - $position + 1;
+        }
+        return $newRank;
+    }
+
+    /**
+     * 指定した順位の商品から移動させる商品までのrankを１つずらす
+     * 
+     * @param int $newRank
+     * @param int $oldRank
+     * @param object $objQuery
+     * @param string $where
+     * @return boolean 
+     */
+    function moveOtherItemRank($newRank, $oldRank, &$objQuery, $tableName, $addWhere) {
+        
+        $sqlval = array();
+        $arrRawSql = array();
+        $where = 'rank BETWEEN ? AND ?';
+        if ($addWhere != '') {
+            $where .= " AND $Where";
+        }
+        if ($newRank > $oldRank) {
+            //位置を上げる場合、他の商品の位置を1つ下げる（ランクを1下げる）
+            $arrRawSql['rank'] = 'rank - 1';
+            $arrWhereVal = array($oldRank + 1, $newRank);
+        } else if ($newRank < $oldRank) {
+            //位置を下げる場合、他の商品の位置を1つ上げる（ランクを1上げる）
+            $arrRawSql['rank'] = 'rank + 1';
+            $arrWhereVal = array($newRank, $oldRank - 1);
+        } else {
+            //入れ替え先の順位が入れ替え元の順位と同じ場合なにもしない
+            return false;
+        }
+        
+        return $objQuery->update($tableName, $sqlval, $where, $arrWhereVal, $arrRawSql);
+        
+    }
+    
 
     /**
Index: branches/version-2_13-dev/data/class/helper/SC_Helper_Kiyaku.php
===================================================================
--- branches/version-2_13-dev/data/class/helper/SC_Helper_Kiyaku.php	(revision 22570)
+++ branches/version-2_13-dev/data/class/helper/SC_Helper_Kiyaku.php	(revision 22735)
@@ -38,5 +38,5 @@
      * @return array
      */
-    public function get($kiyaku_id, $has_deleted = false)
+    public function getKiyaku($kiyaku_id, $has_deleted = false)
     {
         $objQuery =& SC_Query_Ex::getSingletonInstance();
@@ -75,5 +75,5 @@
      * @return multiple 登録成功:会員規約ID, 失敗:FALSE
      */
-    public function save($sqlval)
+    public function saveKiyaku($sqlval)
     {
         $objQuery =& SC_Query_Ex::getSingletonInstance();
@@ -104,5 +104,5 @@
      * @return void
      */
-    public function delete($kiyaku_id)
+    public function deleteKiyaku($kiyaku_id)
     {
         $objDb = new SC_Helper_DB_Ex();
Index: branches/version-2_13-dev/data/class/helper/SC_Helper_Maker.php
===================================================================
--- branches/version-2_13-dev/data/class/helper/SC_Helper_Maker.php	(revision 22578)
+++ branches/version-2_13-dev/data/class/helper/SC_Helper_Maker.php	(revision 22735)
@@ -38,5 +38,5 @@
      * @return array
      */
-    public function get($maker_id, $has_deleted = false)
+    public function getMaker($maker_id, $has_deleted = false)
     {
         $objQuery =& SC_Query_Ex::getSingletonInstance();
@@ -93,5 +93,5 @@
      * @return multiple 登録成功:メーカーID, 失敗:FALSE
      */
-    public function save($sqlval)
+    public function saveMaker($sqlval)
     {
         $objQuery =& SC_Query_Ex::getSingletonInstance();
Index: branches/version-2_13-dev/data/class/helper/SC_Helper_Recommend.php
===================================================================
--- branches/version-2_13-dev/data/class/helper/SC_Helper_Recommend.php	(revision 22582)
+++ 	(revision )
@@ -1,186 +1,0 @@
-<?php
-/*
- * This file is part of EC-CUBE
- *
- * Copyright(c) 2000-2013 LOCKON CO.,LTD. All Rights Reserved.
- *
- * http://www.lockon.co.jp/
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
- */
-
-/**
- * おすすめ商品を管理するヘルパークラス.
- *
- * @package Helper
- * @author pineray
- * @version $Id:$
- */
-class SC_Helper_Recommend
-{
-    /**
-     * おすすめ商品の情報を取得.
-     * 
-     * @param integer $best_id おすすめ商品ID
-     * @param boolean $has_deleted 削除されたおすすめ商品も含む場合 true; 初期値 false
-     * @return array
-     */
-    public function get($best_id, $has_deleted = false)
-    {
-        $objQuery =& SC_Query_Ex::getSingletonInstance();
-        $col = '*';
-        $where = 'best_id = ?';
-        if (!$has_deleted) {
-            $where .= ' AND del_flg = 0';
-        }
-        $arrRet = $objQuery->select($col, 'dtb_best_products', $where, array($best_id));
-        return $arrRet[0];
-    }
-
-    /**
-     * おすすめ商品の情報をランクから取得.
-     * 
-     * @param integer $rank ランク
-     * @param boolean $has_deleted 削除されたおすすめ商品も含む場合 true; 初期値 false
-     * @return array
-     */
-    public function getByRank($rank, $has_deleted = false)
-    {
-        $objQuery =& SC_Query_Ex::getSingletonInstance();
-        $col = '*';
-        $where = 'rank = ?';
-        if (!$has_deleted) {
-            $where .= ' AND del_flg = 0';
-        }
-        $arrRet = $objQuery->select($col, 'dtb_best_products', $where, array($rank));
-        return $arrRet[0];
-    }
-
-    /**
-     * おすすめ商品一覧の取得.
-     *
-     * @param integer $dispNumber 表示件数
-     * @param integer $pageNumber ページ番号
-     * @param boolean $has_deleted 削除されたおすすめ商品も含む場合 true; 初期値 false
-     * @return array
-     */
-    public function getList($dispNumber = 0, $pageNumber = 0, $has_deleted = false)
-    {
-        $objQuery =& SC_Query_Ex::getSingletonInstance();
-        $col = '*';
-        $where = '';
-        if (!$has_deleted) {
-            $where .= 'del_flg = 0';
-        }
-        $table = 'dtb_best_products';
-        $objQuery->setOrder('rank');
-        if ($dispNumber > 0) {
-            if ($pageNumber > 0) {
-                $objQuery->setLimitOffset($dispNumber, (($pageNumber - 1) * $dispNumber));
-            } else {
-                $objQuery->setLimit($dispNumber);
-            }
-        }
-        $arrRet = $objQuery->select($col, $table, $where);
-        return $arrRet;
-    }
-
-    /**
-     * おすすめ商品の登録.
-     * 
-     * @param array $sqlval
-     * @return multiple 登録成功:おすすめ商品ID, 失敗:FALSE
-     */
-    public function save($sqlval)
-    {
-        $objQuery =& SC_Query_Ex::getSingletonInstance();
-
-        $best_id = $sqlval['best_id'];
-        $sqlval['update_date'] = 'CURRENT_TIMESTAMP';
-        // 新規登録
-        if ($best_id == '') {
-            // INSERTの実行
-            if (!$sqlval['rank']) {
-                $sqlval['rank'] = $objQuery->max('rank', 'dtb_best_products') + 1;
-            }
-            $sqlval['create_date'] = 'CURRENT_TIMESTAMP';
-            $sqlval['best_id'] = $objQuery->nextVal('dtb_best_products_best_id');
-            $ret = $objQuery->insert('dtb_best_products', $sqlval);
-        // 既存編集
-        } else {
-            unset($sqlval['creator_id']);
-            unset($sqlval['create_date']);
-            $where = 'best_id = ?';
-            $ret = $objQuery->update('dtb_best_products', $sqlval, $where, array($best_id));
-        }
-        return ($ret) ? $sqlval['best_id'] : FALSE;
-    }
-
-    /**
-     * おすすめ商品の削除.
-     * 
-     * @param integer $best_id おすすめ商品ID
-     * @return void
-     */
-    public function delete($best_id)
-    {
-        $objDb = new SC_Helper_DB_Ex();
-        // ランク付きレコードの削除
-        $objDb->sfDeleteRankRecord('dtb_best_products', 'best_id', $best_id, TRUE);
-    }
-
-    /**
-     * 商品IDの配列からおすすめ商品を削除.
-     * 
-     * @param array $productIDs 商品ID
-     * @return void
-     */
-    public function deleteByProductIDs($productIDs)
-    {
-        $objDb = new SC_Helper_DB_Ex();
-        $arrList = $this->getList();
-        foreach ($arrList as $recommend) {
-            if (in_array($recommend['product_id'], $productIDs)) {
-                $objDb->sfDeleteRankRecord('dtb_best_products', 'best_id', $recommend['best_id'], TRUE);
-            }
-        }
-    }
-
-    /**
-     * おすすめ商品の表示順をひとつ上げる.
-     * 
-     * @param integer $best_id おすすめ商品ID
-     * @return void
-     */
-    public function rankUp($best_id)
-    {
-        $objDb = new SC_Helper_DB_Ex();
-        //おすすめはデータベースの登録が昇順なので、Modeを逆にする。
-        $objDb->sfRankDown('dtb_best_products', 'best_id', $best_id);
-    }
-
-    /**
-     * おすすめ商品の表示順をひとつ下げる.
-     * 
-     * @param integer $best_id おすすめ商品ID
-     * @return void
-     */
-    public function rankDown($best_id)
-    {
-        $objDb = new SC_Helper_DB_Ex();
-        //おすすめはデータベースの登録が昇順なので、Modeを逆にする。
-        $objDb->sfRankUp('dtb_best_products', 'best_id', $best_id);
-    }
-}
