Changeset 22582 for branches/version-2_12-dev/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_Recommend.php
- Timestamp:
- 2013/02/26 09:09:44 (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_12-dev/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_Recommend.php
r22567 r22582 94 94 function lfGetRanking() 95 95 { 96 $objQuery =& SC_Query_Ex::getSingletonInstance(); 97 $objProduct = new SC_Product_Ex(); 96 $objRecommend = new SC_Helper_Recommend_Ex(); 98 97 99 98 // おすすめ商品取得 100 $col = 'T1.best_id, T1.category_id, T1.rank, T1.product_id, T1.title, T1.comment, T1.create_date, T1.update_date'; 101 $table = 'dtb_best_products as T1 INNER JOIN dtb_products as T2 ON T1.product_id = T2.product_id'; 102 $where = 'T1.del_flg = 0 and T2.status = 1'; 103 if (NOSTOCK_HIDDEN) { 104 $where .= ' AND EXISTS(SELECT * FROM dtb_products_class WHERE product_id = T1.product_id AND dtb_products_class.del_flg = 0 AND (stock >= 1 OR stock_unlimited = 1))'; 105 } 106 $objQuery->setOrder('T1.rank'); 107 $objQuery->setLimit(RECOMMEND_NUM); 108 $arrBestProducts = $objQuery->select($col, $table, $where); 99 $arrRecommends = $objRecommend->getList(RECOMMEND_NUM); 109 100 110 $ objQuery =& SC_Query_Ex::getSingletonInstance();111 if (count($arr BestProducts) > 0) {101 $response = array(); 102 if (count($arrRecommends) > 0) { 112 103 // 商品一覧を取得 104 $objQuery =& SC_Query_Ex::getSingletonInstance(); 105 $objProduct = new SC_Product_Ex(); 113 106 // where条件生成&セット 114 107 $arrProductId = array(); 115 $where = 'product_id IN ('; 116 foreach ($arrBestProducts as $key => $val) { 108 foreach ($arrRecommends as $key => $val) { 117 109 $arrProductId[] = $val['product_id']; 118 110 } 119 // 取得 120 $arrProductList = $objProduct->getListByProductIds($objQuery, $arrProductId); 111 $arrProducts = $objProduct->getListByProductIds($objQuery, $arrProductId); 112 113 // 税込金額を設定する 114 SC_Product_Ex::setIncTaxToProducts($arrProducts); 115 121 116 // おすすめ商品情報にマージ 122 foreach ($arrBestProducts as $key => $value) { 123 $arrRow =& $arrBestProducts[$key]; 124 if (isset($arrProductList[$arrRow['product_id']])) { 125 $arrRow = array_merge($arrRow, $arrProductList[$arrRow['product_id']]); 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 } 126 123 } else { 127 124 // 削除済み商品は除外 128 unset($arr BestProducts[$key]);125 unset($arrRecommends[$key]); 129 126 } 130 127 } 131 128 } 132 return $ arrBestProducts;129 return $response; 133 130 } 134 131 }
Note: See TracChangeset
for help on using the changeset viewer.