Index: /branches/comu-ver2/html/user_data/packages/default/css/products.css
===================================================================
--- /branches/comu-ver2/html/user_data/packages/default/css/products.css	(revision 18207)
+++ /branches/comu-ver2/html/user_data/packages/default/css/products.css	(revision 18277)
@@ -122,8 +122,4 @@
 }
 
-div.listrightblock .soldout {
-    clear: both;
-}
-
 div.listrightblock .in_cart {
     margin: 20px auto 5px 130px;
@@ -159,5 +155,4 @@
 div.listrightblock .cartbtn {
     clear: both;
-    text-align: center;
 }
 
@@ -208,9 +203,10 @@
 
 div#detailrightblock dl {
-    padding: 15px 0 0 0;
+    padding: 0;
 }
 
 div#detailrightblock dt {
     font-weight: bold;
+    margin: 15px 0 0 0;
     padding: 0 0 0 15px;
     background: url("../img/common/arrow_gray.gif") no-repeat left center;
@@ -235,4 +231,10 @@
 }
 
+/* 商品共通 */
+
+.cartbtn {
+    text-align: center;
+}
+
 /* サブタイトル
 ----------------------------------------------- */
Index: /branches/comu-ver2/data/class/pages/products/LC_Page_Products_Detail.php
===================================================================
--- /branches/comu-ver2/data/class/pages/products/LC_Page_Products_Detail.php	(revision 18275)
+++ /branches/comu-ver2/data/class/pages/products/LC_Page_Products_Detail.php	(revision 18277)
@@ -151,56 +151,81 @@
         $this->lfMakeSelect($product_id);
 
+        require_once CLASS_PATH . 'SC_Product.php';
+        $objProduct = new SC_Product($product_id);
+        // 規格1クラス名
+        $this->tpl_class_name1 = $objProduct->className1[$product_id];
+
+        // 規格2クラス名
+        $this->tpl_class_name2 = $objProduct->className2[$product_id];
+        
+        // 規格1
+        $this->arrClassCat1 = $objProduct->classCats1[$product_id];
+
+        // 規格1が設定されている
+        $this->tpl_classcat_find1 = $objProduct->classCat1_find[$product_id];
+        // 規格2が設定されている
+        $this->tpl_classcat_find2 = $objProduct->classCat2_find[$product_id];
+
+        $this->tpl_stock_find = $objProduct->stock_find[$product_id];
+
+        require_once DATA_PATH . 'module/Services/JSON.php';
+        $objJson = new Services_JSON();
+        $this->tpl_javascript .= 'classCategories = ' . $objJson->encode($objProduct->classCategories[$product_id]) . ';';
+        $this->tpl_javascript .= 'function lnOnLoad(){' . $this->js_lnOnload . '}';
+        $this->tpl_onload .= 'lnOnLoad();';
+
         // 商品IDをFORM内に保持する。
         $this->tpl_product_id = $product_id;
 
         if (!isset($_POST['mode'])) $_POST['mode'] = "";
-
+        $arrErr = array();
+        
         switch($_POST['mode']) {
-        case 'cart':
-            // 入力値の変換
-            $this->objFormParam->convParam();
-            $this->arrErr = $this->lfCheckError();
-            if(count($this->arrErr) == 0) {
-                $objCartSess = new SC_CartSession();
-                $classcategory_id1 = $_POST['classcategory_id1'];
-                $classcategory_id2 = $_POST['classcategory_id2'];
-
-                if (!empty($_POST['gmo_oneclick'])) {
-                    $objCartSess->delAllProducts();
-                }
-
-                // 規格1が設定されていない場合
-                if(!$this->tpl_classcat_find1) {
-                    $classcategory_id1 = '0';
-                }
-
-                // 規格2が設定されていない場合
-                if(!$this->tpl_classcat_find2) {
-                    $classcategory_id2 = '0';
-                }
-
-                $objCartSess->setPrevURL($_SERVER['REQUEST_URI']);
-                $objCartSess->addProduct(array($_POST['product_id'], $classcategory_id1, $classcategory_id2), $this->objFormParam->getValue('quantity'));
-
-                if (!empty($_POST['gmo_oneclick'])) {
-                    $objSiteSess = new SC_SiteSession;
-                    $objSiteSess->setRegistFlag();
-                    $objCartSess->saveCurrentCart($objSiteSess->getUniqId());
-
-                    $this->sendRedirect($this->getLocation(
-                        URL_DIR . 'user_data/gmopg_oneclick_confirm.php', array(), true));
+            case 'cart':
+                // 入力値の変換
+                $this->objFormParam->convParam();
+                $arrErr = $this->lfCheckError();
+                if (count($arrErr) == 0) {
+                    $objCartSess = new SC_CartSession();
+                    $classcategory_id1 = $_POST['classcategory_id1'];
+                    $classcategory_id2 = $_POST['classcategory_id2'];
+
+                    if (!empty($_POST['gmo_oneclick'])) {
+                        $objCartSess->delAllProducts();
+                    }
+
+                    // 規格1が設定されていない場合
+                    if(!$this->tpl_classcat_find1) {
+                        $classcategory_id1 = '0';
+                    }
+
+                    // 規格2が設定されていない場合
+                    if(!$this->tpl_classcat_find2) {
+                        $classcategory_id2 = '0';
+                    }
+
+                    $objCartSess->setPrevURL($_SERVER['REQUEST_URI']);
+                    $objCartSess->addProduct(array($_POST['product_id'], $classcategory_id1, $classcategory_id2), $this->objFormParam->getValue('quantity'));
+
+                    if (!empty($_POST['gmo_oneclick'])) {
+                        $objSiteSess = new SC_SiteSession;
+                        $objSiteSess->setRegistFlag();
+                        $objCartSess->saveCurrentCart($objSiteSess->getUniqId());
+
+                        $this->sendRedirect($this->getLocation(
+                            URL_DIR . 'user_data/gmopg_oneclick_confirm.php', array(), true));
+                        exit;
+                    }
+
+                    $this->sendRedirect($this->getLocation(URL_CART_TOP));
                     exit;
                 }
-
-                $this->sendRedirect($this->getLocation(URL_CART_TOP));
-                exit;
-            }
-            break;
-
-        default:
-            break;
-        }
-
-        $objQuery = new SC_Query();
+                break;
+
+            default:
+                break;
+        }
+        $this->arrErr = $arrErr;
+
         // DBから商品情報を取得する。
         $arrRet = $objQuery->select("*, (SELECT count(*) FROM dtb_customer_favorite_products WHERE product_id = alldtl.product_id AND customer_id = ?) AS favorite_count", "vw_products_allclass_detail AS alldtl", "product_id = ?", array($objCustomer->getValue('customer_id'), $product_id));
@@ -510,126 +535,22 @@
 
     /* 規格選択セレクトボックスの作成 */
-    function lfMakeSelect($product_id) {
-
-        $objDb = new SC_Helper_DB_Ex();
-        $classcat_find1 = false;
-        $classcat_find2 = false;
-        // 在庫ありの商品の有無
-        $stock_find = false;
-
-        // 規格名一覧
-        $arrClassName = $objDb->sfGetIDValueList("dtb_class", "class_id", "name");
-        // 規格分類名一覧
-        $arrClassCatName = $objDb->sfGetIDValueList("dtb_classcategory", "classcategory_id", "name");
-        // 商品規格情報の取得
-        $arrProductsClass = $this->lfGetProductsClass($product_id);
-
-        // 規格1クラス名の取得
-        $this->tpl_class_name1 = isset($arrClassName[$arrProductsClass[0]['class_id1']])
-                                        ? $arrClassName[$arrProductsClass[0]['class_id1']] : "";
-        // 規格2クラス名の取得
-        $this->tpl_class_name2 = isset($arrClassName[$arrProductsClass[0]['class_id2']])
-                                        ? $arrClassName[$arrProductsClass[0]['class_id2']] : "";
-
-        // すべての組み合わせ数
-        $count = count($arrProductsClass);
-
-        $classcat_id1 = "";
-
-        $arrSele = array();
-        $arrList = array();
-
-        $list_id = 0;
-        $arrList[0] = "\tlist0 = new Array('選択してください'";
-        $arrVal[0] = "\tval0 = new Array(''";
-
-        for ($i = 0; $i < $count; $i++) {
-            // 在庫のチェック
-            if($arrProductsClass[$i]['stock'] <= 0 && $arrProductsClass[$i]['stock_unlimited'] != '1') {
-                continue;
-            }
-
-            $stock_find = true;
-
-            // 規格1のセレクトボックス用
-            if($classcat_id1 != $arrProductsClass[$i]['classcategory_id1']){
-                $arrList[$list_id].=");\n";
-                $arrVal[$list_id].=");\n";
-                $classcat_id1 = $arrProductsClass[$i]['classcategory_id1'];
-                $arrSele[$classcat_id1] = $arrClassCatName[$classcat_id1];
-                $list_id++;
-            }
-
-            // 規格2のセレクトボックス用
-            $classcat_id2 = $arrProductsClass[$i]['classcategory_id2'];
-
-            // セレクトボックス表示値
-            if (!isset($arrList[$list_id])) $arrList[$list_id] = "";
-            if($arrList[$list_id] == "") {
-                $arrList[$list_id] = "\tlist".$list_id." = new Array('選択してください', '".$arrClassCatName[$classcat_id2]."'";
-            } else {
-                $arrList[$list_id].= ", '".$arrClassCatName[$classcat_id2]."'";
-            }
-
-            // セレクトボックスPOST値
-            if (!isset($arrVal[$list_id])) $arrVal[$list_id] = "";
-            if($arrVal[$list_id] == "") {
-                $arrVal[$list_id] = "\tval".$list_id." = new Array('', '".$classcat_id2."'";
-            } else {
-                $arrVal[$list_id].= ", '".$classcat_id2."'";
-            }
-        }
-
-        $arrList[$list_id].=");\n";
-        $arrVal[$list_id].=");\n";
-
-        // 規格1
-        $this->arrClassCat1 = $arrSele;
-
-        $lists = "\tlists = new Array(";
-        $no = 0;
-
-        foreach($arrList as $val) {
-            $this->tpl_javascript.= $val;
-            if ($no != 0) {
-                $lists.= ",list".$no;
-            } else {
-                $lists.= "list".$no;
-            }
-            $no++;
-        }
-        $this->tpl_javascript.=$lists.");\n";
-
-        $vals = "\tvals = new Array(";
-        $no = 0;
-
-        foreach($arrVal as $val) {
-            $this->tpl_javascript.= $val;
-            if ($no != 0) {
-                $vals.= ",val".$no;
-            } else {
-                $vals.= "val".$no;
-            }
-            $no++;
-        }
-        $this->tpl_javascript.=$vals.");\n";
-
-        // 選択されている規格2ID
-        if (!isset($_POST['classcategory_id2'])) $_POST['classcategory_id2'] = "";
-        $this->tpl_onload = "lnSetSelect('form1', 'classcategory_id1', 'classcategory_id2', '" . htmlspecialchars($_POST['classcategory_id2'], ENT_QUOTES) . "');";
-
-        // 規格1が設定されている
-        if($arrProductsClass[0]['classcategory_id1'] != '0') {
-            $classcat_find1 = true;
-        }
-
-        // 規格2が設定されている
-        if($arrProductsClass[0]['classcategory_id2'] != '0') {
-            $classcat_find2 = true;
-        }
-
-        $this->tpl_classcat_find1 = $classcat_find1;
-        $this->tpl_classcat_find2 = $classcat_find2;
-        $this->tpl_stock_find = $stock_find;
+    function lfMakeSelect() {
+
+        // 選択されている規格
+        $classcategory_id1
+            = isset($_POST['classcategory_id1']) && is_numeric($_POST['classcategory_id1'])
+            ? $_POST['classcategory_id1']
+            : '';
+
+        $classcategory_id2
+            = isset($_POST['classcategory_id2']) && is_numeric($_POST['classcategory_id2'])
+            ? $_POST['classcategory_id2']
+            : '';
+
+        require_once DATA_PATH . 'module/Services/JSON.php';
+        $this->js_lnOnload .= 'fnSetClassCategories('
+            . 'document.form1, '
+            . Services_JSON::encode($classcategory_id2)
+            . '); ';
     }
 
Index: /branches/comu-ver2/data/class/pages/products/LC_Page_Products_List.php
===================================================================
--- /branches/comu-ver2/data/class/pages/products/LC_Page_Products_List.php	(revision 18275)
+++ /branches/comu-ver2/data/class/pages/products/LC_Page_Products_List.php	(revision 18277)
@@ -103,9 +103,9 @@
         $count = $objQuery->count("dtb_best_products", "category_id = ?", array($this->arrSearchData['category_id']));
 
-        // 商品一覧の表示処理
+            // 商品一覧の表示処理
         $this->lfDispProductsList();
 
-        // 検索条件を画面に表示
-        // カテゴリー検索条件
+            // 検索条件を画面に表示
+            // カテゴリー検索条件
         if ($this->arrSearchData['category_id'] == 0) {
             $this->arrSearch['category'] = "指定なし";
@@ -113,19 +113,19 @@
             $arrCat = $conn->getOne("SELECT category_name FROM dtb_category WHERE category_id = ?", array($this->arrSearchData['category_id']));
             $this->arrSearch['category'] = $arrCat;
-        }
-
-        // メーカー検索条件
+            }
+
+            // メーカー検索条件
         if (strlen($this->arrSearchData['maker_id']) == 0) {
             $this->arrSearch['maker'] = "指定なし";
         } else {
             $this->arrSearch['maker'] = $name = $conn->getOne("SELECT name FROM dtb_maker WHERE maker_id = ?", $this->arrSearchData['maker_id']);
-        }
-
-        // 商品名検索条件
+            }
+
+            // 商品名検索条件
         if (strlen($this->arrSearchData['name']) == 0) {
             $this->arrSearch['name'] = "指定なし";
         } else {
             $this->arrSearch['name'] = $this->arrSearchData['name'];
-        }
+            }
 
         // レイアウトデザインを取得
@@ -133,4 +133,8 @@
         $layout->sfGetPageLayout($this, false, "products/list.php");
 
+        foreach ($this->arrProducts as $arrProduct) {
+            $js_fnOnLoad .= "fnSetClassCategories(document.product_form{$arrProduct['product_id']});\n";
+        }
+        
         if ($this->inCart) {
             // 商品IDの正当性チェック
@@ -144,18 +148,17 @@
                 $classcategory_id1 = $this->arrForm['classcategory_id1'];
                 $classcategory_id2 = $this->arrForm['classcategory_id2'];
-                // 規格1が設定されていない場合
+                    // 規格1が設定されていない場合
                 if (!$this->tpl_classcat_find1[$product_id]) {
-                    $classcategory_id1 = '0';
-                }
-                // 規格2が設定されていない場合
+                        $classcategory_id1 = '0';
+                    }
+                    // 規格2が設定されていない場合
                 if (!$this->tpl_classcat_find2[$product_id]) {
-                    $classcategory_id2 = '0';
-                }
+                        $classcategory_id2 = '0';
+                    }
                 $objCartSess = new SC_CartSession();
                 $objCartSess->addProduct(array($product_id, $classcategory_id1, $classcategory_id2), $this->arrForm['quantity']);
-                $this->sendRedirect($this->getLocation(URL_CART_TOP));
-                exit;
-            }
-            $this->tpl_onload .= "fnSetSelect(document.product_form{$product_id}, '{$this->arrForm['classcategory_id2']}');";
+                    $this->sendRedirect($this->getLocation(URL_CART_TOP));
+                    exit;
+            }
             foreach (array_keys($this->arrProducts) as $key) {
                 $arrProduct =& $this->arrProducts[$key];
@@ -165,7 +168,10 @@
                     $arrProduct['quantity'] = $this->arrForm['quantity'];
                     $arrProduct['arrErr'] = $arrErr;
+                    $js_fnOnLoad .= "fnSetClassCategories(document.product_form{$arrProduct['product_id']}, '{$this->arrForm['classcategory_id2']}');\n";
                 }
             }
         }
+        $this->tpl_javascript .= 'function fnOnLoad(){' . $js_fnOnLoad . '}';
+        $this->tpl_onload .= 'fnOnLoad(); ';
 
         $this->tpl_rnd = SC_Utils_Ex::sfGetRandomString(3);
@@ -214,22 +220,22 @@
         $count = $objQuery->count("dtb_best_products", "category_id = ?", array($this->arrSearchData['category_id']));
 
-        // 商品一覧の表示処理
+            // 商品一覧の表示処理
         $this->lfDispProductsList();
 
-        // 検索条件を画面に表示
-        // カテゴリー検索条件
+            // 検索条件を画面に表示
+            // カテゴリー検索条件
         if ($this->arrSearchData['category_id'] == 0) {
             $this->arrSearch['category'] = "指定なし";
         } else {
-            $arrCat = $conn->getOne("SELECT category_name FROM dtb_category WHERE category_id = ?",array($category_id));
+                $arrCat = $conn->getOne("SELECT category_name FROM dtb_category WHERE category_id = ?",array($category_id));
             $this->arrSearch['category'] = $arrCat;
-        }
-
-        // 商品名検索条件
+            }
+
+            // 商品名検索条件
         if ($this->arrForm['name'] === "") {
             $this->arrSearch['name'] = "指定なし";
-        } else {
+            } else {
             $this->arrSearch['name'] = $this->arrForm['name'];
-        }
+                    }
 
         // ページ送り機能用のURLを作成する。
@@ -287,9 +293,9 @@
         if (
             !SC_Utils_Ex::sfIsInt($category_id)
-            || SC_Utils_Ex::sfIsZeroFilling($category_id)
+                || SC_Utils_Ex::sfIsZeroFilling($category_id)
             || !$objDb->sfIsRecord('dtb_category', 'category_id', (array)$category_id, 'del_flg = 0')
         ) {
             SC_Utils_Ex::sfDispSiteError(CATEGORY_NOT_FOUND);
-        }
+    }
         
         // 指定されたカテゴリIDを元に正しいカテゴリIDを取得する。
@@ -468,154 +474,36 @@
         // ▲商品詳細取得
         
-        // 規格名一覧
-        $arrClassName = $objDb->sfGetIDValueList("dtb_class", "class_id", "name");
-        // 規格分類名一覧
-        $arrClassCatName = $objDb->sfGetIDValueList("dtb_classcategory", "classcategory_id", "name");
+        $arrProductId = array();
         // 規格セレクトボックス設定
-        for ($i = 0; $i < count($this->arrProducts); $i++) {
-            $this->lfMakeSelect($this->arrProducts[$i]['product_id'], $arrClassName, $arrClassCatName);
+        foreach ($this->arrProducts as $product) {
+            $arrProductId[] = $product['product_id'];
             // 購入制限数を取得
-            $this->lfGetSaleLimit($this->arrProducts[$i]);
-        }
-    }
-
-    /* 規格セレクトボックスの作成 */
-    function lfMakeSelect($product_id, $arrClassName, $arrClassCatName) {
-
-        $classcat_find1 = false;
-        $classcat_find2 = false;
-        // 在庫ありの商品の有無
-        $stock_find = false;
-
-        // 商品規格情報の取得
-        $arrProductsClass = $this->lfGetProductsClass($product_id);
-
-        // 規格1クラス名の取得
-        $this->tpl_class_name1[$product_id] =
-            isset($arrClassName[$arrProductsClass[0]['class_id1']])
-            ? $arrClassName[$arrProductsClass[0]['class_id1']]
-            : "";
-
-        // 規格2クラス名の取得
-        $this->tpl_class_name2[$product_id] =
-            isset($arrClassName[$arrProductsClass[0]['class_id2']])
-            ? $arrClassName[$arrProductsClass[0]['class_id2']]
-            : "";
-
-        // すべての組み合わせ数
-        $count = count($arrProductsClass);
-
-        $classcat_id1 = "";
-
-        $arrSele = array();
-        $arrList = array();
-
-        $list_id = 0;
-        $arrList[0] = "\tlist". $product_id. "_0 = new Array('選択してください'";
-        $arrVal[0] = "\tval". $product_id. "_0 = new Array(''";
-
-        for ($i = 0; $i < $count; $i++) {
-            // 在庫のチェック
-            if ($arrProductsClass[$i]['stock'] <= 0 && $arrProductsClass[$i]['stock_unlimited'] != '1') {
-                continue;
-            }
-
-            $stock_find = true;
-
-            // 規格1のセレクトボックス用
-            if ($classcat_id1 != $arrProductsClass[$i]['classcategory_id1']) {
-                $arrList[$list_id].=");\n";
-                $arrVal[$list_id].=");\n";
-                $classcat_id1 = $arrProductsClass[$i]['classcategory_id1'];
-                $arrSele[$classcat_id1] = $arrClassCatName[$classcat_id1];
-                $list_id++;
-
-                $arrList[$list_id] = "";
-                $arrVal[$list_id] = "";
-            }
-
-            // 規格2のセレクトボックス用
-            $classcat_id2 = $arrProductsClass[$i]['classcategory_id2'];
-
-            // セレクトボックス表示値
-            if ($arrList[$list_id] == "") {
-                $arrList[$list_id] = "\tlist". $product_id. "_". $list_id. " = new Array('選択してください', '". $arrClassCatName[$classcat_id2]. "'";
-            } else {
-                $arrList[$list_id].= ", '".$arrClassCatName[$classcat_id2]."'";
-            }
-
-            // セレクトボックスPOST値
-            if ($arrVal[$list_id] == "") {
-                $arrVal[$list_id] = "\tval". $product_id. "_". $list_id. " = new Array('', '". $classcat_id2. "'";
-            } else {
-                $arrVal[$list_id].= ", '".$classcat_id2."'";
-            }
-        }
-
-        $arrList[$list_id].=");\n";
-        $arrVal[$list_id].=");\n";
-
+            $this->lfGetSaleLimit($product);
+        }
+        
+        require_once CLASS_PATH . 'SC_Product.php';
+        $objProduct = new SC_Product($arrProductId);
+        
+        // 規格1クラス名
+        $this->tpl_class_name1 = $objProduct->className1;
+
+        // 規格2クラス名
+        $this->tpl_class_name2 = $objProduct->className2;
+        
         // 規格1
-        $this->arrClassCat1[$product_id] = $arrSele;
-
-        $lists = "\tlists".$product_id. " = new Array(";
-        $no = 0;
-        foreach($arrList as $val) {
-            $this->tpl_javascript.= $val;
-            if ($no != 0) {
-                $lists.= ",list". $product_id. "_". $no;
-            } else {
-                $lists.= "list". $product_id. "_". $no;
-            }
-            $no++;
-        }
-        $this->tpl_javascript.= $lists.");\n";
-
-        $vals = "\tvals".$product_id. " = new Array(";
-        $no = 0;
-        foreach($arrVal as $val) {
-            $this->tpl_javascript.= $val;
-            if ($no != 0) {
-                $vals.= ",val". $product_id. "_". $no;
-            } else {
-                $vals.= "val". $product_id. "_". $no;
-            }
-            $no++;
-        }
-        $this->tpl_javascript.= $vals.");\n";
-
-        // 選択されている規格2ID
-        if (!isset($this->arrForm['classcategory_id2']) || !is_numeric($this->arrForm['classcategory_id2'])) {
-            $this->arrForm['classcategory_id2'] = '';
-        }
-        
+        $this->arrClassCat1 = $objProduct->classCats1;
+
         // 規格1が設定されている
-        if ($arrProductsClass[0]['classcategory_id1'] != '0') {
-            $classcat_find1 = true;
-        }
-
+        $this->tpl_classcat_find1 = $objProduct->classCat1_find;
         // 規格2が設定されている
-        if ($arrProductsClass[0]['classcategory_id2'] != '0') {
-            $classcat_find2 = true;
-        }
-
-        $this->tpl_classcat_find1[$product_id] = $classcat_find1;
-        $this->tpl_classcat_find2[$product_id] = $classcat_find2;
-        $this->tpl_stock_find[$product_id] = $stock_find;
-    }
-
-    /* 商品規格情報の取得 */
-    function lfGetProductsClass($product_id) {
-        $arrRet = array();
-        if (SC_Utils_Ex::sfIsInt($product_id)) {
-            // 商品規格取得
-            $objQuery = new SC_Query();
-            $col = "product_class_id, classcategory_id1, classcategory_id2, class_id1, class_id2, stock, stock_unlimited";
-            $table = "vw_product_class AS prdcls";
-            $where = "product_id = ?";
-            $objQuery->setorder("rank1 DESC, rank2 DESC");
-            $arrRet = $objQuery->select($col, $table, $where, array($product_id));
-        }
-        return $arrRet;
+        $this->tpl_classcat_find2 = $objProduct->classCat2_find;
+
+        $this->tpl_stock_find = $objProduct->stock_find;
+
+        $productsClassCategories = $objProduct->classCategories;
+        
+        require_once DATA_PATH . 'module/Services/JSON.php';
+        $objJson = new Services_JSON();
+        $this->tpl_javascript .= 'productsClassCategories = ' . $objJson->encode($productsClassCategories) . '; ';
     }
 
@@ -639,4 +527,5 @@
 
     // 購入制限数の設定
+    // XXX 標準実装では「tpl_sale_limit」は利用されていないようである。カスタマイズ用?
     function lfGetSaleLimit($arrProduct) {
         //在庫が無限または購入制限値が設定値より大きい場合
@@ -670,8 +559,8 @@
             //最小表示件数を選択
             $this->disp_number = current(array_keys($this->arrPRODUCTLISTMAX));
-        }
+    }
         $this->tpl_pageno = $this->arrForm['pageno'];
         $this->inCart = strlen($this->arrForm['product_id']) >= 1;
-    }
+            }
 }
 ?>
Index: /branches/comu-ver2/data/class/SC_Product.php
===================================================================
--- /branches/comu-ver2/data/class/SC_Product.php	(revision 18277)
+++ /branches/comu-ver2/data/class/SC_Product.php	(revision 18277)
@@ -0,0 +1,160 @@
+<?php
+/*
+ * This file is part of EC-CUBE
+ *
+ * Copyright(c) 2000-2007 LOCKON CO.,LTD. All Rights Reserved.
+ *
+ * http://www.lockon.co.jp/
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
+ */
+
+/*  [名称] SC_Product
+ *  [概要] 商品クラス
+ */
+class SC_Product {
+
+    /** 規格名一覧 */
+    var $arrClassName;
+    /** 規格分類名一覧 */
+    var $arrClassCatName;
+    var $classCategories = array();
+    var $stock_find;
+    /** 規格1クラス名 */
+    var $className1 = '';
+    /** 規格2クラス名 */
+    var $className2 = '';
+    /** 規格1が設定されている */
+    var $classCat1_find;
+    /** 規格2が設定されている */
+    var $classCat2_find;
+    var $classCats1;
+    
+    function SC_Product($arrProductId = null) {
+        $objDb = new SC_Helper_DB_Ex();
+        
+        // 規格名一覧
+        $this->arrClassName = $objDb->sfGetIDValueList("dtb_class", "class_id", "name");
+        // 規格分類名一覧
+        $this->arrClassCatName = $objDb->sfGetIDValueList("dtb_classcategory", "classcategory_id", "name");
+        $this->arrClassCatName[''] = '選択してください';
+        
+        if (!is_null($arrProductId)) {
+            $this->setProductId($arrProductId);
+        }
+    }
+
+    function setProductId($arrProductId) {
+        
+        // 商品規格情報の取得
+        $rows = $this->lfGetProductsClass($arrProductId);
+        
+        $arrProductsClass = array();
+        foreach ($rows as $row) {
+            $productId = $row['product_id'];
+            $arrProductsClass[$productId][] = $row;
+        }
+        unset($rows);
+        
+        foreach ($arrProductsClass as $productId => $arrProductClass) {
+            $classCats1 = array();
+            $classCats1[''] = '選択してください';
+            
+            // 規格1クラス名
+            $this->className1[$productId] =
+                isset($this->arrClassName[$arrProductClass[0]['class_id1']])
+                ? $this->arrClassName[$arrProductClass[0]['class_id1']]
+                : '';
+
+            // 規格2クラス名
+            $this->className2[$productId] =
+                isset($this->arrClassName[$arrProductClass[0]['class_id2']])
+                ? $this->arrClassName[$arrProductClass[0]['class_id2']]
+                : '';
+            
+            // 規格1が設定されている
+            $this->classCat1_find[$productId] = ($arrProductClass[0]['classcategory_id1'] != '0');
+            // 規格2が設定されている
+            $this->classCat2_find[$productId] = ($arrProductClass[0]['classcategory_id2'] != '0');
+
+            $this->stock_find[$productId] = false;
+            $classCategories = array();
+            $classCategories['']['']['name'] = '選択してください';
+            foreach ($arrProductClass as $productsClass) {
+                $productsClass1 = $productsClass['classcategory_id1'];
+                $productsClass2 = $productsClass['classcategory_id2'];
+                $classCategories[$productsClass1]['']['name'] = '選択してください';
+
+                // 在庫
+                $stock_find_class = ($productsClass['stock_unlimited'] || $productsClass['stock'] > 0);
+                
+                $classCategories[$productsClass1][$productsClass2]['name'] = $this->arrClassCatName[$productsClass2]
+                    . ($stock_find_class ? '' : ' (品切れ中)');
+                
+                $classCategories[$productsClass1][$productsClass2]['stock_find'] = $stock_find_class;
+                
+                if ($stock_find_class) {
+                    $this->stock_find[$productId] = true;
+                }
+
+                if (!in_array($classcat_id1, $classCats1)) {
+                    $classCats1[$productsClass1] = $this->arrClassCatName[$productsClass1]
+                        . ($productsClass2 == 0 && !$stock_find_class ? ' (品切れ中)' : '');
+                }
+                
+                // 価格
+                $classCategories[$productsClass1][$productsClass2]['price01']
+                    = strlen($productsClass['price01'])
+                    ? number_format(SC_Helper_DB_Ex::sfPreTax($productsClass['price01']))
+                    : '';
+                
+                $classCategories[$productsClass1][$productsClass2]['price02']
+                    = strlen($productsClass['price02'])
+                    ? number_format(SC_Helper_DB_Ex::sfPreTax($productsClass['price02']))
+                    : '';
+                
+                // ポイント
+                // XXX sfPrePoint() の第4パラメータは、処理にバグがあるため現状省略している。(http://xoops.ec-cube.net/modules/newbb/viewtopic.php?topic_id=3540&forum=1&post_id=13853#forumpost13853)
+                $classCategories[$productsClass1][$productsClass2]['point']
+                    = SC_Utils_Ex::sfPrePoint($productsClass['price02'], $productsClass['point_rate']);
+            }
+            
+            $this->classCategories[$productId] = $classCategories;
+            
+            // 規格1
+            $this->classCats1[$productId] = $classCats1;
+        }
+    }
+
+    /* 商品規格情報の取得 */
+    function lfGetProductsClass($arrProductId) {
+        $arrProductId = (Array) $arrProductId;
+        
+        if (empty($arrProductId)) {
+            return array();
+        }
+        
+        // 商品規格取得
+        $objQuery = new SC_Query();
+        $col = "product_id, classcategory_id1, classcategory_id2, class_id1, class_id2, stock, stock_unlimited, price01, price02, point_rate";
+        $table = "vw_product_class AS prdcls";
+        $where = 'product_id IN (' . implode(', ', array_pad(array(), count($arrProductId), '?')) . ')';
+        $objQuery->setorder("product_id, rank1 DESC, rank2 DESC");
+        $arrRet = $objQuery->select($col, $table, $where, $arrProductId);
+        
+        return $arrRet;
+    }
+}
+?>
Index: /branches/comu-ver2/data/Smarty/templates/default/detail.tpl
===================================================================
--- /branches/comu-ver2/data/Smarty/templates/default/detail.tpl	(revision 18254)
+++ /branches/comu-ver2/data/Smarty/templates/default/detail.tpl	(revision 18277)
@@ -21,27 +21,93 @@
  *}-->
 <script type="text/javascript">//<![CDATA[
-// セレクトボックスに項目を割り当てる。
-function lnSetSelect(form, name1, name2, val) {
-
-    sele11 = document[form][name1];
-    sele12 = document[form][name2];
-
-    if(sele11 && sele12) {
-        index = sele11.selectedIndex;
-
-        // セレクトボックスのクリア
-        count = sele12.options.length;
-        for(i = count; i >= 0; i--) {
-            sele12.options[i] = null;
-        }
-
-        // セレクトボックスに値を割り当てる
-        len = lists[index].length;
-        for(i = 0; i < len; i++) {
-            sele12.options[i] = new Option(lists[index][i], vals[index][i]);
-            if(val != "" && vals[index][i] == val) {
-                sele12.options[i].selected = true;
+// 規格2に選択肢を割り当てる。
+function fnSetClassCategories(form, classcat_id2_selected) {
+    sele1 = form.classcategory_id1;
+    sele2 = form.classcategory_id2;
+
+    if (sele1) {
+        if (sele2) {
+            // 規格2の選択肢をクリア
+            count = sele2.options.length;
+            for(i = count; i >= 0; i--) {
+                sele2.options[i] = null;
+            }
+            
+            // 規格2に選択肢を割り当てる
+            classcats = classCategories[sele1.value];
+            i = 0;
+            for (var classcat_id2_key in classcats) {
+                sele2.options[i] = new Option(classcats[classcat_id2_key].name, classcat_id2_key);
+                if (classcat_id2_key == classcat_id2_selected) {
+                    sele2.options[i].selected = true;
+                }
+                i++;
             }
         }
+        fnCheckStock(form);
+    }
+}
+function fnCheckStock(form) {
+    classcat_id1 = form.classcategory_id1.value;
+    classcat_id2 = form.classcategory_id2 ? form.classcategory_id2.value : 0;
+    classcat2 = classCategories[classcat_id1][classcat_id2];
+    
+    // 在庫(品切れ)
+    eleDefault = document.getElementById('cartbtn_default');
+    eleDynamic = document.getElementById('cartbtn_dynamic');
+    if (
+           classcat2
+        && classcat2.stock_find === false
+    ) {
+        eleDefault.style.display = 'none';
+        eleDynamic.innerHTML = '申し訳ございませんが、只今品切れ中です。';
+    } else {
+        eleDefault.style.display = '';
+        eleDynamic.innerHTML = '';
+    }
+    
+    // 通常価格
+    eleDefault = document.getElementById('price01_default');
+    eleDynamic = document.getElementById('price01_dynamic');
+    if (
+           classcat2
+        && typeof classcat2.price01 != 'undefined'
+        && String(classcat2.price01).length >= 1
+    ) {
+        eleDefault.style.display = 'none';
+        eleDynamic.innerHTML = classcat2.price01;
+    } else {
+        eleDefault.style.display = '';
+        eleDynamic.innerHTML = '';
+    }
+    
+    // 販売価格
+    eleDefault = document.getElementById('price02_default');
+    eleDynamic = document.getElementById('price02_dynamic');
+    if (
+           classcat2
+        && typeof classcat2.price02 != 'undefined'
+        && String(classcat2.price02).length >= 1
+    ) {
+        eleDefault.style.display = 'none';
+        eleDynamic.innerHTML = classcat2.price02;
+    } else {
+        eleDefault.style.display = '';
+        eleDynamic.innerHTML = '';
+    }
+    
+    // ポイント
+    eleDefault = document.getElementById('point_default');
+    eleDynamic = document.getElementById('point_dynamic');
+    if (
+           classcat2
+        && typeof classcat2.point != 'undefined'
+        && String(classcat2.point).length >= 1
+    ) {
+        eleDefault.style.display = 'none';
+        eleDynamic.innerHTML = classcat2.point;
+    } else {
+        eleDefault.style.display = '';
+        eleDynamic.innerHTML = '';
     }
 }
@@ -77,5 +143,5 @@
 
         <div id="detailrightblock">
-            <!--アイコン-->
+            <!--▼商品ステータス-->
             <!--{if count($arrProduct.product_flag) > 0}-->
                 <ul class="status_icon">
@@ -90,4 +156,5 @@
                 </ul>
             <!--{/if}-->
+            <!--▲商品ステータス-->
 
             <!--★商品コード★-->
@@ -108,9 +175,14 @@
             <div class="sale_price"><!--{$smarty.const.SALE_PRICE_TITLE}--><span class="mini">(税込)</span>：
                 <span class="price">
-                    <!--{if $arrProduct.price02_min == $arrProduct.price02_max}-->
-                        <!--{$arrProduct.price02_min|sfPreTax:$arrSiteInfo.tax:$arrSiteInfo.tax_rule|number_format}-->
-                    <!--{else}-->
-                        <!--{$arrProduct.price02_min|sfPreTax:$arrSiteInfo.tax:$arrSiteInfo.tax_rule|number_format}-->～<!--{$arrProduct.price02_max|sfPreTax:$arrSiteInfo.tax:$arrSiteInfo.tax_rule|number_format}-->
-                    <!--{/if}-->円</span></div>
+                    <span id="price02_default">
+                        <!--{if $arrProduct.price02_min == $arrProduct.price02_max}-->
+                            <!--{$arrProduct.price02_min|sfPreTax:$arrSiteInfo.tax:$arrSiteInfo.tax_rule|number_format}-->
+                        <!--{else}-->
+                            <!--{$arrProduct.price02_min|sfPreTax:$arrSiteInfo.tax:$arrSiteInfo.tax_rule|number_format}-->～<!--{$arrProduct.price02_max|sfPreTax:$arrSiteInfo.tax:$arrSiteInfo.tax_rule|number_format}-->
+                        <!--{/if}-->
+                    </span><span id="price02_dynamic"></span>
+                    円
+                </span>
+            </div>
             
             <!--★通常価格★-->
@@ -119,9 +191,13 @@
                     <!--{$smarty.const.NORMAL_PRICE_TITLE}-->：
                     <span class="price">
-                        <!--{if $arrProduct.price01_min == $arrProduct.price01_max}-->
-                            <!--{$arrProduct.price01_min|number_format}-->
-                        <!--{else}-->
-                            <!--{$arrProduct.price01_min|number_format}-->～<!--{$arrProduct.price01_max|number_format}-->
-                        <!--{/if}-->円</span>
+                        <span id="price01_default">
+                            <!--{if $arrProduct.price01_min == $arrProduct.price01_max}-->
+                                <!--{$arrProduct.price01_min|number_format}-->
+                            <!--{else}-->
+                                <!--{$arrProduct.price01_min|number_format}-->～<!--{$arrProduct.price01_max|number_format}-->
+                            <!--{/if}-->
+                        </span><span id="price01_dynamic"></span>
+                        円
+                    </span>
                 </div>
             <!--{/if}-->
@@ -130,13 +206,18 @@
             <!--{if $smarty.const.USE_POINT !== false}-->
                 <div><span class="price">ポイント：
-                    <!--{if $arrProduct.price02_min == $arrProduct.price02_max}-->
-                        <!--{$arrProduct.price02_min|sfPrePoint:$arrProduct.point_rate:$smarty.const.POINT_RULE:$arrProduct.product_id}-->
-                    <!--{else}-->
-                        <!--{if $arrProduct.price02_min|sfPrePoint:$arrProduct.point_rate:$smarty.const.POINT_RULE:$arrProduct.product_id == $arrProduct.price02_max|sfPrePoint:$arrProduct.point_rate:$smarty.const.POINT_RULE:$arrProduct.product_id}-->
+                    <span id="point_default">
+                        <!--{if $arrProduct.price02_min == $arrProduct.price02_max}-->
                             <!--{$arrProduct.price02_min|sfPrePoint:$arrProduct.point_rate:$smarty.const.POINT_RULE:$arrProduct.product_id}-->
                         <!--{else}-->
-                            <!--{$arrProduct.price02_min|sfPrePoint:$arrProduct.point_rate:$smarty.const.POINT_RULE:$arrProduct.product_id}-->～<!--{$arrProduct.price02_max|sfPrePoint:$arrProduct.point_rate:$smarty.const.POINT_RULE:$arrProduct.product_id}-->
-                        <!--{/if}-->
-                    <!--{/if}-->Pt</span></div>
+                            <!--{if $arrProduct.price02_min|sfPrePoint:$arrProduct.point_rate:$smarty.const.POINT_RULE:$arrProduct.product_id == $arrProduct.price02_max|sfPrePoint:$arrProduct.point_rate:$smarty.const.POINT_RULE:$arrProduct.product_id}-->
+                                <!--{$arrProduct.price02_min|sfPrePoint:$arrProduct.point_rate:$smarty.const.POINT_RULE:$arrProduct.product_id}-->
+                            <!--{else}-->
+                                <!--{$arrProduct.price02_min|sfPrePoint:$arrProduct.point_rate:$smarty.const.POINT_RULE:$arrProduct.product_id}-->～<!--{$arrProduct.price02_max|sfPrePoint:$arrProduct.point_rate:$smarty.const.POINT_RULE:$arrProduct.product_id}-->
+                            <!--{/if}-->
+                        <!--{/if}-->
+                        </span><span id="point_dynamic"></span>
+                        Pt
+                    </span>
+                </div>
             <!--{/if}-->
 
@@ -153,58 +234,58 @@
             </div>
 
-
-            <form name="form1" id="form1" method="post" action="<!--{$smarty.server.REQUEST_URI|escape}-->">
+            <!--▼買い物かご-->
+            <form name="form1" id="form1" method="post" action="?">
                 <input type="hidden" name="mode" value="cart" />
                 <input type="hidden" name="product_id" value="<!--{$tpl_product_id}-->" />
                 <input type="hidden" name="favorite_product_id" value="" />
-                <!--{if $tpl_classcat_find1}-->
-                <dl>
-                    <dt>
-                        <!--{$tpl_class_name1}-->
-                    </dt>
-                    <dd>
-                        <select name="classcategory_id1"
-                            style="<!--{$arrErr.classcategory_id1|sfGetErrorColor}-->"
-                            onchange="lnSetSelect('form1', 'classcategory_id1', 'classcategory_id2', ''); "
-                        >
-                            <option value="">選択してください</option>
-                            <!--{html_options options=$arrClassCat1 selected=$arrForm.classcategory_id1.value}-->
-                        </select>
-                        <!--{if $arrErr.classcategory_id1 != ""}-->
-                        <br /><span class="attention">※ <!--{$tpl_class_name1}-->を入力して下さい。</span>
-                    <!--{/if}-->
-                    </dd>
-                </dl>
+                
+                <!--{if $tpl_stock_find}-->
+                    <dl>
+                        <!--{if $tpl_classcat_find1}-->
+                            <!--▼規格1-->
+                            <dt><!--{$tpl_class_name1|escape}--></dt>
+                            <dd>
+                                <select name="classcategory_id1"
+                                    style="<!--{$arrErr.classcategory_id1|sfGetErrorColor}-->"
+                                    onchange="fnSetClassCategories(this.form);"
+                                >
+                                    <!--{html_options options=$arrClassCat1 selected=$arrForm.classcategory_id1.value}-->
+                                </select>
+                                <!--{if $arrErr.classcategory_id1 != ""}-->
+                                    <br /><span class="attention">※ <!--{$tpl_class_name1}-->を入力して下さい。</span>
+                                <!--{/if}-->
+                            </dd>
+                            <!--▲規格1-->
+                        <!--{/if}-->
+    
+                        <!--{if $tpl_classcat_find2}-->
+                            <!--▼規格2-->
+                            <dt><!--{$tpl_class_name2|escape}--></dt>
+                            <dd>
+                                <select name="classcategory_id2"
+                                    style="<!--{$arrErr.classcategory_id2|sfGetErrorColor}-->"
+                                    onchange="fnCheckStock(this.form);"
+                                >
+                                </select>
+                                <!--{if $arrErr.classcategory_id2 != ""}-->
+                                    <br /><span class="attention">※ <!--{$tpl_class_name2}-->を入力して下さい。</span>
+                                <!--{/if}-->
+                            </dd>
+                            <!--▲規格2-->
+                        <!--{/if}-->
+
+                        <dt>数量</dt>
+                        <dd>
+                            <input type="text" name="quantity" class="box54" value="<!--{$arrForm.quantity.value|default:1}-->" maxlength="<!--{$smarty.const.INT_LEN}-->" style="<!--{$arrErr.quantity|sfGetErrorColor}-->" />
+                            <!--{if $arrErr.quantity != ""}-->
+                                <br /><span class="attention"><!--{$arrErr.quantity}--></span>
+                            <!--{/if}-->
+                        </dd>
+                    </dl>
                 <!--{/if}-->
-
-                <!--{if $tpl_stock_find}-->
-                    <!--{if $tpl_classcat_find2}-->
-                <dl>
-                    <dt><!--{$tpl_class_name2}--></dt>
-                    <dd>
-                        <select name="classcategory_id2"
-                                        style="<!--{$arrErr.classcategory_id2|sfGetErrorColor}-->">
-                            <option value="">選択してください</option>
-                        </select>
-                        <!--{if $arrErr.classcategory_id2 != ""}-->
-                            <br /><span class="attention">※ <!--{$tpl_class_name2}-->を入力して下さい。</span>
-                        <!--{/if}-->
-                    </dd>
-                </dl>
-                    <!--{/if}-->
-
-                <dl>
-                    <dt>数量</dt>
-                    <dd><input type="text" name="quantity" class="box54" value="<!--{$arrForm.quantity.value|default:1}-->" maxlength="<!--{$smarty.const.INT_LEN}-->" style="<!--{$arrErr.quantity|sfGetErrorColor}-->" />
-                     <!--{if $arrErr.quantity != ""}-->
-                     <br /><span class="attention"><!--{$arrErr.quantity}--></span>
-                     <!--{/if}-->
-                    </dd>
-                </dl>
-                <!--{/if}-->
-
-                <!--{if $tpl_stock_find}-->
-                    <p class="btn">
-                        <!--{if $smarty.const.OPTION_FAVOFITE_PRODUCT == 1 && $tpl_login === true}-->
+                
+                <div class="btn">
+                    <!--{if $smarty.const.OPTION_FAVOFITE_PRODUCT == 1 && $tpl_login === true}-->
+                        <div>
                             <!--{assign var=add_favorite value="add_favorite`$product_id`"}-->
                             <!--{if $arrErr[$add_favorite]}--><div class="attention"><!--{$arrErr[$add_favorite]}--></div><!--{/if}-->
@@ -218,16 +299,25 @@
                                 <img src="<!--{$TPL_DIR}-->img/products/add_favolite_product_on.gif" width="115" height="20" alt="お気に入り登録済" name="add_favolite_product" id="add_favolite_product" />
                             <!--{/if}-->
-                        <!--{/if}-->
-                        <!--★カゴに入れる★-->
-                        <a href="javascript:void(document.form1.submit())" onmouseover="chgImg('<!--{$TPL_DIR}-->img/products/b_cartin_on.gif','cart');" onmouseout="chgImg('<!--{$TPL_DIR}-->img/products/b_cartin.gif','cart');">
-                            <img src="<!--{$TPL_DIR}-->img/products/b_cartin.gif" width="115" height="25" alt="カゴに入れる" name="cart" id="cart" /></a>
-                    </p>
-                    <!--{if 'sfGMODetailDisplay'|function_exists}--><!--{* GMOワンクリック *}-->
-                        <!--{'sfGMODetailDisplay'|call_user_func}-->
+                        </div>
                     <!--{/if}-->
-                <!--{else}-->
-                <div class="attention">申し訳ございませんが、只今品切れ中です。</div>
-                <!--{/if}-->
+                    
+                    <!--{if $tpl_stock_find}-->
+                        <div id="cartbtn_default">
+                            <!--★カゴに入れる★-->
+                            <div>
+                                <a href="javascript:void(document.form1.submit())" onmouseover="chgImg('<!--{$TPL_DIR}-->img/products/b_cartin_on.gif','cart');" onmouseout="chgImg('<!--{$TPL_DIR}-->img/products/b_cartin.gif','cart');">
+                                    <img src="<!--{$TPL_DIR}-->img/products/b_cartin.gif" width="115" height="25" alt="カゴに入れる" name="cart" id="cart" /></a>
+                            </div>
+                            <!--{if 'sfGMODetailDisplay'|function_exists}--><!--{* GMOワンクリック *}-->
+                                <!--{'sfGMODetailDisplay'|call_user_func}-->
+                            <!--{/if}-->
+                        </div>
+                        <div class="attention" id="cartbtn_dynamic"></div>
+                    <!--{else}-->
+                        <div class="attention">申し訳ございませんが、只今品切れ中です。</div>
+                    <!--{/if}-->
+                </div>
             </form>
+            <!--▲買い物かご-->
 
         </div>
@@ -255,11 +345,11 @@
                     <div class="subphotoimg">
                         <a
-                            <!--{if $arrFile[$lkey].filepath != ""}-->
+                        <!--{if $arrFile[$lkey].filepath != ""}-->
                                 href="?"
                                 onclick="win01('./detail_image.php?product_id=<!--{$arrProduct.product_id}-->&amp;image=<!--{$lkey}--><!--{if $smarty.get.admin == 'on'}-->&amp;admin=on<!--{/if}-->','detail_image','<!--{$arrFile[$lkey].width+60}-->','<!--{$arrFile[$lkey].height+80}-->'); return false;"
                                 target="_blank"
-                            <!--{/if}-->
+                        <!--{/if}-->
                         >
-                            <!--サブ画像-->
+                        <!--サブ画像-->
                             <img src="<!--{$arrFile[$key].filepath}-->" alt="<!--{$arrProduct.name|escape}-->" width="<!--{$smarty.const.NORMAL_SUBIMAGE_WIDTH}-->" height="<!--{$smarty.const.NORMAL_SUBIMAGE_HEIGHT}-->" /></a>
                         <!--{if $arrFile[$lkey].filepath != ""}-->
Index: /branches/comu-ver2/data/Smarty/templates/default/list.tpl
===================================================================
--- /branches/comu-ver2/data/Smarty/templates/default/list.tpl	(revision 18260)
+++ /branches/comu-ver2/data/Smarty/templates/default/list.tpl	(revision 18277)
@@ -21,29 +21,30 @@
  *}-->
 <script type="text/javascript">//<![CDATA[
-// セレクトボックスに項目を割り当てる。
-function fnSetSelect(form, val) {
-    sele1 = form['classcategory_id1'];
-    sele2 = form['classcategory_id2'];
-    id = form['product_id'].value;
-    lists = eval('lists' + id);
-    vals = eval('vals' + id);
-
-    if(sele1 && sele2) {
-        index = sele1.selectedIndex;
-
-        // セレクトボックスのクリア
-        count = sele2.options.length;
-        for(i = count; i >= 0; i--) {
-            sele2.options[i] = null;
-        }
-
-        // セレクトボックスに値を割り当てる
-        len = lists[index].length;
-        for(i = 0; i < len; i++) {
-            sele2.options[i] = new Option(lists[index][i], vals[index][i]);
-            if(val != "" && vals[index][i] == val) {
-                sele2.options[i].selected = true;
+// 規格2に選択肢を割り当てる。
+function fnSetClassCategories(form, classcat_id2_selected) {
+    sele1 = form.classcategory_id1;
+    sele2 = form.classcategory_id2;
+    product_id = form.product_id.value;
+
+    if (sele1) {
+        if (sele2) {
+            // 規格2の選択肢をクリア
+            count = sele2.options.length;
+            for(i = count; i >= 0; i--) {
+                sele2.options[i] = null;
+            }
+            
+            // 規格2に選択肢を割り当てる
+            classcats = productsClassCategories[product_id][sele1.value];
+            i = 0;
+            for (var classcat_id2_key in classcats) {
+                sele2.options[i] = new Option(classcats[classcat_id2_key].name, classcat_id2_key);
+                if (classcat_id2_key == classcat_id2_selected) {
+                    sele2.options[i].selected = true;
+                }
+                i++;
             }
         }
+        fnCheckStock(form);
     }
 }
@@ -73,4 +74,39 @@
     fnSetVal("product_id", productForm["product_id"].value);
     fnSubmit();
+}
+function fnCheckStock(form) {
+    product_id = form.product_id.value;
+    classcat_id1 = form.classcategory_id1.value;
+    classcat_id2 = form.classcategory_id2 ? form.classcategory_id2.value : 0;
+    classcat2 = productsClassCategories[product_id][classcat_id1][classcat_id2];
+    
+    // 在庫(品切れ)
+    eleDefault = document.getElementById('cartbtn_default_' + product_id);
+    eleDynamic = document.getElementById('cartbtn_dynamic_' + product_id);
+    if (
+           classcat2
+        && classcat2.stock_find === false
+    ) {
+        eleDefault.style.display = 'none';
+        eleDynamic.innerHTML = '申し訳ございませんが、只今品切れ中です。';
+    } else {
+        eleDefault.style.display = '';
+        eleDynamic.innerHTML = '';
+    }
+    
+    // 販売価格
+    eleDefault = document.getElementById('price02_default_' + product_id);
+    eleDynamic = document.getElementById('price02_dynamic_' + product_id);
+    if (
+           classcat2
+        && typeof classcat2.price02 != 'undefined'
+        && String(classcat2.price02).length >= 1
+    ) {
+        eleDefault.style.display = 'none';
+        eleDynamic.innerHTML = classcat2.price02;
+    } else {
+        eleDefault.style.display = '';
+        eleDynamic.innerHTML = '';
+    }
 }
 //]]>
@@ -107,5 +143,5 @@
         <ul class="pagecondarea">
             <li><strong>商品カテゴリ：</strong><!--{$arrSearch.category|escape}--></li>
-            <!--{if $arrSearch.maker|strlen >= 1}--><li><strong>メーカー：</strong><!--{$arrSearch.maker|escape}--></li><!--{/if}-->
+        <!--{if $arrSearch.maker|strlen >= 1}--><li><strong>メーカー：</strong><!--{$arrSearch.maker|escape}--></li><!--{/if}-->
             <li><strong>商品名：</strong><!--{$arrSearch.name|escape}--></li>
         </ul>
@@ -126,5 +162,5 @@
                     <!--{/if}-->&nbsp;
                     <!--{if $orderby != "date"}-->
-                        <a href="javascript:fnChangeOrderby('date');">新着順</a>
+                            <a href="javascript:fnChangeOrderby('date');">新着順</a>
                     <!--{else}-->
                         <strong>新着順</strong>
@@ -134,7 +170,7 @@
                         <!--{foreach from=$arrPRODUCTLISTMAX item="dispnum" key="num"}-->
                             <!--{if $num == $disp_number}-->
-                                <option value="<!--{$num}-->" selected="selected" ><!--{$dispnum}--></option>
+                            <option value="<!--{$num}-->" selected="selected" ><!--{$dispnum}--></option>
                             <!--{else}-->
-                                <option value="<!--{$num}-->" ><!--{$dispnum}--></option>
+                            <option value="<!--{$num}-->" ><!--{$dispnum}--></option>
                             <!--{/if}-->
                         <!--{/foreach}-->
@@ -150,32 +186,32 @@
     <!--{foreach from=$arrProducts item=arrProduct}-->
         <!--{assign var=id value=$arrProduct.product_id}-->
+        <!--{assign var=arrErr value=$arrProduct.arrErr}-->
         <!--▼商品-->
         <div class="listarea">
-            <a name="product<!--{$id|escape}-->" />
+        <a name="product<!--{$id|escape}-->" />
             <div class="listphoto">
                 <!--★画像★-->
-                <a href="<!--{$smarty.const.DETAIL_P_HTML}--><!--{$arrProduct.product_id}-->" class="over"><!--商品写真--><img src="<!--{$smarty.const.IMAGE_SAVE_URL|sfTrimURL}-->/<!--{$arrProduct.main_list_image|sfNoImageMainList|escape}-->" alt="<!--{$arrProduct.name|escape}-->" class="picture" /></a>
+            <a href="<!--{$smarty.const.DETAIL_P_HTML}--><!--{$arrProduct.product_id}-->" class="over"><!--商品写真--><img src="<!--{$smarty.const.IMAGE_SAVE_URL|sfTrimURL}-->/<!--{$arrProduct.main_list_image|sfNoImageMainList|escape}-->" alt="<!--{$arrProduct.name|escape}-->" class="picture" /></a>
             </div>
             
             <div class="listrightblock">
-                <!--アイコン-->
-                <!--商品ステータス-->
+                <!--▼商品ステータス-->
                 <!--{if count($arrProduct.product_flag) > 0}-->
                     <ul class="status_icon">
                         <!--{section name=flg loop=$arrProduct.product_flag|count_characters}-->
                             <!--{if $arrProduct.product_flag[flg] == "1"}-->
-                                <!--{assign var=key value="`$smarty.section.flg.iteration`"}-->
-                                <li><img src="<!--{$TPL_DIR}--><!--{$arrSTATUS_IMAGE[$key]}-->" width="65" height="17" alt="<!--{$arrSTATUS[$key]}-->"/></li>
-                                <!--{assign var=sts_cnt value=$sts_cnt+1}-->
+                                <li>
+                                    <!--{assign var=key value="`$smarty.section.flg.iteration`"}-->
+                                    <img src="<!--{$TPL_DIR}--><!--{$arrSTATUS_IMAGE[$key]}-->" width="65" height="17" alt="<!--{$arrSTATUS[$key]}-->"/>
+                                </li>
                             <!--{/if}-->
                         <!--{/section}-->
                     </ul>
                 <!--{/if}-->
-                <!--商品ステータス-->
-                <!--アイコン-->
+                <!--▲商品ステータス-->
                 
                 <!--★商品名★-->
                 <h3>
-                    <a href="<!--{$smarty.const.DETAIL_P_HTML}--><!--{$arrProduct.product_id}-->"><!--{$arrProduct.name|escape}--></a>
+                    <a href="<!--{$smarty.const.DETAIL_P_HTML}--><!--{$arrProduct.product_id}-->" name="product<!--{$arrProduct.product_id}-->"><!--{$arrProduct.name|escape}--></a>
                 </h3>
                 
@@ -187,74 +223,89 @@
                         <!--{$smarty.const.SALE_PRICE_TITLE}--><span class="mini">(税込)</span>：
                         <span class="price">
-                        <!--{if $arrProduct.price02_min == $arrProduct.price02_max}-->
-                            <!--{$arrProduct.price02_min|sfPreTax:$arrSiteInfo.tax:$arrSiteInfo.tax_rule|number_format}-->
-                        <!--{else}-->
-                            <!--{$arrProduct.price02_min|sfPreTax:$arrSiteInfo.tax:$arrSiteInfo.tax_rule|number_format}-->～<!--{$arrProduct.price02_max|sfPreTax:$arrSiteInfo.tax:$arrSiteInfo.tax_rule|number_format}-->
-                        <!--{/if}-->円</span>
+                            <span id="price02_default_<!--{$id}-->">
+                                <!--{if $arrProduct.price02_min == $arrProduct.price02_max}-->
+                                    <!--{$arrProduct.price02_min|sfPreTax:$arrSiteInfo.tax:$arrSiteInfo.tax_rule|number_format}-->
+                                <!--{else}-->
+                                    <!--{$arrProduct.price02_min|sfPreTax:$arrSiteInfo.tax:$arrSiteInfo.tax_rule|number_format}-->～<!--{$arrProduct.price02_max|sfPreTax:$arrSiteInfo.tax:$arrSiteInfo.tax_rule|number_format}-->
+                                <!--{/if}-->
+                            </span><span id="price02_dynamic_<!--{$id}-->"></span>
+                            円</span>
                     </span>
                     
                     <!--★詳細ボタン★-->
                     <span class="btnbox">
-                        <!--{assign var=name value="detail`$id`"}-->
-                        <a href="<!--{$smarty.const.DETAIL_P_HTML}--><!--{$arrProduct.product_id}-->" onmouseover="chgImg('<!--{$TPL_DIR}-->img/products/b_detail_on.gif','<!--{$name}-->');" onmouseout="chgImg('<!--{$TPL_DIR}-->img/products/b_detail.gif','<!--{$name}-->');">
-                            <img src="<!--{$TPL_DIR}-->img/products/b_detail.gif" width="115" height="25" alt="詳しくはこちら" name="<!--{$name}-->" id="<!--{$name}-->" /></a>
+                    <!--{assign var=name value="detail`$id`"}-->
+                    <a href="<!--{$smarty.const.DETAIL_P_HTML}--><!--{$arrProduct.product_id}-->" onmouseover="chgImg('<!--{$TPL_DIR}-->img/products/b_detail_on.gif','<!--{$name}-->');" onmouseout="chgImg('<!--{$TPL_DIR}-->img/products/b_detail.gif','<!--{$name}-->');">
+                        <img src="<!--{$TPL_DIR}-->img/products/b_detail.gif" width="115" height="25" alt="詳しくはこちら" name="<!--{$name}-->" id="<!--{$name}-->" /></a>
                     </span>
                 </p>
 
-                <!--{if $arrProduct.stock_max == 0 && $arrProduct.stock_unlimited_max != 1}-->
-                    <p class="soldout"><em>申し訳ございませんが、只今品切れ中です。</em></p>
-                <!--{else}-->
-                    <!--▼買い物かご-->
-                    <form name="product_form<!--{$id|escape}-->" action="?">
-                        <input type="hidden" name="product_id" value="<!--{$id|escape}-->" />
-                        <div class="in_cart">
+                <!--▼買い物かご-->
+                <form name="product_form<!--{$id|escape}-->" action="?" onsubmit="return false;">
+                    <input type="hidden" name="product_id" value="<!--{$id|escape}-->" />
+                    <div class="in_cart">
+                        <!--{if $tpl_stock_find[$id]}-->
                             <dl>
                                 <!--{if $tpl_classcat_find1[$id]}-->
+                                    <!--▼規格1-->
                                     <dt><!--{$tpl_class_name1[$id]|escape}-->：</dt>
                                     <dd>
-                                        <select name="classcategory_id1" style="<!--{$arrProduct.arrErr.classcategory_id1|sfGetErrorColor}-->" onchange="fnSetSelect(this.form);">
-                                        <option value="">選択してください</option>
-                                        <!--{html_options options=$arrClassCat1[$id] selected=$arrProduct.classcategory_id1}-->
+                                        <select name="classcategory_id1"
+                                            style="<!--{$arrErr.classcategory_id1|sfGetErrorColor}-->"
+                                            onchange="fnSetClassCategories(this.form);"
+                                        >
+                                            <!--{html_options options=$arrClassCat1[$id] selected=$arrProduct.classcategory_id1}-->
                                         </select>
-                                        <!--{if $arrProduct.arrErr.classcategory_id1 != ""}-->
+                                        <!--{if $arrErr.classcategory_id1 != ""}-->
                                             <br /><span class="attention">※ <!--{$tpl_class_name1[$id]}-->を入力して下さい。</span>
                                         <!--{/if}-->
                                     </dd>
+                                    <!--▲規格1-->
                                 <!--{/if}-->
                                 <!--{if $tpl_classcat_find2[$id]}-->
+                                    <!--▼規格2-->
                                     <dt><!--{$tpl_class_name2[$id]|escape}-->：</dt>
                                     <dd>
-                                        <select name="classcategory_id2" style="<!--{$arrProduct.arrErr.classcategory_id2|sfGetErrorColor}-->">
-                                        <option value="">選択してください</option>
+                                        <select name="classcategory_id2"
+                                            style="<!--{$arrErr.classcategory_id2|sfGetErrorColor}-->"
+                                            onchange="fnCheckStock(this.form);"
+                                        >
                                         </select>
-                                        <!--{if $arrProduct.arrErr.classcategory_id2 != ""}-->
+                                        <!--{if $arrErr.classcategory_id2 != ""}-->
                                             <br /><span class="attention">※ <!--{$tpl_class_name2[$id]}-->を入力して下さい。</span>
                                         <!--{/if}-->
                                     </dd>
+                                    <!--▲規格2-->
                                 <!--{/if}-->
 
                                 <dt>数量：</dt>
                                 <dd>
-                                    <input type="text" name="quantity" size="3" class="box54" value="<!--{$arrProduct.quantity|default:1|escape}-->" maxlength="<!--{$smarty.const.INT_LEN}-->" style="<!--{$arrProduct.arrErr.quantity|sfGetErrorColor}-->" />
-                                    <!--{if $arrProduct.arrErr.quantity != ""}-->
-                                        <br /><span class="attention"><!--{$arrProduct.arrErr.quantity}--></span>
+                                    <input type="text" name="quantity" class="box54" value="<!--{$arrProduct.quantity|default:1|escape}-->" maxlength="<!--{$smarty.const.INT_LEN}-->" style="<!--{$arrErr.quantity|sfGetErrorColor}-->" />
+                                    <!--{if $arrErr.quantity != ""}-->
+                                        <br /><span class="attention"><!--{$arrErr.quantity}--></span>
                                     <!--{/if}-->
                                 </dd>
                             </dl>
                             <div class="cartbtn">
-                                <input
-                                    type="image"
-                                    id="cart<!--{$id}-->"
-                                    src="<!--{$TPL_DIR}-->img/products/b_cartin.gif"
-                                    alt="カゴに入れる"
-                                    onclick="fnInCart(this.form); return false;"
-                                    onmouseover="chgImg('<!--{$TPL_DIR}-->img/products/b_cartin_on.gif', this);"
-                                    onmouseout="chgImg('<!--{$TPL_DIR}-->img/products/b_cartin.gif', this);"
-                                />
+                                <!--★カゴに入れる★-->
+                                <div id="cartbtn_default_<!--{$id}-->">
+                                    <input
+                                        type="image"
+                                        id="cart<!--{$id}-->"
+                                        src="<!--{$TPL_DIR}-->img/products/b_cartin.gif"
+                                        alt="カゴに入れる"
+                                        onclick="fnInCart(this.form); return false;"
+                                        onmouseover="chgImg('<!--{$TPL_DIR}-->img/products/b_cartin_on.gif', this);"
+                                        onmouseout="chgImg('<!--{$TPL_DIR}-->img/products/b_cartin.gif', this);"
+                                    />
+                                </div>
+                                <div class="attention" id="cartbtn_dynamic_<!--{$id}-->"></div>
                             </div>
-                        </div>
-                    </form>
-                    <!--▲買い物かご-->
-                <!--{/if}-->
+                        <!--{else}-->
+                            <div class="cartbtn attention">申し訳ございませんが、只今品切れ中です。</div>
+                        <!--{/if}-->
+                    </div>
+                </form>
+                <!--▲買い物かご-->
                 
             </div>
@@ -282,11 +333,11 @@
                      表示件数
                     <select name="disp_number" onchange="javascript:fnChangeDispNumber(this.value);">
-                        <!--{foreach from=$arrPRODUCTLISTMAX item="dispnum" key="num"}-->
-                            <!--{if $num == $disp_number}-->
-                                <option value="<!--{$num}-->" selected="selected" ><!--{$dispnum}--></option>
-                            <!--{else}-->
-                                <option value="<!--{$num}-->" ><!--{$dispnum}--></option>
-                            <!--{/if}-->
-                        <!--{/foreach}-->
+                    <!--{foreach from=$arrPRODUCTLISTMAX item="dispnum" key="num"}-->
+                    <!--{if $num == $disp_number}-->
+                    <option value="<!--{$num}-->" selected="selected" ><!--{$dispnum}--></option>
+                    <!--{else}-->
+                    <option value="<!--{$num}-->" ><!--{$dispnum}--></option>
+                    <!--{/if}-->
+                <!--{/foreach}-->
                     </select>
                 </li>
