Changeset 20196
- Timestamp:
- 2011/02/18 17:07:49 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_5-dev/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_Best5.php
r20188 r20196 65 65 66 66 // 基本情報を渡す 67 $objSiteInfo = new SC_SiteInfo();67 $objSiteInfo = SC_Helper_DB_Ex::sfGetBasisData(); 68 68 $this->arrInfo = $objSiteInfo->data; 69 69 … … 87 87 */ 88 88 function lfGetRanking(){ 89 $arrProduct = array(); 89 90 // おすすめ商品取得 90 91 $objQuery = SC_Query::getSingletonInstance(); … … 106 107 $objQuery->setLimit(RECOMMEND_NUM); 107 108 $arrBestProducts = $objQuery->getAll($sql); 108 // 各商品の詳細情報を取得 109 $objQuery = SC_Query::getSingletonInstance(); 110 $objProduct = new SC_Product(); 111 // where条件生成&セット 112 $arrBestProductIds = array(); 113 $where = 'product_id IN ( '; 114 foreach( $arrBestProducts as $key => $val ) { 115 $arrBestProductIds[] = $val['product_id']; 116 } 117 $where .= implode(', ', $arrBestProductIds); 118 $where .= ' )'; 119 $objQuery->setWhere($where); 120 // 取得 121 $arrProductList = $objProduct->lists($objQuery); 122 // おすすめ商品情報とマージ 123 $arrProduct = array(); 124 foreach( $arrProductList as $pdct_key => $pdct_val ) { 125 foreach( $arrBestProducts as $best_key => $best_val ) { 126 if ( $pdct_val['product_id'] == $best_val['product_id'] ) { 127 $arrProduct[$best_key] = array_merge($best_val, $pdct_val); 128 break; 109 if ( is_array($arrBestProducts) && count($arrBestProducts) > 0 ) { 110 // 各商品の詳細情報を取得 111 $objQuery = SC_Query::getSingletonInstance(); 112 $objProduct = new SC_Product(); 113 // where条件生成&セット 114 $arrBestProductIds = array(); 115 $where = 'product_id IN ( '; 116 foreach( $arrBestProducts as $key => $val ) { 117 $arrBestProductIds[] = $val['product_id']; 118 } 119 $where .= implode(', ', $arrBestProductIds); 120 $where .= ' )'; 121 $objQuery->setWhere($where); 122 // 取得 123 $arrProductList = $objProduct->lists($objQuery); 124 // おすすめ商品情報とマージ 125 foreach( $arrProductList as $pdct_key => $pdct_val ) { 126 foreach( $arrBestProducts as $best_key => $best_val ) { 127 if ( $pdct_val['product_id'] == $best_val['product_id'] ) { 128 $arrProduct[$best_key] = array_merge($best_val, $pdct_val); 129 break; 130 } 129 131 } 130 132 }
Note: See TracChangeset
for help on using the changeset viewer.