Ignore:
Timestamp:
2014/05/29 13:59:35 (10 years ago)
Author:
pineray
Message:

#2515 無駄な処理を改善する for 2.13.3

LC_Page_Products_Detail での関連カテゴリーの取得を、SC_Helper_Category を使った形に変更.

File:
1 edited

Legend:

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

    r23422 r23458  
    687687        return $tablename . 'del_flg = 0 AND ' . $tablename . 'status = 1 '; 
    688688    } 
     689 
     690    /** 
     691     * 商品が属しているカテゴリーIDを取得する. 
     692     * 
     693     * @param int $product_id 
     694     * @param bool $include_hidden 
     695     * @return array 
     696     */ 
     697    public function getCategoryIds($product_id, $include_hidden = false) { 
     698        if ($include_hidden) { 
     699            $where = ''; 
     700        } else { 
     701            $where = 'status = 1'; 
     702        } 
     703 
     704        if (SC_Utils_Ex::sfIsInt($product_id) && $product_id != 0 && SC_Helper_DB_Ex::sfIsRecord('dtb_products','product_id', array($product_id), $where)) { 
     705            $objQuery =& SC_Query_Ex::getSingletonInstance(); 
     706            $category_id = $objQuery->getCol('category_id', 'dtb_product_categories', 'product_id = ?', array($product_id)); 
     707        } else { 
     708            // 不正な場合は、空の配列を返す。 
     709            $category_id = array(); 
     710        } 
     711 
     712        return $category_id; 
     713    } 
    689714} 
Note: See TracChangeset for help on using the changeset viewer.