Changeset 20240
- Timestamp:
- 2011/02/20 06:45:20 (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/version-2_5-dev/data/class/pages/products/LC_Page_Products_Detail.php
r20234 r20240 95 95 $this->objFormParam = new SC_FormParam(); 96 96 // パラメータ情報の初期化 97 $this->arrForm = $this->lfInitParam( &$this->objFormParam);97 $this->arrForm = $this->lfInitParam($this->objFormParam); 98 98 // ファイル管理クラス 99 99 $this->objUpFile = new SC_UploadFile(IMAGE_TEMP_REALDIR, IMAGE_SAVE_REALDIR); … … 429 429 $objQuery->setOrder("rank DESC"); 430 430 $arrRecommendData = $objQuery->select("recommend_product_id, comment", "dtb_recommend_products", "product_id = ?", array($product_id)); 431 431 432 $arrRecommendProductId = array(); 433 foreach($arrRecommendData as $recommend){ 434 $arrRecommendProductId[] = $recommend["recommend_product_id"]; 435 $arrRecommendData[$recommend["recommend_product_id"]] = $recommend["comment"]; 436 } 437 432 438 $objProduct = new SC_Product(); 433 439 434 440 $where = ""; 435 if ( is_array($arrRecommendData["recommend_product_id"]) && !empty($arrRecommendData["recommend_product_id"])) {436 $where = 'product_id IN (' . implode(',', $arrRecommend Data["recommend_product_id"]) . ')';441 if (!empty($arrRecommendProductId)) { 442 $where = 'product_id IN (' . implode(',', $arrRecommendProductId) . ')'; 437 443 } else { 438 444 return $arrRecommend; … … 440 446 $objQuery =& SC_Query::getSingletonInstance(); 441 447 $objQuery->setWhere($where); 442 $arrProducts = $objProduct->lists($objQuery,$arrRecommendData["recommend_product_id"]); 443 foreach($arrProducts as $key=>$product){ 444 $arrProducts[$key] += array("comment"=>$arrRecommendData[$key]["comment"]); 445 } 446 return $arrProducts; 448 $arrProducts = $objProduct->lists($objQuery, $arrRecommendProductId); 449 450 //取得している並び順で並び替え 451 // FIXME SC_Productあたりにソート処理はもってくべき 452 $arrProducts2 = array(); 453 foreach($arrProducts as $item) { 454 $arrProducts2[ $item['product_id'] ] = $item; 455 } 456 $arrProducts = array(); 457 foreach($arrRecommendProductId as $product_id) { 458 $arrProducts2[$product_id]["comment"] = $arrRecommendData[$product_id]; 459 $arrRecommend[] = $arrProducts2[$product_id]; 460 } 461 462 return $arrRecommend; 447 463 } 448 464
Note: See TracChangeset
for help on using the changeset viewer.