Changeset 22796 for branches/version-2_12-dev/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_Recommend.php
- Timestamp:
- 2013/05/02 18:11:36 (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
r22582 r22796 32 32 * @version $Id: LC_Page_FrontParts_Bloc_Best5 - Copy.php -1 $ 33 33 */ 34 class LC_Page_FrontParts_Bloc_Recommend extends LC_Page_FrontParts_Bloc_Ex 35 { 34 class LC_Page_FrontParts_Bloc_Recommend extends LC_Page_FrontParts_Bloc_Ex { 36 35 37 36 // }}} … … 43 42 * @return void 44 43 */ 45 function init() 46 { 44 function init() { 47 45 parent::init(); 48 46 } … … 53 51 * @return void 54 52 */ 55 function process() 56 { 53 function process() { 57 54 $this->action(); 58 55 $this->sendResponse(); … … 64 61 * @return void 65 62 */ 66 function action() 67 { 63 function action() { 68 64 69 65 // 基本情報を渡す … … 82 78 * @return void 83 79 */ 84 function destroy() 85 { 80 function destroy() { 86 81 parent::destroy(); 87 82 } … … 92 87 * @return array $arrBestProducts 検索結果配列 93 88 */ 94 function lfGetRanking() 95 {96 $obj Recommend = new SC_Helper_Recommend_Ex();89 function lfGetRanking() { 90 $objQuery =& SC_Query_Ex::getSingletonInstance(); 91 $objProduct = new SC_Product_Ex(); 97 92 98 93 // おすすめ商品取得 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); 100 100 101 $ response = array();102 if (count($arr Recommends) > 0) {101 $objQuery =& SC_Query_Ex::getSingletonInstance(); 102 if (count($arrBestProducts) > 0) { 103 103 // 商品一覧を取得 104 $objQuery =& SC_Query_Ex::getSingletonInstance();105 $objProduct = new SC_Product_Ex();106 104 // where条件生成&セット 107 105 $arrProductId = array(); 108 foreach ($arrRecommends as $key => $val) { 106 $where = 'product_id IN ('; 107 foreach ($arrBestProducts as $key => $val) { 109 108 $arrProductId[] = $val['product_id']; 110 109 } 111 $arrProducts = $objProduct->getListByProductIds($objQuery, $arrProductId); 112 113 // 税込金額を設定する 114 SC_Product_Ex::setIncTaxToProducts($arrProducts); 115 110 // 取得 111 $arrProductList = $objProduct->getListByProductIds($objQuery, $arrProductId); 116 112 // おすすめ商品情報にマージ 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']]); 123 117 } else { 124 118 // 削除済み商品は除外 125 unset($arr Recommends[$key]);119 unset($arrBestProducts[$key]); 126 120 } 127 121 } 128 122 } 129 return $ response;123 return $arrBestProducts; 130 124 } 131 125 }
Note: See TracChangeset
for help on using the changeset viewer.