Changeset 22833


Ignore:
Timestamp:
2013/05/21 12:01:24 (11 years ago)
Author:
kimoto
Message:

#2043 (typo修正・ソース整形・ソースコメントの改善 for 2.13.0)
商品表示条件が点在しているので1箇所にまとめてプラグインを作りやすいよう
にする

Location:
branches/version-2_13-dev/data/class
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_13-dev/data/class/SC_Product.php

    r22736 r22833  
    773773        return $sql; 
    774774    } 
     775 
     776    function getProductDispConditions($tablename = null) { 
     777        $tablename = ($tablename) ? $tablename . '.' : null; 
     778        return $tablename . 'del_flg = 0 AND ' . $tablename . 'status = 1 '; 
     779    } 
     780 
    775781} 
  • branches/version-2_13-dev/data/class/helper/SC_Helper_DB.php

    r22735 r22833  
    2929 * @version $Id:SC_Helper_DB.php 15532 2007-08-31 14:39:46Z nanasess $ 
    3030 */ 
    31 class SC_Helper_DB  
     31class SC_Helper_DB 
    3232{ 
    3333 
     
    9191        return false; 
    9292    } 
    93      
     93 
    9494    function sfColumnAdd($tableName, $colName, $colType) { 
    9595        $objQuery =& SC_Query_Ex::getSingletonInstance($dsn); 
     
    185185     * 基本情報のキャッシュデータファイルを生成する 
    186186     * データはsfGetBasisDataより取得。 
    187      *  
     187     * 
    188188     * このメソッドが直接呼ばれるのは、 
    189189     *「基本情報管理>SHOPマスター」の更新完了後。 
     
    726726 
    727727        //共通のfrom/where文の構築 
    728         $sql_where = 'alldtl.del_flg = 0 AND alldtl.status = 1'; 
     728        $sql_where = SC_Product_Ex::getProductDispConditions('alldtl'); 
    729729        // 在庫無し商品の非表示 
    730730        if (NOSTOCK_HIDDEN) { 
     
    11611161 
    11621162        $max = $objQuery->max('rank', $tableName, $where); 
    1163          
     1163 
    11641164        // 更新するランク値を取得 
    11651165        $newRank = $this->getNewRank($pos, $max); 
    1166         // 他のItemのランクを調整する  
     1166        // 他のItemのランクを調整する 
    11671167        $ret = $this->moveOtherItemRank($newRank, $oldRank, $objQuery, $tableName, $where); 
    11681168        if (!$ret) { 
     
    11841184        $objQuery->commit(); 
    11851185    } 
    1186      
     1186 
    11871187    /** 
    11881188     * 指定された位置の値をDB用のRANK値に変換する 
    11891189     * 指定位置が1番目に移動なら、newRankは最大値 
    11901190     * 指定位置が1番下へ移動なら、newRankは1 
    1191      *  
     1191     * 
    11921192     * @param int $position 指定された位置 
    11931193     * @param int $maxRank 現在のランク最大値 
    11941194     * @return int $newRank DBに登録するRANK値 
    1195      */  
     1195     */ 
    11961196    function getNewRank($position, $maxRank) { 
    1197          
     1197 
    11981198        if ($position > $maxRank) { 
    11991199            $newRank = 1; 
     
    12081208    /** 
    12091209     * 指定した順位の商品から移動させる商品までのrankを1つずらす 
    1210      *  
     1210     * 
    12111211     * @param int $newRank 
    12121212     * @param int $oldRank 
    12131213     * @param object $objQuery 
    12141214     * @param string $where 
    1215      * @return boolean  
     1215     * @return boolean 
    12161216     */ 
    12171217    function moveOtherItemRank($newRank, $oldRank, &$objQuery, $tableName, $addWhere) { 
    1218          
     1218 
    12191219        $sqlval = array(); 
    12201220        $arrRawSql = array(); 
     
    12351235            return false; 
    12361236        } 
    1237          
     1237 
    12381238        return $objQuery->update($tableName, $sqlval, $where, $arrWhereVal, $arrRawSql); 
    1239          
    1240     } 
    1241      
     1239 
     1240    } 
     1241 
    12421242 
    12431243    /** 
     
    13241324    /** 
    13251325     * カテゴリ変更時の移動処理を行う. 
    1326      *  
     1326     * 
    13271327     * ※この関数って、どこからも呼ばれていないのでは?? 
    13281328     * 
     
    16221622    /** 
    16231623     * レコード件数を計算. 
    1624      *  
     1624     * 
    16251625     * @param string $table 
    16261626     * @param string $where 
  • branches/version-2_13-dev/data/class/pages/LC_Page_Sitemap.php

    r22567 r22833  
    5151 * :TODO: filemtime 関数を使えば、静的なページの更新時間も取得できそう 
    5252 */ 
    53 class LC_Page_Sitemap extends LC_Page_Ex  
     53class LC_Page_Sitemap extends LC_Page_Ex 
    5454{ 
    5555 
     
    240240    { 
    241241        $objQuery = SC_Query_Ex::getSingletonInstance(); 
    242         $sql = 'SELECT product_id, update_date FROM dtb_products WHERE del_flg = 0 AND status = 1'; 
     242        $sql = 'SELECT product_id, update_date FROM dtb_products WHERE ' . SC_Product_Ex::getProductDispConditions(); 
    243243        $result = $objQuery->getAll($sql); 
    244244 
  • branches/version-2_13-dev/data/class/pages/products/LC_Page_Products_List.php

    r22735 r22833  
    3232 * @version $Id$ 
    3333 */ 
    34 class LC_Page_Products_List extends LC_Page_Ex  
     34class LC_Page_Products_List extends LC_Page_Ex 
    3535{ 
    3636 
     
    362362        // ▼対象商品IDの抽出 
    363363        // 商品検索条件の作成(未削除、表示) 
    364         $searchCondition['where'] = 'alldtl.del_flg = 0 AND alldtl.status = 1 '; 
     364        $searchCondition['where'] = SC_Product_Ex::getProductDispConditions('alldtl'); 
    365365 
    366366        if (strlen($searchCondition['where_category']) >= 1) { 
     
    483483    /** 
    484484     * 
    485      * @param type $objProduct  
     485     * @param type $objProduct 
    486486     * @return void 
    487487     */ 
  • branches/version-2_13-dev/data/class/pages/products/LC_Page_Products_Review.php

    r22567 r22833  
    3232 * @version $Id:LC_Page_Products_Review.php 15532 2007-08-31 14:39:46Z nanasess $ 
    3333 */ 
    34 class LC_Page_Products_Review extends LC_Page_Ex  
     34class LC_Page_Products_Review extends LC_Page_Ex 
    3535{ 
    3636 
     
    203203        $objQuery =& SC_Query_Ex::getSingletonInstance(); 
    204204 
    205         return $objQuery->get('name', 'dtb_products', 'product_id = ? AND del_flg = 0 AND status = 1', array($product_id)); 
     205        return $objQuery->get('name', 'dtb_products', 'product_id = ? AND ' . SC_Product_Ex::getProductDispConditions(), array($product_id)); 
    206206    } 
    207207 
  • branches/version-2_13-dev/data/class/pages/rss/LC_Page_Rss_Products.php

    r22567 r22833  
    3232 * @version $Id$ 
    3333 */ 
    34 class LC_Page_Rss_Products extends LC_Page_Ex  
     34class LC_Page_Rss_Products extends LC_Page_Ex 
    3535{ 
    3636 
     
    296296    { 
    297297        // --- 商品一覧の取得 
    298         $objQuery->setWhere('del_flg = 0 AND status = 1'); 
     298        $objProduct = new SC_Product_Ex(); 
     299        $objQuery->setWhere($objProduct->getProductDispConditions()); 
    299300        $objQuery->setOrder('product_id'); 
    300         $objProduct = new SC_Product_Ex(); 
    301301        $arrProductLsit = $objProduct->lists($objQuery); 
    302302        // 各商品のカテゴリIDとランクの取得 
Note: See TracChangeset for help on using the changeset viewer.