Changeset 21143 for branches/version-2_11-dev/data
- Timestamp:
- 2011/08/08 12:35:40 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_11-dev/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_Recommend.php
r20810 r21143 86 86 */ 87 87 function lfGetRanking(){ 88 $arrProduct = array(); 88 $objQuery =& SC_Query_Ex::getSingletonInstance(); 89 $objProduct = new SC_Product_Ex(); 90 89 91 // おすすめ商品取得 90 $objQuery = SC_Query_Ex::getSingletonInstance();91 92 92 $col = 'best_id, best_id, category_id, rank, product_id, title, comment, create_date, update_date'; 93 93 $table = 'dtb_best_products'; … … 96 96 $objQuery->setLimit(RECOMMEND_NUM); 97 97 $arrBestProducts = $objQuery->select($col, $table, $where); 98 if ( is_array($arrBestProducts) && count($arrBestProducts) > 0 ) { 99 // 各商品の詳細情報を取得100 $objQuery = SC_Query_Ex::getSingletonInstance();101 $objProduct = new SC_Product_Ex();98 99 $objQuery =& SC_Query_Ex::getSingletonInstance(); 100 if (count($arrBestProducts) > 0) { 101 // 商品一覧を取得 102 102 // where条件生成&セット 103 103 $arrBestProductIds = array(); 104 $where = 'product_id IN ( 105 foreach ( $arrBestProducts as $key => $val) {104 $where = 'product_id IN ('; 105 foreach ($arrBestProducts as $key => $val) { 106 106 $arrBestProductIds[] = $val['product_id']; 107 107 } 108 108 $where .= implode(', ', $arrBestProductIds); 109 $where .= ' 109 $where .= ')'; 110 110 $objQuery->setWhere($where); 111 111 // 取得 112 $arrProductList = $objProduct->lists($objQuery); 113 // おすすめ商品情報とマージ 114 foreach( $arrProductList as $pdct_key => $pdct_val ) { 115 foreach( $arrBestProducts as $best_key => $best_val ) { 116 if ( $pdct_val['product_id'] == $best_val['product_id'] ) { 117 $arrProduct[$best_key] = array_merge($best_val, $pdct_val); 118 break; 119 } 112 $arrTmp = $objProduct->lists($objQuery); 113 foreach ($arrTmp as $key => $arrRow) { 114 $arrProductList[$arrRow['product_id']] = $arrRow; 115 } 116 // おすすめ商品情報にマージ 117 foreach (array_keys($arrBestProducts) as $key) { 118 $arrRow =& $arrBestProducts[$key]; 119 if (isset($arrProductList[$arrRow['product_id']])) { 120 $arrRow = array_merge($arrRow, $arrProductList[$arrRow['product_id']]); 121 } else { 122 // 削除済み商品は除外 123 unset($arrBestProducts[$key]); 120 124 } 121 125 } 122 126 } 123 return $arr Product;127 return $arrBestProducts; 124 128 } 125 129 }
Note: See TracChangeset
for help on using the changeset viewer.