Index: /lib/filter_functions.inc.php
===================================================================
--- /lib/filter_functions.inc.php	(revision 7820)
+++ /lib/filter_functions.inc.php	(revision 7821)
@@ -438,5 +438,5 @@
         //g4/wp-admindie($api_return);
 
-        if (wpsg_isSizedArray($api_return_json)) {
+        if (wpsg_isSizedArray($api_return_json)) { 
 
             // In der Antwort waren gleich aktualisierte Daten enthalten
@@ -485,4 +485,6 @@
                     $wpsg_update_data_return = wpsg_api_call('checkUpdate', array(), $key);
 
+                    //die(wpsg_debug($wpsg_update_data_return));
+                    
                     if (wpsg_isSizedArray($wpsg_update_data_return) && isset($wpsg_update_data_return['returnCode'])) {
 
Index: /mods/wpsg_mod_abo.class.php
===================================================================
--- /mods/wpsg_mod_abo.class.php	(revision 7820)
+++ /mods/wpsg_mod_abo.class.php	(revision 7821)
@@ -478,9 +478,8 @@
 							}
 
-							if ($inform == true)
-							{
+							if ($inform == true) {
 
 								// Mail bei Erstkauf
-								$this->sendAboFirstBuyMail($order_id, $product['id']);
+								$this->sendAboFirstBuyMail($order_id, $product['order_product_id']);
 
 							}
@@ -738,19 +737,21 @@
 		public function basket_updateProduktFromSession(&$product_index, &$stock) {
 
-			$product_key = $_SESSION['wpsg']['basket'][$product_index]['id'];
-
-			$order_id = $this->getOrderIDFromKey($product_key);
-			$product_id = $this->shop->getProduktID($product_key);
-			$product_data = $this->shop->cache->loadProduct($product_id);
-
-			$nAboBuyed = $this->db->fetchOne("SELECT `rebuy` FROM `".WPSG_TBL_ABO."` WHERE `order_id` = '".wpsg_q($order_id)."' AND `product_key` = '".wpsg_q($product_id)."'");
+            /*
+            $product_id = $_SESSION['wpsg']['basket'][$product_index]['id'];
+
+            $order_id = $this->getOrderIDFromKey($product_key);
+            $product_id = $this->shop->getProduktID($product_key);
+            $product_data = $this->shop->cache->loadProduct($product_id);
+
+            $nAboBuyed = $this->db->fetchOne("SELECT `rebuy` FROM `".WPSG_TBL_ABO."` WHERE `order_id` = '".wpsg_q($order_id)."' AND `product_index` = '".wpsg_q($product_index)."'");
  
-			if ($nAboBuyed + $stock > $product_data['wpsg_mod_abo_resell'] && $product_data['wpsg_mod_abo_resell'] != '0')
-			{
-
-				$this->shop->addFrontendError(__('Abo kann nicht mehr so oft verlÃ€ngert werden!', 'wpsg'));
-				$stock = 0;
-
-			}
+            if ($nAboBuyed + $stock > $product_data['wpsg_mod_abo_resell'] && $product_data['wpsg_mod_abo_resell'] != '0')
+            {
+
+                $this->shop->addFrontendError(__('Abo kann nicht mehr so oft verlÃ€ngert werden!', 'wpsg'));
+                $stock = 0;
+
+            }
+            */
 
 		}
@@ -1437,4 +1438,29 @@
 		} // public function getAboExpiration($product_id, $menge)
 
+        public function isAboExtensionProductKey($product_key) {
+		    
+		    if (preg_match('/^abo\_\d+\_\d+$/', $product_key)) {
+		        
+		        return true;
+		        
+            } else return false;
+		    
+        }
+
+        /**
+         * Gibt die ProduktID aus einem Abo VerlÃ€ngerungsschlÃŒssel zurÃŒck
+         * abo_{order_id}_{order_product_id}
+         * @param $productkey
+         */
+        public function getProductIDFromAboExtensionProductKey($product_key) {
+		    
+		    $arKey = explode('_', $product_key);
+		    
+		    $oOrderProduct = wpsg_order_product::getInstance(intval($arKey[2]));
+		    
+		    return $oOrderProduct->getProductId();
+		    
+        }
+        
 		/**
 		 * Gibt false zurÃŒck wenn die Bestellung keine Abo Bestellung ist
@@ -1529,7 +1555,7 @@
 
 			if ($this->shop->get_option('wpsg_mod_abo_wpsgmodabofirstbuy') != '1') return;
-
+            
 			$oOrderProduct = wpsg_order_product::getInstance($order_product_id);
-			
+            
 			$product_data = $this->shop->cache->loadProduct($oOrderProduct->getProductId());
 			$order_data = $this->shop->cache->loadOrder($order_id);
Index: /mods/wpsg_mod_basic.class.php
===================================================================
--- /mods/wpsg_mod_basic.class.php	(revision 7820)
+++ /mods/wpsg_mod_basic.class.php	(revision 7821)
@@ -470,5 +470,5 @@
 		 * Wird aufgerufen wenn ein Produkt im Warenkorb aktualisiert wird
 		 */
-		public function basket_updateProduktFromSession(&$product_key, &$stock) { }
+		public function basket_updateProduktFromSession(&$product_index, &$stock) { }
 		
 		/**
Index: /mods/wpsg_mod_productvariants.class.php
===================================================================
--- /mods/wpsg_mod_productvariants.class.php	(revision 7820)
+++ /mods/wpsg_mod_productvariants.class.php	(revision 7821)
@@ -867,6 +867,5 @@
 		 * Wird vom Lagerbestandsmodul aufgerufen, sollte NUR mit einem VariantenschlÃŒssel aufgerufen werden
 		 */
-		public function getStockForVariation($product_key)
-		{
+		public function getStockForVariation($product_key) {
 
 			$arVariInfo = $this->explodeProductKey($product_key);
Index: /mods/wpsg_mod_stock.class.php
===================================================================
--- /mods/wpsg_mod_stock.class.php	(revision 7820)
+++ /mods/wpsg_mod_stock.class.php	(revision 7821)
@@ -380,19 +380,15 @@
 		}
 
-		public function checkCheckout(&$state, &$error, &$arCheckout)
-		{
+		public function checkCheckout(&$state, &$error, &$arCheckout) {
 
 			if (!wpsg_isSizedInt($this->shop->get_option('wpsg_mod_stock_allow')) || $state !== true) return;
 
-			foreach ((array)$this->shop->basket->arProdukte as $product_data)
-			{
-
-				if (!$this->checkBestand($product_data['id'], $product_data['menge']))
-				{
+			foreach ((array)$this->shop->basket->arProdukte as $product_data) {
+
+				if (!$this->checkBestand($product_data['id'], $product_data['menge'])) {
 
 					$nStockAvailable = $this->getBestand($product_data['id']);
 
-					if ($nStockAvailable <= 0)
-					{
+					if ($nStockAvailable <= 0) {
 
 						$this->shop->addFrontendError(
@@ -476,22 +472,18 @@
 		 * Gibt den aktuellen Bestand fÃŒr ein Produkt zurÃŒck
 		 */
-		public function getBestand($produkt_key)
-		{
+		public function getBestand($produkt_key) {
 
 			$arStock = array();
 
-			if ($this->shop->hasMod('wpsg_mod_productgroups'))
-			{
+			if ($this->shop->hasMod('wpsg_mod_productgroups')) {
 
 				$product_id = $this->shop->getProduktID($produkt_key);
 				$product_data = $this->shop->cache->loadProduct($product_id);
-
-				if (wpsg_isSizedInt($product_data['pgruppe']))
-				{
+                
+				if (wpsg_isSizedInt($product_data['pgruppe'])) {
 
 					$pgroup = $this->db->fetchRow("SELECT `stock_aktiv`, `stock_value` FROM `".WPSG_TBL_PRODUCTS_GROUP."` WHERE `id` = '".wpsg_q($product_data['pgruppe'])."' ");
 
-					if ($pgroup['stock_aktiv'] === '1')
-					{
+					if ($pgroup['stock_aktiv'] === '1') {
 
 						$arStock[] = $pgroup['stock_value'];
@@ -503,17 +495,20 @@
 			}
 
-			if (is_numeric($produkt_key))
-			{
+			if (is_numeric($produkt_key)) {
 
 				// Lagerbestand in der Datenbank
 				$arStock[] = $this->db->fetchOne("SELECT P.`stock` FROM `".WPSG_TBL_PRODUCTS."` AS P WHERE P.`id` = '".wpsg_q($produkt_key)."'");
 
-			}
-			else if ($this->shop->hasMod('wpsg_mod_productvariants'))
-			{
-
-				$arStock[] = $this->shop->callMod('wpsg_mod_productvariants', 'getStockForVariation', array($produkt_key));
-
-			}
+			} else if ($this->shop->hasMod('wpsg_mod_productvariants') && $this->shop->callMod('wpsg_mod_variants', 'isVariantsProductKey', [$produkt_key])) {
+ 
+				$arStock[] = $this->shop->callMod('wpsg_mod_productvariants', 'getStockForVariation', [$produkt_key]);
+
+			} else if ($this->shop->hasMod('wpsg_mod_abo') && $this->shop->callMod('wpsg_mod_abo', 'isAboExtensionProductKey', [$produkt_key])) {
+			    
+			    $product_id = $this->shop->callMod('wpsg_mod_abo', 'getProductIDFromAboExtensionProductKey', [$produkt_key]);
+
+                $arStock[] = $this->db->fetchOne("SELECT P.`stock` FROM `".WPSG_TBL_PRODUCTS."` AS P WHERE P.`id` = '".wpsg_q($product_id)."'");
+			    
+            }
 
 			if (!wpsg_isSizedArray($arStock)) return 0;
