Index: /branches/version-2_5-dev/data/class/pages/shopping/LC_Page_Shopping_Complete.php
===================================================================
--- /branches/version-2_5-dev/data/class/pages/shopping/LC_Page_Shopping_Complete.php	(revision 18824)
+++ /branches/version-2_5-dev/data/class/pages/shopping/LC_Page_Shopping_Complete.php	(revision 18829)
@@ -536,19 +536,21 @@
         $arrClassCatName = $objDb->sfGetIDValueList("dtb_classcategory", "classcategory_id", "name");
 
+        $objProduct = new SC_Product();
         for ($i = 0; $i < $max; $i++) {
             // 商品規格情報の取得
-            $arrData = $objDb->sfGetProductsClass($arrCart[$i]['id']);
+            $arrData = $objProduct->getDetailAndProductsClass($arrCart[$i]['id']);
 
             // 存在する商品のみ表示する。
             if($arrData != "") {
                 $sqlval['order_id'] = $order_id;
-                $sqlval['product_id'] = $arrCart[$i]['id'][0];
-                $sqlval['product_class_id'] = $arrCart[$i]['id'][1];
-                $sqlval['classcategory_id1'] = $arrCart[$i]['id'][2];
-                $sqlval['classcategory_id2'] = $arrCart[$i]['id'][3];
+                $sqlval['product_id'] = $arrData['product_id'];
+                $sqlval['product_class_id'] = $arrData['product_class_id'];
+                // FIXME product_class_id のみで対応予定のため暫定対応
+                $sqlval['classcategory_id1'] = is_null($arrData['classcategory_id1']) ? 0 : $sqlval['classcategory_id1'];
+                $sqlval['classcategory_id2'] = is_null($arrData['classcategory_id2']) ? 0 : $sqlval['classcategory_id2'];
                 $sqlval['product_name'] = $arrData['name'];
                 $sqlval['product_code'] = $arrData['product_code'];
-                $sqlval['classcategory_name1'] = $arrClassCatName[$arrData['classcategory_id1']];
-                $sqlval['classcategory_name2'] = $arrClassCatName[$arrData['classcategory_id2']];
+                $sqlval['classcategory_name1'] = $arrData['name1'];
+                $sqlval['classcategory_name2'] = $arrData['name2'];
                 $sqlval['point_rate'] = $arrCart[$i]['point_rate'];
                 $sqlval['price'] = $arrCart[$i]['price'];
@@ -665,6 +667,10 @@
     }
 
-    // 在庫を減らす処理
-    function lfReduceStock(&$objQuery, $arrID, $quantity) {
+    /**
+     * 在庫を減らす処理
+     *
+     * FIXME 件数カウントバッチは最後にまとめて実行すること.
+     */
+    function lfReduceStock(&$objQuery, $product_class_id, $quantity) {
         $objDb = new SC_Helper_DB_Ex();
 
@@ -675,24 +681,18 @@
 
         $objProduct = new SC_Product();
-        $productsClass = $objProduct->getProductsClassFullByProductId($arrID[0]);
-
-        foreach ($productsClass as $val) {
-            if ($val['classcategory_id1'] == $arrID[2]
-                && $val['classcategory_id2'] == $arrID[3]) {
-
-                if (($val['stock_unlimited'] != '1' && $val['stock'] < $quantity) || $quantity == 0) {
-                    // 売り切れエラー
-                    $objQuery->rollback();
-                    SC_Utils_Ex::sfDispSiteError(SOLD_OUT, "", true);
-                }
-
-                // 在庫を減らす
-                $arrRawSql = array();
-                $arrRawSql['stock'] = 'stock - ?';
-                $arrRawSqlVal[] = $quantity;
-                $objQuery->update('dtb_products_class', array(), "product_class_id = ?", array($val['product_class_id']), $arrRawSql, $arrRawSqlVal);
-                break;
-            }
-        }
+        $productsClass = $objProduct->getDetailAndProductsClass($product_class_id);
+
+        if (($productsClass['stock_unlimited'] != '1' && $productsClass['stock'] < $quantity)
+            || $quantity == 0) {
+            // 売り切れエラー
+            $objQuery->rollback();
+            SC_Utils_Ex::sfDispSiteError(SOLD_OUT, "", true);
+        }
+
+        // 在庫を減らす
+        $arrRawSql = array();
+        $arrRawSql['stock'] = 'stock - ?';
+        $arrRawSqlVal[] = $quantity;
+        $objQuery->update('dtb_products_class', array(), "product_class_id = ?", array($val['product_class_id']), $arrRawSql, $arrRawSqlVal);
 
         // 在庫無し商品の非表示対応
Index: /branches/version-2_5-dev/data/class/pages/cart/LC_Page_Cart.php
===================================================================
--- /branches/version-2_5-dev/data/class/pages/cart/LC_Page_Cart.php	(revision 18701)
+++ /branches/version-2_5-dev/data/class/pages/cart/LC_Page_Cart.php	(revision 18829)
@@ -78,5 +78,5 @@
         $objCustomer = new SC_Customer();
         $objDb = new SC_Helper_DB_Ex();
-
+        $objProduct = new SC_Product();
         // 商品購入中にカート内容が変更された。
         if($objCartSess->getCancelPurchase()) {
@@ -106,5 +106,5 @@
             for ($i = 0; $i < $max; $i++) {
                 // 商品規格情報の取得
-                $this->arrData = $objDb->sfGetProductsClass($arrRet[$i]['id']);
+                $this->arrData = $objProduct->getProductsClass($arrRet[$i]['id']);
                 // DBに存在する商品
                 if($this->arrData != "") {
Index: /branches/version-2_5-dev/data/class/pages/products/LC_Page_Products_List.php
===================================================================
--- /branches/version-2_5-dev/data/class/pages/products/LC_Page_Products_List.php	(revision 18826)
+++ /branches/version-2_5-dev/data/class/pages/products/LC_Page_Products_List.php	(revision 18829)
@@ -157,9 +157,9 @@
                 // 規格IDを取得
                 $objProduct = new SC_Product();
-                $product_class_id = $objProduct->getClasscategoryIdsByProductClassId($product_id,$classcategory_id1,$classcategory_id2);
+                $product_class_id = $this->arrForm['product_class_id'];
                 $objCartSess = new SC_CartSession();
-                $objCartSess->addProduct(array($product_id, $product_class_id, $classcategory_id1, $classcategory_id2), $this->arrForm['quantity']);
-                    $this->sendRedirect($this->getLocation(URL_CART_TOP));
-                    exit;
+                $objCartSess->addProduct($product_class_id, $this->arrForm['quantity']);
+                $this->sendRedirect($this->getLocation(URL_CART_TOP));
+                exit;
             }
             foreach (array_keys($this->arrProducts) as $key) {
@@ -475,4 +475,5 @@
 
         $this->tpl_stock_find = $objProduct->stock_find;
+        $this->tpl_product_class_id = $objProduct->product_class_id;
 
         $productsClassCategories = $objProduct->classCategories;
Index: /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	(revision 18826)
+++ /branches/version-2_5-dev/data/class/pages/products/LC_Page_Products_Detail.php	(revision 18829)
@@ -169,4 +169,5 @@
 
         $this->tpl_stock_find = $objProduct->stock_find[$product_id];
+        $this->tpl_product_class_id = $objProduct->classCategories[$product_id]['']['']['product_class_id'];
 
         require_once DATA_PATH . 'module/Services/JSON.php';
@@ -191,4 +192,5 @@
                     $classcategory_id1 = $_POST['classcategory_id1'];
                     $classcategory_id2 = $_POST['classcategory_id2'];
+                    $product_class_id = $_POST['product_class_id'];
 
                     if (!empty($_POST['gmo_oneclick'])) {
@@ -207,6 +209,5 @@
                     // 規格IDを取得
                     $objProduct = new SC_Product();
-                    $product_class_id = $objProduct->getClasscategoryIdsByProductClassId($_POST['product_id'],$classcategory_id1,$classcategory_id2);
-                    $objCartSess->addProduct(array($_POST['product_id'], $product_class_id, $classcategory_id1, $classcategory_id2), $this->objFormParam->getValue('quantity'));
+                    $objCartSess->addProduct($product_class_id, $this->objFormParam->getValue('quantity'));
 
                     if (!empty($_POST['gmo_oneclick'])) {
Index: /branches/version-2_5-dev/data/class/helper/SC_Helper_DB.php
===================================================================
--- /branches/version-2_5-dev/data/class/helper/SC_Helper_DB.php	(revision 18823)
+++ /branches/version-2_5-dev/data/class/helper/SC_Helper_DB.php	(revision 18829)
@@ -256,4 +256,5 @@
         $objPage->tpl_total_point = 0;      // ポイント合計
 
+        $objProduct = new SC_Product();
         // カート内情報の取得
         $arrQuantityInfo_by_product = array();
@@ -261,5 +262,5 @@
         foreach ($objCartSess->getCartList() as $arrCart) {
             // 商品規格情報の取得
-            $arrData = $this->sfGetProductsClass($arrCart['id']);
+            $arrData = $objProduct->getDetailAndProductsClass($arrCart['id']);
             $limit = null;
             // DBに存在する商品
@@ -292,5 +293,5 @@
 
                 // (商品規格単位でなく)商品単位での評価のための準備
-                $product_id = $arrCart['id'][0];
+                $product_id = $arrData['product_id'];
                 $arrQuantityInfo_by_product[$product_id]['quantity'] += $quantity;
                 $arrQuantityInfo_by_product[$product_id]['sale_limit'] = $arrData['sale_limit'];
@@ -301,17 +302,14 @@
                 $objPage->arrProductsClass[$cnt]['cart_no'] = $arrCart['cart_no'];
                 $objPage->arrProductsClass[$cnt]['class_name1'] =
-                    isset($arrClassName[$arrData['class_id1']])
-                        ? $arrClassName[$arrData['class_id1']] : "";
+                    isset($arrData['class_name1'])
+                        ? $arrData['class_name1'] : "";
 
                 $objPage->arrProductsClass[$cnt]['class_name2'] =
-                    isset($arrClassName[$arrData['class_id2']])
-                        ? $arrClassName[$arrData['class_id2']] : "";
-
-                $objPage->arrProductsClass[$cnt]['classcategory_name1'] =
-                    $arrClassCatName[$arrData['classcategory_id1']];
-
-                $objPage->arrProductsClass[$cnt]['classcategory_name2'] =
-                    $arrClassCatName[$arrData['classcategory_id2']];
-
+                    isset($arrData['class_name2'])
+                        ? $arrData['class_name2'] : "";
+
+                $objPage->arrProductsClass[$cnt]['classcategory_name1'] = $arrData['name1'];
+
+                $objPage->arrProductsClass[$cnt]['classcategory_name2'] = $arrData['name2'];
                 // 価格の登録
                 $objCartSess->setProductValue($arrCart['id'], 'price', $arrData['price02']);
Index: /branches/version-2_5-dev/data/class/SC_Product.php
===================================================================
--- /branches/version-2_5-dev/data/class/SC_Product.php	(revision 18826)
+++ /branches/version-2_5-dev/data/class/SC_Product.php	(revision 18829)
@@ -124,4 +124,16 @@
 
     /**
+     * 商品詳細情報と商品規格を取得する.
+     *
+     * @param integer $productClassId 商品規格ID
+     * @return array 商品詳細情報と商品規格の配列
+     */
+    function getDetailAndProductsClass($productClassId) {
+        $result = $this->getProductsClass($productClassId);
+        $result = array_merge($result, $this->getDetail($result['product_id']));
+        return $result;
+    }
+
+    /**
      * 商品IDに紐づく商品規格を自分自身に設定する.
      *
@@ -163,4 +175,6 @@
             $classCategories = array();
             $classCategories['']['']['name'] = '選択してください';
+            $classCategories['']['']['product_class_id'] = $arrProductClass[0]['product_class_id'];
+            $this->product_class_id[$productId] = $arrProductClass[0]['product_class_id'];
             foreach ($arrProductClass as $productsClass) {
                 $productsClass1 = $productsClass['classcategory_id1'];
@@ -201,4 +215,6 @@
                 // 商品コード
                 $classCategories[$productsClass1][$productsClass2]['product_code'] = $productsClass['product_code'];
+                // 商品規格ID
+                $classCategories[$productsClass1][$productsClass2]['product_class_id'] = $productsClass['product_class_id'];
             }
 
@@ -211,16 +227,11 @@
 
     /**
-     * 複数の商品IDに紐づいた, 商品規格を取得する.
-     *
-     * @param array $productIds 商品IDの配列
+     * SC_Query インスタンスに設定された検索条件を使用して商品規格を取得する.
+     *
+     * @param SC_Query $objQuery SC_Queryインスタンス
+     * @param array $params 検索パラメータの配列
      * @return array 商品規格の配列
      */
-    function getProductsClassByProductIds($productIds = array()) {
-        if (empty($productIds)) {
-            return array();
-        }
-        $objQuery =& SC_Query::getSingletonInstance();
-        $objQuery->setWhere('product_id IN (' . implode(', ', array_pad(array(), count($productIds), '?')) . ')');
-        $objQuery->setOrder("T2.level DESC");
+    function getProductsClassByQuery(&$objQuery, $params) {
         // 末端の規格を取得
         $col = <<< __EOS__
@@ -254,5 +265,5 @@
                    ON T3.class_id = T4.class_id
 __EOS__;
-        $arrRet = $objQuery->select($col, $table, "", $productIds);
+        $arrRet = $objQuery->select($col, $table, "", $params);
         $levels = array();
         $parents = array();
@@ -317,12 +328,62 @@
 
     /**
+     * 商品規格IDから商品規格を取得する.
+     */
+    function getProductsClass($productClassId) {
+        $objQuery =& SC_Query::getSingletonInstance();
+        $objQuery->setWhere('product_class_id = ?');
+        $objQuery->setOrder("T2.level DESC");
+        $results = $this->getProductsClassByQuery($objQuery, $productClassId);
+        $productsClass = $this->getProductsClassFull($results);
+        return $productsClass[0];
+    }
+
+    /**
+     * 複数の商品IDに紐づいた, 商品規格を取得する.
+     *
+     * @param array $productIds 商品IDの配列
+     * @return array 商品規格の配列
+     */
+    function getProductsClassByProductIds($productIds = array()) {
+        if (empty($productIds)) {
+            return array();
+        }
+        $objQuery =& SC_Query::getSingletonInstance();
+        $objQuery->setWhere('product_id IN (' . implode(', ', array_pad(array(), count($productIds), '?')) . ')');
+        $objQuery->setOrder("T2.level DESC");
+        return $this->getProductsClassByQuery($objQuery, $productIds);
+    }
+
+    /**
      * 商品IDに紐づいた, 商品規格を階層ごとに取得する.
      *
-     * @param array $productId 商品IDの配列
+     * @param array $productId 商品ID
      * @return array 階層ごとの商品規格の配列
      */
     function getProductsClassLevelByProductId($productId) {
         $results = $this->getProductsClassByProductIds(array($productId));
-        foreach ($results as $row) {
+        return $this->getProductsClassLevel($results);
+    }
+
+    /**
+     * 商品IDに紐づいた, 商品規格をすべての組み合わせごとに取得する.
+     *
+     * @param array $productId 商品ID
+     * @return array すべての組み合わせの商品規格の配列
+     */
+    function getProductsClassFullByProductId($productId) {
+        $results = $this->getProductsClassByProductIds(array($productId));
+        return $this->getProductsClassFull($results);
+    }
+
+    /**
+     * 商品規格の配列から, 商品規格を階層ごとに取得する.
+     *
+     * @access private
+     * @param array $productsClassResults 商品規格の結果の配列
+     * @return array 階層ごとの商品規格の配列
+     */
+    function getProductsClassLevel($productsClassResults) {
+        foreach ($productsClassResults as $row) {
             $productsClassLevel["level" . $row['level']][] = $row;
         }
@@ -331,13 +392,15 @@
 
     /**
-     * 商品IDに紐づいた, 商品規格をすべての組み合わせごとに取得する.
-     *
-     * @param array $productId 商品IDの配列
-     * @return array すべての組み合わせの商品規格の配列
-     */
-    function getProductsClassFullByProductId($productId) {
-        $results = $this->getProductsClassLevelByProductId($productId);
+     * 商品規格の配列から, 商品規格のすべての組み合わせを取得する.
+     *
+     * @access private
+     * @param array $productsClassResults 商品規格の結果の配列
+     * @ array 階層ごとの商品規格の配列
+     */
+    function getProductsClassFull($productsClassResults) {
+        $results = $this->getProductsClassLevel($productsClassResults);
         $productsClass = array();
-        if (SC_Utils_Ex::isBlank($results["level1"]) && SC_Utils_Ex::isBlank($results["level2"])) {
+        if (SC_Utils_Ex::isBlank($results["level1"])
+            && SC_Utils_Ex::isBlank($results["level2"])) {
             return $results["level"];
         }
Index: /branches/version-2_5-dev/data/Smarty/templates/default/detail.tpl
===================================================================
--- /branches/version-2_5-dev/data/Smarty/templates/default/detail.tpl	(revision 18777)
+++ /branches/version-2_5-dev/data/Smarty/templates/default/detail.tpl	(revision 18829)
@@ -130,4 +130,15 @@
         eleDynamic.innerHTML = '';
     }
+    // 商品規格
+    eleDynamic = document.getElementById('product_class_id');
+    if (
+           classcat2
+        && typeof classcat2.product_class_id != 'undefined'
+        && String(classcat2.product_class_id).length >= 1
+    ) {
+        eleDynamic.value = classcat2.product_class_id;
+    } else {
+        eleDynamic.value = ''
+    }
 }
 $(document).ready(function() {
@@ -280,4 +291,5 @@
                 <input type="hidden" name="mode" value="cart" />
                 <input type="hidden" name="product_id" value="<!--{$tpl_product_id}-->" />
+                <input type="hidden" name="product_class_id" value="<!--{$tpl_product_class_id}-->" id="product_class_id" />
                 <input type="hidden" name="favorite_product_id" value="" />
 
Index: /branches/version-2_5-dev/data/Smarty/templates/default/list.tpl
===================================================================
--- /branches/version-2_5-dev/data/Smarty/templates/default/list.tpl	(revision 18700)
+++ /branches/version-2_5-dev/data/Smarty/templates/default/list.tpl	(revision 18829)
@@ -73,4 +73,5 @@
     fnSetVal("quantity", productForm["quantity"].value);
     fnSetVal("product_id", productForm["product_id"].value);
+    fnSetVal("product_class_id", productForm["product_class_id"].value);
     fnSubmit();
 }
@@ -109,4 +110,15 @@
         eleDynamic.innerHTML = '';
     }
+    // 商品規格
+    eleDynamic = document.getElementById('product_class_id' + product_id);
+    if (
+           classcat2
+        && typeof classcat2.product_class_id != 'undefined'
+        && String(classcat2.product_class_id).length >= 1
+    ) {
+        eleDynamic.value = classcat2.product_class_id;
+    } else {
+        eleDynamic.value = ''
+    }
 }
 //]]>
@@ -131,4 +143,5 @@
         <input type="hidden" name="classcategory_id1" value="" />
         <input type="hidden" name="classcategory_id2" value="" />
+        <input type="hidden" name="product_class_id" value="" />
         <input type="hidden" name="quantity" value="" />
         <!--{* ▲注文関連 *}-->
@@ -254,4 +267,5 @@
                 <form name="product_form<!--{$id|escape}-->" action="?" onsubmit="return false;">
                     <input type="hidden" name="product_id" value="<!--{$id|escape}-->" />
+                    <input type="hidden" name="product_class_id" id="product_class_id<!--{$id|escape}-->" value="<!--{$tpl_product_class_id[$id]}-->" />
                     <div class="in_cart">
                         <!--{if $tpl_stock_find[$id]}-->
