Index: /branches/comu-ver2/html/install/sql/insert_data.sql
===================================================================
--- /branches/comu-ver2/html/install/sql/insert_data.sql	(revision 17455)
+++ /branches/comu-ver2/html/install/sql/insert_data.sql	(revision 17509)
@@ -1055,4 +1055,5 @@
 INSERT INTO mtb_constants VALUES ('UPDATE_SEND_SITE_INFO','false',289,'アップデート時にサイト情報を送出するか');
 INSERT INTO mtb_constants VALUES ('USE_POINT','true',290,'ポイントを利用するか(true:利用する、false:利用しない) (false は一部対応)');
+INSERT INTO mtb_constants VALUES ('NOSTOCK_HIDDEN','false',291,'在庫無し商品の非表示(true:非表示、false:表示)');
 INSERT INTO mtb_constants VALUES ('DEFAULT_TEMPLATE_NAME', '"default"', 300,'デフォルトテンプレート名');
 INSERT INTO mtb_constants VALUES ('TEMPLATE_NAME', 'DEFAULT_TEMPLATE_NAME', 301,'テンプレート名');
Index: /branches/comu-ver2/data/mtb_constants_init.php
===================================================================
--- /branches/comu-ver2/data/mtb_constants_init.php	(revision 17455)
+++ /branches/comu-ver2/data/mtb_constants_init.php	(revision 17509)
@@ -553,4 +553,6 @@
 /** ポイントを利用するか(true:利用する、false:利用しない) (false は一部対応) */
 define('USE_POINT', ture);
+/** 在庫無し商品の非表示(true:非表示、false:表示) */
+define('NOSTOCK_HIDDEN', false);
 /** デフォルトテンプレート名 */
 define('DEFAULT_TEMPLATE_NAME', "default");
Index: /branches/comu-ver2/data/class/pages/rss/LC_Page_Rss_Products.php
===================================================================
--- /branches/comu-ver2/data/class/pages/rss/LC_Page_Rss_Products.php	(revision 17434)
+++ /branches/comu-ver2/data/class/pages/rss/LC_Page_Rss_Products.php	(revision 17509)
@@ -213,5 +213,12 @@
             FROM  vw_products_allclass as allcls
             WHERE allcls.del_flg = 0 AND allcls.status = 1";
+        
+        // 在庫無し商品の非表示
+        if (NOSTOCK_HIDDEN === true) {
+            $sql .= ' AND (allcls.stock_max >= 1 OR allcls.stock_unlimited_max = 1)';
+        }
+        
         $sql .= " ORDER BY allcls.product_id";
+        
         $arrProduct = $objQuery->getall($sql);
         return $arrProduct;
Index: /branches/comu-ver2/data/class/pages/mypage/LC_Page_Mypage_Favorite.php
===================================================================
--- /branches/comu-ver2/data/class/pages/mypage/LC_Page_Mypage_Favorite.php	(revision 17162)
+++ /branches/comu-ver2/data/class/pages/mypage/LC_Page_Mypage_Favorite.php	(revision 17509)
@@ -94,7 +94,13 @@
         }
 
-        $col = "vpa.*";
-        $from = "dtb_customer_favorite_products AS dcfp LEFT JOIN vw_products_allclass AS vpa USING(product_id)";
-        $where = "vpa.del_flg = 0 AND dcfp.customer_id = ?";
+        $col = "allcls.*";
+        $from = "dtb_customer_favorite_products AS dcfp LEFT JOIN vw_products_allclass AS allcls USING(product_id)";
+        
+        $where = "allcls.del_flg = 0 AND allcls.status = 1 AND dcfp.customer_id = ?";
+        // 在庫無し商品の非表示
+        if (NOSTOCK_HIDDEN === true) {
+            $where .= ' AND (allcls.stock_max >= 1 OR allcls.stock_unlimited_max = 1)';
+        }
+
         $arrval = array($objCustomer->getvalue('customer_id'));
         $order = "product_id DESC";
Index: /branches/comu-ver2/data/class/pages/shopping/LC_Page_Shopping_Complete.php
===================================================================
--- /branches/comu-ver2/data/class/pages/shopping/LC_Page_Shopping_Complete.php	(revision 17444)
+++ /branches/comu-ver2/data/class/pages/shopping/LC_Page_Shopping_Complete.php	(revision 17509)
@@ -639,4 +639,6 @@
     // 在庫を減らす処理
     function lfReduceStock(&$objQuery, $arrID, $quantity) {
+        $objDb = new SC_Helper_DB_Ex();
+        
         $where = "product_id = ? AND classcategory_id1 = ? AND classcategory_id2 = ?";
         $arrRet = $objQuery->select("stock, stock_unlimited", "dtb_products_class", $where, $arrID);
@@ -658,4 +660,11 @@
             $objQuery->update("dtb_products_class", $sqlval, $where, $arrID);
         }
+        
+        // 在庫無し商品の非表示対応
+        if (NOSTOCK_HIDDEN === true) {
+	        // 件数カウントバッチ実行
+	        $objDb->sfCategory_Count($objQuery);
+        }
+        
     }
 
Index: /branches/comu-ver2/data/class/pages/admin/products/LC_Page_Admin_Products_Class.php
===================================================================
--- /branches/comu-ver2/data/class/pages/admin/products/LC_Page_Admin_Products_Class.php	(revision 16741)
+++ /branches/comu-ver2/data/class/pages/admin/products/LC_Page_Admin_Products_Class.php	(revision 17509)
@@ -45,8 +45,8 @@
         parent::init();
         $this->tpl_mainpage = 'products/class.tpl';
-		$this->tpl_subnavi = 'products/subnavi.tpl';
-		$this->tpl_subno = 'class';
-		$this->tpl_subtitle = '規格登録';
-		$this->tpl_mainno = 'products';
+        $this->tpl_subnavi = 'products/subnavi.tpl';
+        $this->tpl_subno = 'class';
+        $this->tpl_subtitle = '規格登録';
+        $this->tpl_mainno = 'products';
     }
 
@@ -80,7 +80,7 @@
             if(count($this->arrErr) <= 0) {
                 if($_POST['class_id'] == "") {
-                    $this->lfInsertClass($this->arrForm);	// 新規作成
+                    $this->lfInsertClass($this->arrForm); // 新規作成
                 } else {
-                    $this->lfUpdateClass($this->arrForm);	// 既存編集
+                    $this->lfUpdateClass($this->arrForm); // 既存編集
                 }
                 // 再表示
Index: /branches/comu-ver2/data/class/pages/admin/products/LC_Page_Admin_Products_ProductClass.php
===================================================================
--- /branches/comu-ver2/data/class/pages/admin/products/LC_Page_Admin_Products_ProductClass.php	(revision 17408)
+++ /branches/comu-ver2/data/class/pages/admin/products/LC_Page_Admin_Products_ProductClass.php	(revision 17509)
@@ -48,5 +48,5 @@
         $this->tpl_mainno = 'products';
         $this->tpl_subno = 'product';
-        $this->tpl_subtitle = '商品登録';
+        $this->tpl_subtitle = '商品登録(商品規格)';
 
         $masterData = new SC_DB_MasterData_Ex();
@@ -87,4 +87,5 @@
         case 'delete':
             $objQuery = new SC_Query();
+            $objDb = new SC_Helper_DB_Ex();
 
             $objQuery->setLimitOffset(1);
@@ -113,5 +114,11 @@
                 $objQuery->commit();
             }
-
+            
+	        // 在庫無し商品の非表示対応
+	        if (NOSTOCK_HIDDEN === true) {
+	            // 件数カウントバッチ実行
+	            $objDb->sfCategory_Count($objQuery);
+	        }
+            
             $this->lfProductClassPage();   // 規格登録ページ
             break;
@@ -334,4 +341,5 @@
     function lfInsertProductClass($arrList, $product_id) {
         $objQuery = new SC_Query();
+        $objDb = new SC_Helper_DB_Ex();
 
         $objQuery->begin();
@@ -361,5 +369,8 @@
             $cnt++;
         }
-
+        
+        // 件数カウントバッチ実行
+        $objDb->sfCategory_Count($objQuery);
+        
         $objQuery->commit();
     }
Index: /branches/comu-ver2/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_Best5.php
===================================================================
--- /branches/comu-ver2/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_Best5.php	(revision 17288)
+++ /branches/comu-ver2/data/class/pages/frontparts/bloc/LC_Page_FrontParts_Bloc_Best5.php	(revision 17509)
@@ -108,5 +108,11 @@
         $col = "DISTINCT A.*, name, price02_min, price01_min, main_list_image ";
         $from = "dtb_best_products AS A INNER JOIN vw_products_allclass AS allcls using(product_id)";
-        $where = "status = 1";
+        $where = "allcls.del_flg = 0 AND allcls.status = 1";
+        
+        // 在庫無し商品の非表示
+        if (NOSTOCK_HIDDEN === true) {
+            $where .= ' AND (allcls.stock_max >= 1 OR allcls.stock_unlimited_max = 1)';
+        }
+        
         $order = "rank";
         $objQuery->setorder($order);
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 17444)
+++ /branches/comu-ver2/data/class/pages/products/LC_Page_Products_List.php	(revision 17509)
@@ -396,5 +396,5 @@
                 . " point_rate, sale_limit, sale_unlimited, deliv_date_id, deliv_fee,"
                 . " status, product_flag, create_date, del_flg";
-            $from = "vw_products_allclass AS T1";
+            $from = "vw_products_allclass AS allcls";
             $order = "price02_min, product_id";
             break;
@@ -409,10 +409,10 @@
                 . " point_rate, sale_limit, sale_unlimited, deliv_date_id, deliv_fee,"
                 . " status, product_flag, del_flg";
-            $from = "vw_products_allclass AS T1";
+            $from = "vw_products_allclass AS allcls";
             $order = "create_date DESC, product_id";
             break;
 
         default:
-            $col = "DISTINCT T1.product_id, product_code_min, product_code_max,"
+            $col = "DISTINCT allcls.product_id, product_code_min, product_code_max,"
                 . " price01_min, price01_max, price02_min, price02_max,"
                 . " stock_min, stock_max, stock_unlimited_min,"
@@ -422,5 +422,5 @@
                 . " point_rate, sale_unlimited, create_date, deliv_fee, "
                 . " T4.product_rank, T4.category_rank";
-            $from = "vw_products_allclass AS T1"
+            $from = "vw_products_allclass AS allcls"
                 . " JOIN ("
                 . " SELECT max(T3.rank) AS category_rank,"
@@ -436,4 +436,10 @@
         // 商品検索条件の作成（未削除、表示）
         $where = "del_flg = 0 AND status = 1 ";
+        
+        // 在庫無し商品の非表示
+        if (NOSTOCK_HIDDEN === true) {
+            $where .= ' AND (allcls.stock_max >= 1 OR allcls.stock_unlimited_max = 1)';
+        }
+        
         // カテゴリからのWHERE文字列取得
         if ( $category_id ) {
Index: /branches/comu-ver2/data/class/util/SC_Utils.php
===================================================================
--- /branches/comu-ver2/data/class/util/SC_Utils.php	(revision 17489)
+++ /branches/comu-ver2/data/class/util/SC_Utils.php	(revision 17509)
@@ -919,8 +919,16 @@
     // カテゴリ別おすすめ商品の取得
     function sfGetBestProducts( $conn, $category_id = 0){
+        $sql = '';
         // 既に登録されている内容を取得する
-        $sql = "SELECT name, main_image, main_list_image, price01_min, price01_max, price02_min, price02_max, point_rate,
+        $sql .= "SELECT name, main_image, main_list_image, price01_min, price01_max, price02_min, price02_max, point_rate,
                  A.product_id, A.comment FROM dtb_best_products as A LEFT JOIN vw_products_allclass AS allcls
-                USING (product_id) WHERE A.category_id = ? AND A.del_flg = 0 AND status = 1 ORDER BY A.rank";
+                USING (product_id) WHERE A.category_id = ? AND A.del_flg = 0 AND allcls.del_flg = 0 AND allcls.status = 1";
+        
+        // 在庫無し商品の非表示
+        if (NOSTOCK_HIDDEN === true) {
+            $sql .= ' AND (allcls.stock_max >= 1 OR allcls.stock_unlimited_max = 1)';
+        }
+        
+        $sql .= " ORDER BY A.rank";
         $arrItems = $conn->getAll($sql, array($category_id));
 
Index: /branches/comu-ver2/data/class/helper/SC_Helper_DB.php
===================================================================
--- /branches/comu-ver2/data/class/helper/SC_Helper_DB.php	(revision 17446)
+++ /branches/comu-ver2/data/class/helper/SC_Helper_DB.php	(revision 17509)
@@ -928,7 +928,13 @@
         $sql .= " FROM dtb_category AS T1 LEFT JOIN dtb_product_categories AS T2";
         $sql .= " ON T1.category_id = T2.category_id ";
-        $sql .= " LEFT JOIN dtb_products AS T3";
-        $sql .= " ON T2.product_id = T3.product_id";
-        $sql .= " WHERE T3.del_flg = 0 AND T3.status = 1 ";
+        $sql .= " LEFT JOIN vw_products_allclass AS allcls";
+        $sql .= " ON T2.product_id = allcls.product_id";
+        $sql .= " WHERE allcls.del_flg = 0 AND allcls.status = 1 ";
+        
+        // 在庫無し商品の非表示
+        if (NOSTOCK_HIDDEN === true) {
+            $sql .= ' AND (allcls.stock_max >= 1 OR allcls.stock_unlimited_max = 1)';
+        }
+        
         $sql .= " GROUP BY T1.category_id, T2.category_id ";
         $objQuery->query($sql);
