Index: /controller/wpsg_ShopController.class.php
===================================================================
--- /controller/wpsg_ShopController.class.php	(revision 7812)
+++ /controller/wpsg_ShopController.class.php	(revision 7813)
@@ -2497,5 +2497,8 @@
 
 				$arData = explode('_', $produkt_key);
-				return $this->getProduktID($arData[2]);
+				
+				$oOrderProduct = wpsg_order_product::getInstance(intval($arData[2]));
+				
+				return $oOrderProduct->getProductId();
 
 			}
Index: /lib/filter_functions.inc.php
===================================================================
--- /lib/filter_functions.inc.php	(revision 7812)
+++ /lib/filter_functions.inc.php	(revision 7813)
@@ -592,4 +592,10 @@
     function wpsg_admin_init() {
 
+        if ((wpsg_getStr($_SERVER['SCRIPT_URL']) === '/wp-admin/admin-ajax.php' || wpsg_getStr($_SERVER['SCRIPT_NAME']) === '/wp-admin/admin-ajax.php') && !preg_match('/health-check/', wpsg_getStr($_REQUEST['action']))) {
+
+            wpsg_ShopController::getShop()->send_headers();
+
+        }
+        
         if (isset($_REQUEST['wpsg_insertlicence_submit'])) {
     
Index: /mods/wpsg_mod_abo.class.php
===================================================================
--- /mods/wpsg_mod_abo.class.php	(revision 7812)
+++ /mods/wpsg_mod_abo.class.php	(revision 7813)
@@ -392,10 +392,14 @@
 					if (substr($product['productkey'], 0, 3) == 'abo') {
 
+					    // Kauf einer VerlÃ€ngerung
+                        // Hier ist der Productkey abo_{original_order_id}_{original_order_product_id}
+					    
 						// BestellID der OriginalBestellung
 						$order_base_id = $this->getOrderIDFromKey($product['productkey']);
-
+						$order_product_id = $this->getOrderProductIDFromKey($product['productkey']);
+						 
 						// Eine Abo VerlÃ€ngerung wurde gekauft
-						$abo_entry = $this->db->fetchRow("SELECT * FROM `".WPSG_TBL_ABO."` WHERE `order_id` = '".wpsg_q($order_base_id)."' AND `product_key` = '".wpsg_q($product['product_key'])."'");
-
+						$abo_entry = $this->db->fetchRow("SELECT * FROM `".WPSG_TBL_ABO."` WHERE `order_id` = '".wpsg_q($order_base_id)."' AND `order_product_id` = '".wpsg_q($order_product_id)."'");
+ 						
 						if ($abo_entry['id'] <= 0) throw new \wpsg\Exception(__('Es wurde eine Bestellung auf Zahlung aktzeptiert gesetzt, die eine Abo VerlÃ€ngerung drin hat zu der kein Eintrag existiert', 'wpsg'));
 						if ($product_data['wpsg_mod_abo_resell'] != 0 && $abo_entry['rebuy'] + $product['menge'] > $product_data['wpsg_mod_abo_resell']) throw new \wpsg\Exception('Es wurde eine Bestellung auf Zahlung aktzeptiert gesetzt, das Abo konnte aber nicht verlÃ€ngert werden da es die gÃŒltige Anzahl im Produkt ÃŒberschreibt', __('wpsg'));
@@ -416,5 +420,6 @@
 							'rebuy' => wpsg_q($abo_entry['rebuy'] + $product['menge']),
 							'expiration' => $abo_expiration,
-							'inform_expiration' => '0'
+							'inform_expiration' => '0',
+                            'inform_autorenew' => '0'
 						), "`id` = '".wpsg_q($abo_entry['id'])."'");
 						
@@ -435,5 +440,5 @@
 
 							// Mail bei Erstkauf
-							$this->sendAboRebuyMail($this->getOrderIDFromKey($product['productkey']), $product['productkey']);
+							$this->sendAboRebuyMail($this->getOrderIDFromKey($product['productkey']), $order_product_id);
 
 						}
@@ -444,5 +449,5 @@
 
 							// Existiert ein Eintrag in der Abotabelle schon, so wird dieser gelÃ¶scht
-							$abo_id = $this->db->fetchOne("SELECT `id` FROM `".WPSG_TBL_ABO."` WHERE `order_id` = '".wpsg_q($order_id)."' AND `product_key` = 'abo_".wpsg_q($order_id.'_'.$product['productkey'])."'");
+							$abo_id = $this->db->fetchOne("SELECT `id` FROM `".WPSG_TBL_ABO."` WHERE `order_id` = '".wpsg_q($order_id)."' AND `order_product_id` = '".wpsg_q($product_data['order_product_id'])."'");
 							if ($abo_id > 0) { $this->db->Query("DELETE FROM `".WPSG_TBL_ABO."` WHERE `id` = '".wpsg_q($abo_id)."'"); }
 
@@ -512,5 +517,5 @@
 		
 		public function cron() {
- 
+ 		    
 			$arAboExpiration = $this->db->fetchAssoc("
 				SELECT
@@ -546,5 +551,5 @@
                 if ($wpsg_mod_abo_expiremode == self::EXPIRE_AUTO) {
                     
-                    $this->autoExtendOrder($a['order_id'], $a['product_key']);
+                    $this->autoExtendOrder($a['order_id'], $a['order_product_id']);
                     
                 } else {
@@ -579,8 +584,8 @@
                 $product_id = $oOrderProduct->getProductId();
                 
-                $wpsg_mod_abo_autoexpire_informationtime = intval($this->getSetting('wpsg_mod_abo_autoexpire_informationtime', $product_id));
-                $interval = intval(date_diff(date_create($a['expiration']), date_create(date('Y-m-d')))->format('%a'));
-                
-                if ($wpsg_mod_abo_autoexpire_informationtime > 0 && $interval === $wpsg_mod_abo_autoexpire_informationtime) {
+                $wpsg_mod_abo_autoexpire_informationtime = intval($this->getSetting('wpsg_mod_abo_autoexpire_informationtime', $product_id)); // Benachrichtigung
+                $interval = intval(date_diff(date_create($a['expiration']), date_create(date('Y-m-d')))->format('%a')); // Tage bis zum auslaufen
+                
+                if ($wpsg_mod_abo_autoexpire_informationtime > 0 && $interval <= $wpsg_mod_abo_autoexpire_informationtime) {
                     
                     $wpsg_mod_abo_expiremode = $this->getSetting('wpsg_mod_abo_expiremode', $product_id);
@@ -600,4 +605,6 @@
                 
             }                
+            
+            $this->shop->update_option('wpsg_mod_abo_cron_lastrun', time());
             
 		} 
@@ -648,5 +655,5 @@
 			if (!isset($_REQUEST['mod']) || $_REQUEST['mod'] != 'wpsg_mod_abo') return false;
 
-			if (!isset($_REQUEST['product_key']) || !isset($_REQUEST['order_id'])) {
+			if (!isset($_REQUEST['order_product_id']) || !isset($_REQUEST['order_id'])) {
 
 				throw new \wpsg\Exception(__('Beim VerlÃ€ngerungslink keine BestellID oder ProductKey ÃŒbergeben', 'wpsg'));
@@ -655,20 +662,19 @@
 			}
 
-			$product_key = 'abo_'.$_REQUEST['order_id'].'_'.$_REQUEST['product_key'];
-			//$product_key = $_REQUEST['product_key']; Key wird hier erst gebildet
-
+			$product_key = 'abo_'.$_REQUEST['order_id'].'_'.$_REQUEST['order_product_id'];
+			
+			$oOrderProduct = wpsg_order_product::getInstance($_REQUEST['order_product_id']);
+						
 			// Kann das Abo verlÃ€ngert werden?
-			$product_data_db = $this->shop->cache->loadProduct($this->shop->getProduktID($_REQUEST['product_key']));
+			$product_data_db = $this->shop->cache->loadProduct($oOrderProduct->getProductId());
 
 			// Wie oft wurde das Abo zu dieser Bestellung bereits verlÃ€ngert?
-			$nAboBuyed = $this->db->fetchOne("SELECT `rebuy` FROM `".WPSG_TBL_ABO."` WHERE `order_id` = '".wpsg_q($_REQUEST['order_id'])."' AND `product_key` = '".wpsg_q($_REQUEST['product_key'])."'");
+			$nAboBuyed = $this->db->fetchOne("SELECT `rebuy` FROM `".WPSG_TBL_ABO."` WHERE `order_id` = '".wpsg_q($_REQUEST['order_id'])."' AND `order_product_id` = '".wpsg_q($_REQUEST['order_product_id'])."'");
 
 			// Ist so ein Abo Produkt schon im Warenkorb?
-			$nDrin = false;
-			if (wpsg_isSizedArray($_SESSION['wpsg']['basket']))
-			{
-
-				foreach ($_SESSION['wpsg']['basket'] as $p_index => $p)
-				{
+			$nDrin = false;			
+			if (wpsg_isSizedArray($_SESSION['wpsg']['basket'])) {
+
+				foreach ($_SESSION['wpsg']['basket'] as $p_index => $p) {
 
 					if ($p['id'] == $product_key) $nDrin = $p_index;
@@ -678,9 +684,7 @@
 			}
 
-			if ($nDrin !== false)
-			{
-
-				if ($product_data_db['wpsg_mod_abo_resell'] != '0' && $nAboBuyed + $_SESSION['wpsg']['basket'][$nDrin]['menge'] + 1 >= $product_data_db['wpsg_mod_abo_resell'])
-				{
+			if ($nDrin !== false) {
+
+				if ($product_data_db['wpsg_mod_abo_resell'] != '0' && $nAboBuyed + $_SESSION['wpsg']['basket'][$nDrin]['menge'] + 1 >= $product_data_db['wpsg_mod_abo_resell']) {
 
 					// Abo kann nicht mehr verlÃ€ngert werden
@@ -692,10 +696,7 @@
 				$_SESSION['wpsg']['basket'][$nDrin]['menge'] ++;
 
-			}
-			else
-			{
-
-				if ($product_data_db['wpsg_mod_abo_resell'] != '0' && $nAboBuyed + 1 > $product_data_db['wpsg_mod_abo_resell'])
-				{
+			} else {
+
+				if ($product_data_db['wpsg_mod_abo_resell'] != '0' && $nAboBuyed + 1 > $product_data_db['wpsg_mod_abo_resell']) {
 
 					// Abo kann nicht mehr verlÃ€ngert werden
@@ -707,11 +708,12 @@
 				if (!wpsg_isSizedArray($_SESSION['wpsg'])) $_SESSION['wpsg'] = array();
 				if (!wpsg_isSizedArray($_SESSION['wpsg']['basket'])) $_SESSION['wpsg']['basket'] = array();
-
+ 
 				$_SESSION['wpsg']['basket'][] = array(
 					'menge' => '1',
-					'id' => $product_key
+					'id' => $product_key,
+                    'product_key' => $product_key
 				);
 
-				$product_data = $this->shop->loadProduktArray($this->shop->getProduktID($_REQUEST['product_key']));
+				$product_data = $this->shop->loadProduktArray($oOrderProduct->getProductId());
 
 				$this->shop->addFrontendMessage(wpsg_translate(__('Abo VerlÃ€ngerung fÃŒr Produkt #1# eingefÃŒgt', 'wpsg'), $product_data['name']));
@@ -723,6 +725,5 @@
 		} // public function template_redirect()
 
-		public function basket_updateProduktFromSession(&$product_index, &$stock)
-		{
+		public function basket_updateProduktFromSession(&$product_index, &$stock) {
 
 			$product_key = $_SESSION['wpsg']['basket'][$product_index]['id'];
@@ -834,13 +835,11 @@
 		} // public function mail_row($index, $produkt)
 
-		public function order_view_row(&$p, $i)
-		{
-
-			if (substr(wpsg_getStr($p['product_key']), 0, 3) == 'abo')
-			{
+		public function order_view_row(&$p, $i) {
+
+			if (substr(wpsg_getStr($p['product_key']), 0, 3) == 'abo') {
 
 				$this->shop->view['wpsg_mod_abo']['order'] = $this->shop->cache->loadOrder($this->getOrderIDFromKey($p['product_key']));
 				$this->shop->view['wpsg_mod_abo']['product'] = $this->shop->cache->loadProduct($this->shop->getProduktID($p['product_key']));
-				$this->shop->view['wpsg_mod_abo']['wpsg_mod_abo_durration_menge'] = $p['menge'] * $this->shop->view['wpsg_mod_abo']['product']['wpsg_mod_abo_durration'];
+				$this->shop->view['wpsg_mod_abo']['wpsg_mod_abo_durration_menge'] = $p['amount'] * $this->shop->view['wpsg_mod_abo']['product']['wpsg_mod_abo_durration'];
 
 				return $this->shop->render(WPSG_PATH_VIEW.'/mods/mod_abo/order_view_row.phtml');
@@ -1323,17 +1322,17 @@
             $customer_address = $this->db->fetchRow("SELECT * FROM `".WPSG_TBL_ADRESS."` WHERE `id` = '".wpsg_q($customer_db_data['adress_id'])."' ");
              
-            $_SESSION['wpsg']['checkout']['firma'] = $customer_address['firma'];
-            $_SESSION['wpsg']['checkout']['title'] = $customer_address['title'];
-            $_SESSION['wpsg']['checkout']['vname'] = $customer_address['vname'];
-            $_SESSION['wpsg']['checkout']['name'] = $customer_address['name'];
-            $_SESSION['wpsg']['checkout']['email'] = $customer_db_data['email'];
-            $_SESSION['wpsg']['checkout']['geb'] = $customer_address['geb'];
-            $_SESSION['wpsg']['checkout']['fax'] = $customer_address['fax'];
-            $_SESSION['wpsg']['checkout']['tel'] = $customer_address['tel'];
-            $_SESSION['wpsg']['checkout']['strasse'] = $customer_address['strasse'];
-            $_SESSION['wpsg']['checkout']['nr'] = $customer_address['nr'];
-            $_SESSION['wpsg']['checkout']['plz'] = $customer_address['plz'];
-            $_SESSION['wpsg']['checkout']['ort'] = $customer_address['ort'];
-            $_SESSION['wpsg']['checkout']['land'] = $customer_address['land'];
+            $_SESSION['wpsg']['checkout']['firma'] = wpsg_getStr($customer_address['firma']);
+            $_SESSION['wpsg']['checkout']['title'] = wpsg_getStr($customer_address['title']);
+            $_SESSION['wpsg']['checkout']['vname'] = wpsg_getStr($customer_address['vname']);
+            $_SESSION['wpsg']['checkout']['name'] = wpsg_getStr($customer_address['name']);
+            $_SESSION['wpsg']['checkout']['email'] = wpsg_getStr($customer_db_data['email']);
+            $_SESSION['wpsg']['checkout']['geb'] = wpsg_getStr($customer_address['geb']);
+            $_SESSION['wpsg']['checkout']['fax'] = wpsg_getStr($customer_address['fax']);
+            $_SESSION['wpsg']['checkout']['tel'] = wpsg_getStr($customer_address['tel']);
+            $_SESSION['wpsg']['checkout']['strasse'] = wpsg_getStr($customer_address['strasse']);
+            $_SESSION['wpsg']['checkout']['nr'] = wpsg_getStr($customer_address['nr']);
+            $_SESSION['wpsg']['checkout']['plz'] = wpsg_getStr($customer_address['plz']);
+            $_SESSION['wpsg']['checkout']['ort'] = wpsg_getStr($customer_address['ort']);
+            $_SESSION['wpsg']['checkout']['land'] = wpsg_getStr($customer_address['land']);
                         
             $oBasket = new wpsg_basket();
@@ -1407,6 +1406,5 @@
 		 * @param int $menge Anzahl an gekauften Produkten
 		 */
-		public function getAboExpiration($product_id, $menge, $start)
-		{
+		public function getAboExpiration($product_id, $menge, $start) {
 
 			$product_data = $this->shop->cache->loadProduct($product_id);
@@ -1629,10 +1627,11 @@
 		 * @return boolean
 		 */
-		public function sendAboRebuyMail($order_id, $product_key)
-		{
+		public function sendAboRebuyMail($order_id, $order_product_id) {
 
 			if ($this->shop->get_option('wpsg_mod_abo_wpsgmodabrebuy') != '1') return;
 
-			$product_data = $this->shop->cache->loadProduct($this->shop->getProduktID($product_key));
+			$oOrderProduct = wpsg_order_product::getInstance($order_product_id);
+						
+			$product_data = $this->shop->cache->loadProduct($oOrderProduct->getProductId());
 			$order_data = $this->shop->cache->loadOrder($order_id);
 			$customer_data = $this->shop->cache->loadKunden($order_data['k_id']);
@@ -1641,15 +1640,12 @@
 			$this->shop->view['customer'] = $customer_data;
 			$this->shop->view['order'] = $order_data;
-			$this->shop->view['rebuyLink'] = $this->getRebuyLink($order_id, $product_key);
-			$this->shop->view['allowRebuy'] = $this->canReBuyAbo($order_id, $product_key);
-
-			if ($this->shop->get_option('wpsg_htmlmail') === '1')
-			{
+			$this->shop->view['rebuyLink'] = $this->getRebuyLink($order_id, $order_product_id);
+			$this->shop->view['allowRebuy'] = $this->canReBuyAbo($order_id, $order_product_id);
+
+			if ($this->shop->get_option('wpsg_htmlmail') === '1') {
 
 				$mail_html = $this->shop->render(WPSG_PATH_VIEW.'/mods/mod_abo/mail_rebuy_html.phtml', false);
 
-			}
-			else
-			{
+			} else {
 
 				$mail_html = false;
@@ -1697,6 +1693,20 @@
 		} // public function canReBuyAbo($order_id, $product_key)
 
+        /**
+         * Gibt aus einem ProduktschlÃŒssel die BestellID zurÃŒck
+         * Hier ist der ProduktschlÃŒssel z.b. abo_{original_order_id}_{original_order_product_id}
+         * @param varchar ProduktKey
+         */
+        public function getOrderProductIDFromKey($product_key) {
+
+            $arData = explode('_', $product_key);
+
+            return wpsg_getInt($arData[2]);
+            
+        }
+        
 		/**
 		 * Gibt aus einem ProduktschlÃŒssel die BestellID zurÃŒck
+         * Hier ist der ProduktschlÃŒssel z.b. abo_{original_order_id}_{original_order_product_id}
 		 * @param varchar ProduktKey
 		 */
@@ -1705,5 +1715,5 @@
 			$arData = explode('_', $product_key);
 
-			return wpsg_getStr($arData[1]);
+			return wpsg_getInt($arData[1]);
 
 		} // public function getOrderIDFromKey($product_key)
@@ -1722,5 +1732,5 @@
 			$url .= ((strpos($url, '?') === false)?'?mod=wpsg_mod_abo':'&mod=wpsg_mod_abo');
 			$url .= ((strpos($url, '?') === false)?'?order_id=':'&order_id=').$order_id;
-			$url .= ((strpos($url, '?') === false)?'?product_key=':'&product_key=').$oOrderProduct->getProductKey();
+			$url .= ((strpos($url, '?') === false)?'?product_key=':'&order_product_id=').$order_product_id;
 
 			return $url;
Index: /views/mods/mod_abo/settings_edit.phtml
===================================================================
--- /views/mods/mod_abo/settings_edit.phtml	(revision 7812)
+++ /views/mods/mod_abo/settings_edit.phtml	(revision 7813)
@@ -71,5 +71,8 @@
 		wpsg_mod_abo::CUSTOMER_AUTO_DIRECT => __('VerlÃ€ngerung direkt stoppen', 'wpsg'),
 		wpsg_mod_abo::CUSTOMER_AUTO_MAIL => __('VerlÃ€ngerung ÃŒber Mail an Administrator stoppen', 'wpsg')
-	), $this->get_option('wpsg_mod_abo_autoexpire_customer'), array('help' => 'wpsg_mod_abo_autoexpire_customer')); ?>	
+	), $this->get_option('wpsg_mod_abo_autoexpire_customer'), array('help' => 'wpsg_mod_abo_autoexpire_customer')); ?>
+
+    <?php echo wpsg_drawForm_Input(false, __('CRON URL', 'wpsg'), site_url().'/?wpsg_cron=1', ['readonly' => true]); ?>
+	<?php echo wpsg_drawForm_Text(__('Letzter Cron Aufruf', 'wpsg'), wpsg_formatTimestamp($this->get_option('wpsg_mod_abo_cron_lastrun'))); ?>
 	
 </div>
Index: /wpshopgermany.php
===================================================================
--- /wpshopgermany.php	(revision 7812)
+++ /wpshopgermany.php	(revision 7813)
@@ -287,5 +287,5 @@
     add_action('wpsg_daily_hook', [$shop, 'wpsg_daily_hook']);
 
-    add_action('send_headers', [$shop, 'send_headers']);
+    add_action('send_headers', [$shop, 'send_headers'], 0);
 
 	$shop->callMods('load', array());
