Index: branches/version-2_4/data/class/helper/SC_Helper_DB.php
===================================================================
--- branches/version-2_4/data/class/helper/SC_Helper_DB.php	(revision 18521)
+++ branches/version-2_4/data/class/helper/SC_Helper_DB.php	(revision 18705)
@@ -312,21 +312,22 @@
                 // 購入制限数を求める。
                 if ($arrData['stock_unlimited'] != '1' && $arrData['sale_unlimited'] != '1') {
-                    if($arrData['sale_limit'] < $arrData['stock']) {
-                        $limit = $arrData['sale_limit'];
+                    $limit = min($arrData['sale_limit'], $arrData['stock']);
+                } elseif ($arrData['sale_unlimited'] != '1') {
+                    $limit = $arrData['sale_limit'];
+                } else {
+                    // 購入制限なしの場合は、SALE_LIMIT_MAXが最大購入個数
+                    // 但し、SALE_LIMIT_MAXは、有効な整数値でないと機能しない
+
+                    if ($arrData['stock_unlimited'] != '1') {
+                        // 在庫制限がある場合は、SALE_LIMIT_MAXと在庫数の小さい方が購入可能最大数
+                        if (SALE_LIMIT_MAX > 0) {
+                        	$limit = min(SALE_LIMIT_MAX, $arrData['stock']);
+                        } else {
+                        	$limit = $arrData['stock'];
+                        }
                     } else {
-                        // 購入制限数を在庫数に
-                        #$limit = $arrData['stock'];
-                        // 購入制限数をSALE_LIMIT_MAXに
-                        $limit = SALE_LIMIT_MAX;
-                    }
-                } else {
-                    if ($arrData['sale_unlimited'] != '1') {
-                        $limit = $arrData['sale_limit'];
-                    }
-                    if ($arrData['stock_unlimited'] != '1') {
-                        // 購入制限数を在庫数に
-                        #$limit = $arrData['stock'];
-                        // 購入制限数をSALE_LIMIT_MAXに
-                        $limit = SALE_LIMIT_MAX;
+                        if (SALE_LIMIT_MAX > 0) {
+                            $limit = SALE_LIMIT_MAX;
+                        }
                     }
                 }
