Index: branches/version-2_13-dev/data/class/SC_Product.php
===================================================================
--- branches/version-2_13-dev/data/class/SC_Product.php	(revision 23378)
+++ branches/version-2_13-dev/data/class/SC_Product.php	(revision 23404)
@@ -195,14 +195,15 @@
      * 商品詳細を取得する.
      *
-     * @param  integer $productId 商品ID
+     * @param  integer $product_id 商品ID
      * @return array   商品詳細情報の配列
      */
-    public function getDetail($productId)
+    public function getDetail($product_id)
     {
         $objQuery =& SC_Query_Ex::getSingletonInstance();
-        $arrProduct = $objQuery->getRow('*', $this->alldtlSQL('product_id = ?'),
-                                    'product_id = ?',
-                                    array($productId, $productId));
-        $arrProduct = (array) $arrProduct;
+
+        $from = $this->alldtlSQL();
+        $where = 'product_id = ?';
+        $arrWhereVal = array($product_id);
+        $arrProduct = (array)$objQuery->getRow('*', $from, $where, $arrWhereVal);
 
         // 税込金額を設定する
@@ -631,87 +632,24 @@
          * 商品(dtb_products)ごとの設定なので MAX のみを取得する.
          */
+        $sub_base = "FROM dtb_products_class WHERE del_flg = 0 AND product_id = dtb_products.product_id $where_products_class";
         $sql = <<< __EOS__
             (
                 SELECT
-                     dtb_products.product_id
-                    ,dtb_products.name
-                    ,dtb_products.maker_id
-                    ,dtb_products.status
-                    ,dtb_products.comment1
-                    ,dtb_products.comment2
-                    ,dtb_products.comment3
-                    ,dtb_products.comment4
-                    ,dtb_products.comment5
-                    ,dtb_products.comment6
-                    ,dtb_products.note
-                    ,dtb_products.main_list_comment
-                    ,dtb_products.main_list_image
-                    ,dtb_products.main_comment
-                    ,dtb_products.main_image
-                    ,dtb_products.main_large_image
-                    ,dtb_products.sub_title1
-                    ,dtb_products.sub_comment1
-                    ,dtb_products.sub_image1
-                    ,dtb_products.sub_large_image1
-                    ,dtb_products.sub_title2
-                    ,dtb_products.sub_comment2
-                    ,dtb_products.sub_image2
-                    ,dtb_products.sub_large_image2
-                    ,dtb_products.sub_title3
-                    ,dtb_products.sub_comment3
-                    ,dtb_products.sub_image3
-                    ,dtb_products.sub_large_image3
-                    ,dtb_products.sub_title4
-                    ,dtb_products.sub_comment4
-                    ,dtb_products.sub_image4
-                    ,dtb_products.sub_large_image4
-                    ,dtb_products.sub_title5
-                    ,dtb_products.sub_comment5
-                    ,dtb_products.sub_image5
-                    ,dtb_products.sub_large_image5
-                    ,dtb_products.sub_title6
-                    ,dtb_products.sub_comment6
-                    ,dtb_products.sub_image6
-                    ,dtb_products.sub_large_image6
-                    ,dtb_products.del_flg
-                    ,dtb_products.creator_id
-                    ,dtb_products.create_date
-                    ,dtb_products.update_date
-                    ,dtb_products.deliv_date_id
-                    ,T4.product_code_min
-                    ,T4.product_code_max
-                    ,T4.price01_min
-                    ,T4.price01_max
-                    ,T4.price02_min
-                    ,T4.price02_max
-                    ,T4.stock_min
-                    ,T4.stock_max
-                    ,T4.stock_unlimited_min
-                    ,T4.stock_unlimited_max
-                    ,T4.point_rate
-                    ,T4.deliv_fee
-                    ,T4.class_count
+                     dtb_products.*
                     ,dtb_maker.name AS maker_name
+                    ,(SELECT MIN(product_code) $sub_base) AS product_code_min
+                    ,(SELECT MAX(product_code) $sub_base) AS product_code_max
+                    ,(SELECT MIN(price01) $sub_base) AS price01_min
+                    ,(SELECT MAX(price01) $sub_base) AS price01_max
+                    ,(SELECT MIN(price02) $sub_base) AS price02_min
+                    ,(SELECT MAX(price02) $sub_base) AS price02_max
+                    ,(SELECT MIN(stock) $sub_base) AS stock_min
+                    ,(SELECT MAX(stock) $sub_base) AS stock_max
+                    ,(SELECT MIN(stock_unlimited) $sub_base) AS stock_unlimited_min
+                    ,(SELECT MAX(stock_unlimited) $sub_base) AS stock_unlimited_max
+                    ,(SELECT MAX(point_rate) $sub_base) AS point_rate
+                    ,(SELECT MAX(deliv_fee) $sub_base) AS deliv_fee
+                    ,(SELECT COUNT(*) $sub_base) AS class_count
                 FROM dtb_products
-                    JOIN (
-                        SELECT product_id,
-                            MIN(product_code) AS product_code_min,
-                            MAX(product_code) AS product_code_max,
-                            MIN(price01) AS price01_min,
-                            MAX(price01) AS price01_max,
-                            MIN(price02) AS price02_min,
-                            MAX(price02) AS price02_max,
-                            MIN(stock) AS stock_min,
-                            MAX(stock) AS stock_max,
-                            MIN(stock_unlimited) AS stock_unlimited_min,
-                            MAX(stock_unlimited) AS stock_unlimited_max,
-                            MAX(point_rate) AS point_rate,
-                            MAX(deliv_fee) AS deliv_fee,
-                            COUNT(*) as class_count
-                        FROM dtb_products_class
-                        WHERE del_flg = 0 $where_products_class
-                        GROUP BY product_id
-                    ) AS T4
-                        ON dtb_products.product_id = T4.product_id
                     LEFT JOIN dtb_maker
                         ON dtb_products.maker_id = dtb_maker.maker_id
