Index: /mods/wpsg_mod_productvariants.class.php
===================================================================
--- /mods/wpsg_mod_productvariants.class.php	(revision 6308)
+++ /mods/wpsg_mod_productvariants.class.php	(revision 6309)
@@ -210,5 +210,5 @@
 			
 		} // public function template_redirect()
-		
+				
 		public function loadProduktArray(&$product_data)
 		{
@@ -773,5 +773,33 @@
         		
         } // public function produkt_ajax()
-        
+
+		/**
+		 * Darf das Produkt gekauft werden?
+		 */
+		public function canOrder($product_key)
+		{
+			
+			$product_id = $this->shop->getProduktID($product_key);
+			
+			if ($this->isVariantsProduct($product_id))
+			{
+				
+				$nActive = 0;
+				
+				$variants = $this->getVariants($product_id);
+				
+				foreach ($variants as $var_id => $var_info)
+				{
+					
+					$nActive += $var_info['count_active'];
+					
+				}
+				
+				if ($nActive <= 0) return -2;
+				
+			}
+						 
+		}
+		
 		/* Modulfunktionen */
 		
@@ -904,5 +932,7 @@
         		{
 
-        			if (isset($_REQUEST['vari_id'])) {
+        			if (isset($_REQUEST['vari_id'])) 
+					{
+						
         				$vp_data = @unserialize($this->db->fetchOne("SELECT `images` FROM `".WPSG_TBL_PRODUCTS_VARIATION."` WHERE `id` = '".wpsg_q($_REQUEST['vari_id'])."'"));
         				if (!is_array($vp_data)) $vp_data = array();
@@ -1094,9 +1124,20 @@
 		public function isVariantsProduct($product_id)
 		{
-			
-			$product_data['arVariant'] = $this->getVariants($product_id, true, true, true);
-
-			if (wpsg_isSizedArray($product_data['arVariant'])) return true;
-			else return false;
+			 			
+			$strQuery = "
+					SELECT 
+						COUNT(*) 
+					FROM 
+						`".WPSG_TBL_VARIANTS_VARI."` AS VI 
+							LEFT JOIN `".WPSG_TBL_PRODUCTS_VARIATION."` AS PVI ON (PVI.`variation_id` = VI.`id`)
+					WHERE 
+						PVI.`product_id` = '".wpsg_q($product_id)."' AND
+						PVI.`active` = '1' AND						 
+						VI.`deleted` != '1'
+			";
+			
+			$nActiveVariants = $this->db->fetchOne($strQuery);
+			
+			if ($nActiveVariants > 0) return true; else return false;
 			
 		} // public function isVariantsProduct($product_id)
@@ -1853,4 +1894,9 @@
 				$strProductQuery .= " OR V.`product_id` = '".wpsg_q($product_id)."' ";
 				
+				$strQueryWHERE = "";
+				
+				// Wenn Lagerbestand aktiv, dann nur Veriationen mit Lagerbestand zÃ€hlen
+				if ($this->shop->hasMod('wpsg_mod_stock')) $strQueryWHERE .= " AND PVI.`stock` > 0 ";
+				
 				$strQuerySELECT .= ", (
 					SELECT 
@@ -1864,4 +1910,5 @@
 						VI.`variant_id` = V.`id` AND 
 						VI.`deleted` != '1'
+						".$strQueryWHERE."
 				) AS `count_active` ";
 				
Index: /mods/wpsg_mod_stock.class.php
===================================================================
--- /mods/wpsg_mod_stock.class.php	(revision 6308)
+++ /mods/wpsg_mod_stock.class.php	(revision 6309)
@@ -79,5 +79,5 @@
 		public function canOrder($product_key) 
 		{ 
-			 
+			
 			if ($this->getBestand($product_key) - $this->getAmountSession($product_key) <= 0) return -2;
 			
