[Svn-src-all:1350] [version-2_5-dev 20240] refs #982 リファクタリンク 商品詳細画面

tao admin @ mail.ec-cube.net
2011年 2月 20日 (日) 06:45:20 JST


Subversion committed to /home/svn/open 20240
http://svn.ec-cube.net/open_trac/changeset/20240
┌────────────────────────────┐
│更新者 :  tao                                          │
│更新日時:  2011-02-20 06:45:20 +0900 (日, 20  2月 2011)│
└────────────────────────────┘

Log:
--------------------------------------------------------
refs #982  リファクタリンク 商品詳細画面

Changed:                      [U:修正,A:追加,D:削除]
--------------------------------------------------------
U   branches/version-2_5-dev/data/class/pages/products/LC_Page_Products_Detail.php

変更: branches/version-2_5-dev/data/class/pages/products/LC_Page_Products_Detail.php
===================================================================
--- branches/version-2_5-dev/data/class/pages/products/LC_Page_Products_Detail.php	2011-02-19 21:38:57 UTC (rev 20239)
+++ branches/version-2_5-dev/data/class/pages/products/LC_Page_Products_Detail.php	2011-02-19 21:45:20 UTC (rev 20240)
@@ -94,7 +94,7 @@
         // パラメータ管理クラス
         $this->objFormParam = new SC_FormParam();
         // パラメータ情報の初期化
-        $this->arrForm = $this->lfInitParam(&$this->objFormParam);
+        $this->arrForm = $this->lfInitParam($this->objFormParam);
         // ファイル管理クラス
         $this->objUpFile = new SC_UploadFile(IMAGE_TEMP_REALDIR, IMAGE_SAVE_REALDIR);
         // ファイル情報の初期化
@@ -428,22 +428,38 @@
         $objQuery =& SC_Query::getSingletonInstance();
         $objQuery->setOrder("rank DESC");
         $arrRecommendData = $objQuery->select("recommend_product_id, comment", "dtb_recommend_products", "product_id = ?", array($product_id));
-
+        
+        $arrRecommendProductId = array();
+        foreach($arrRecommendData as $recommend){
+            $arrRecommendProductId[] = $recommend["recommend_product_id"];
+            $arrRecommendData[$recommend["recommend_product_id"]] = $recommend["comment"];
+        }
+        
         $objProduct = new SC_Product();
-
+        
         $where = "";
-        if (is_array($arrRecommendData["recommend_product_id"]) && !empty($arrRecommendData["recommend_product_id"])) {
-            $where = 'product_id IN (' . implode(',', $arrRecommendData["recommend_product_id"]) . ')';
+        if (!empty($arrRecommendProductId)) {
+            $where = 'product_id IN (' . implode(',', $arrRecommendProductId) . ')';
         } else {
             return $arrRecommend;
         }
         $objQuery =& SC_Query::getSingletonInstance();
         $objQuery->setWhere($where);
-        $arrProducts = $objProduct->lists($objQuery,$arrRecommendData["recommend_product_id"]);
-        foreach($arrProducts as $key=>$product){
-            $arrProducts[$key] += array("comment"=>$arrRecommendData[$key]["comment"]); 
+        $arrProducts = $objProduct->lists($objQuery, $arrRecommendProductId);
+
+        //取得している並び順で並び替え
+        // FIXME SC_Productあたりにソート処理はもってくべき
+        $arrProducts2 = array();
+        foreach($arrProducts as $item) {
+            $arrProducts2[ $item['product_id'] ] = $item;
         }
-        return $arrProducts;
+        $arrProducts = array();
+        foreach($arrRecommendProductId as $product_id) {
+            $arrProducts2[$product_id]["comment"] = $arrRecommendData[$product_id];
+            $arrRecommend[] = $arrProducts2[$product_id];
+        }
+
+        return $arrRecommend;
     }
 
     /* 入力内容のチェック */




Svn-src-all メーリングリストの案内