Ignore:
Timestamp:
2013/05/02 18:11:36 (11 years ago)
Author:
h_yoshimoto
Message:

#2236 2.12.3リリース以降の2.12-devへのコミット差し戻し

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/version-2_12-dev/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_Recommend.php

    r22582 r22796  
    3232 * @version $Id: LC_Page_FrontParts_Bloc_Best5 - Copy.php -1   $ 
    3333 */ 
    34 class LC_Page_FrontParts_Bloc_Recommend extends LC_Page_FrontParts_Bloc_Ex  
    35 { 
     34class LC_Page_FrontParts_Bloc_Recommend extends LC_Page_FrontParts_Bloc_Ex { 
    3635 
    3736    // }}} 
     
    4342     * @return void 
    4443     */ 
    45     function init() 
    46     { 
     44    function init() { 
    4745        parent::init(); 
    4846    } 
     
    5351     * @return void 
    5452     */ 
    55     function process() 
    56     { 
     53    function process() { 
    5754        $this->action(); 
    5855        $this->sendResponse(); 
     
    6461     * @return void 
    6562     */ 
    66     function action() 
    67     { 
     63    function action() { 
    6864 
    6965        // 基本情報を渡す 
     
    8278     * @return void 
    8379     */ 
    84     function destroy() 
    85     { 
     80    function destroy() { 
    8681        parent::destroy(); 
    8782    } 
     
    9287     * @return array $arrBestProducts 検索結果配列 
    9388     */ 
    94     function lfGetRanking() 
    95     { 
    96         $objRecommend = new SC_Helper_Recommend_Ex(); 
     89    function lfGetRanking() { 
     90        $objQuery =& SC_Query_Ex::getSingletonInstance(); 
     91        $objProduct = new SC_Product_Ex(); 
    9792 
    9893        // おすすめ商品取得 
    99         $arrRecommends = $objRecommend->getList(RECOMMEND_NUM); 
     94        $col = 'T1.best_id, T1.category_id, T1.rank, T1.product_id, T1.title, T1.comment, T1.create_date, T1.update_date'; 
     95        $table = 'dtb_best_products as T1 INNER JOIN dtb_products as T2 ON T1.product_id = T2.product_id'; 
     96        $where = 'T1.del_flg = 0 and T2.status = 1'; 
     97        $objQuery->setOrder('T1.rank'); 
     98        $objQuery->setLimit(RECOMMEND_NUM); 
     99        $arrBestProducts = $objQuery->select($col, $table, $where); 
    100100 
    101         $response = array(); 
    102         if (count($arrRecommends) > 0) { 
     101        $objQuery =& SC_Query_Ex::getSingletonInstance(); 
     102        if (count($arrBestProducts) > 0) { 
    103103            // 商品一覧を取得 
    104             $objQuery =& SC_Query_Ex::getSingletonInstance(); 
    105             $objProduct = new SC_Product_Ex(); 
    106104            // where条件生成&セット 
    107105            $arrProductId = array(); 
    108             foreach ($arrRecommends as $key => $val) { 
     106            $where = 'product_id IN ('; 
     107            foreach ($arrBestProducts as $key => $val) { 
    109108                $arrProductId[] = $val['product_id']; 
    110109            } 
    111             $arrProducts = $objProduct->getListByProductIds($objQuery, $arrProductId); 
    112  
    113             // 税込金額を設定する 
    114             SC_Product_Ex::setIncTaxToProducts($arrProducts); 
    115  
     110            // 取得 
     111            $arrProductList = $objProduct->getListByProductIds($objQuery, $arrProductId); 
    116112            // おすすめ商品情報にマージ 
    117             foreach ($arrRecommends as $key => $value) { 
    118                 if (isset($arrProducts[$value['product_id']])) { 
    119                     $product = $arrProducts[$value['product_id']]; 
    120                     if (!NOSTOCK_HIDDEN || ($product['status'] == 1 && ($product['stock_max'] >= 1 || $product['stock_unlimited_max'] == 1))) { 
    121                         $response[] = array_merge($value, $arrProducts[$value['product_id']]); 
    122                     } 
     113            foreach ($arrBestProducts as $key => $value) { 
     114                $arrRow =& $arrBestProducts[$key]; 
     115                if (isset($arrProductList[$arrRow['product_id']])) { 
     116                    $arrRow = array_merge($arrRow, $arrProductList[$arrRow['product_id']]); 
    123117                } else { 
    124118                    // 削除済み商品は除外 
    125                     unset($arrRecommends[$key]); 
     119                    unset($arrBestProducts[$key]); 
    126120                } 
    127121            } 
    128122        } 
    129         return $response; 
     123        return $arrBestProducts; 
    130124    } 
    131125} 
Note: See TracChangeset for help on using the changeset viewer.