Index: /controller/wpsg_ShopController.class.php
===================================================================
--- /controller/wpsg_ShopController.class.php	(revision 7708)
+++ /controller/wpsg_ShopController.class.php	(revision 7709)
@@ -1271,6 +1271,5 @@
 			$myReferer = "";
 
-			if ($this->get_option('wpsg_referer_requesturi') == '1')
-			{
+			if ($this->get_option('wpsg_referer_requesturi') == '1') {
 
 				if (function_exists('qtrans_convertURL'))
@@ -1287,25 +1286,17 @@
 				}
 
-			}
-			else
-			{
-
-				if (is_page())
-				{
+			} else {
+
+				if (is_page()) {
 
 					$myReferer = get_permalink(get_the_id());
 
-				}
-				else
-				{
-
-					if (wpsg_isSizedString($_SERVER['REDIRECT_URL']))
-					{
+				} else {
+
+					if (wpsg_isSizedString($_SERVER['REDIRECT_URL'])) {
 
 						$myReferer .= $_SERVER['REDIRECT_URL'];
 
-					}
-					else
-					{
+					} else {
 
 						$myReferer = "";
Index: /model/wpsg_product.class.php
===================================================================
--- /model/wpsg_product.class.php	(revision 7708)
+++ /model/wpsg_product.class.php	(revision 7709)
@@ -346,5 +346,4 @@
 		    
 		}
-		
 
 		public function getMinPrice($product_key = false)
Index: /mods/wpsg_mod_deliverynote.class.php
===================================================================
--- /mods/wpsg_mod_deliverynote.class.php	(revision 7708)
+++ /mods/wpsg_mod_deliverynote.class.php	(revision 7709)
@@ -843,12 +843,10 @@
 		 * Gibt die Texte fÃŒr das PDF in der korrekten Sprache und mit ÃŒbersetzen Platzhaltern zurÃŒck
 		 */
-		public function getTexte($order_id)
-		{
+		public function getTexte($order_id) {
 				
 			$arTexte = $this->shop->get_option("wpsg_mod_deliverynote_texte");
 				
-			foreach ($arTexte as $k => $v)
-			{
-		
+			foreach ($arTexte as $k => $v) {
+
 				$arTexte[$k]['text'] = $this->shop->replaceUniversalPlatzhalter(__($arTexte[$k]['text'], 'wpsg'), $order_id);
 		
Index: /mods/wpsg_mod_ordervars.class.php
===================================================================
--- /mods/wpsg_mod_ordervars.class.php	(revision 7708)
+++ /mods/wpsg_mod_ordervars.class.php	(revision 7709)
@@ -262,5 +262,5 @@
 			
 			if (isset($_SESSION['wpsg']['wpsg_mod_ordervars'])) {
-					
+
 				$db_data['bvars'] = serialize(@$_SESSION['wpsg']['wpsg_mod_ordervars']);
 				
@@ -269,12 +269,10 @@
 		}
 		 
-		public function order_view($order_id, &$arSidebarArray)
-		{
+		public function order_view($order_id, &$arSidebarArray) {
 
 			$arOV_db = $this->db->fetchAssoc("SELECT * FROM `".WPSG_TBL_ORDERVARS."` WHERE `deleted` != '1' ORDER BY `pos` ASC, `id` ASC ");
 			$arOV = array();
 
-			foreach ($arOV_db as $k => $ov)
-			{
+			foreach ($arOV_db as $k => $ov) {
 
 				$arOV[$ov['id']] = wpsg_array_merge(array(
@@ -320,6 +318,5 @@
 		}
 		
-		public function checkout_inner_prebutton(&$checkout_view) 
-		{ 
+		public function checkout_inner_prebutton(&$checkout_view) {
 						
 			$this->shop->view['wpsg_mod_ordervars']['data'] = $this->db->fetchAssoc("SELECT * FROM `".WPSG_TBL_ORDERVARS."` WHERE `deleted` != '1' ORDER BY `pos` ASC, `id` ASC ", "id");
@@ -355,14 +352,11 @@
 		} // public function mail_aftercalculation(&$order_id)
 		
-		public function replaceUniversalPlatzhalter(&$arReplace, $order_id = false, $kunden_id = false, $rechnung_id = false, $product_id = false, $product_index = false) 
-		{ 
-		
-			if ($order_id !== false && $order_id > 0)
-			{
+		public function replaceUniversalPlatzhalter(&$arReplace, $order_id = false, $kunden_id = false, $rechnung_id = false, $product_id = false, $product_index = false) {
+
+			if ($order_id !== false && $order_id > 0) {
 
 				$arOrderVars = $this->getOrderVarsByOrderID($order_id);
-				
-				foreach ((array)$arOrderVars as $k => $v)
-				{
+
+				foreach ((array)$arOrderVars as $k => $v) {
 					
 					$arReplace['/%ov_'.$v['id'].'%/'] = $v['value'];
@@ -430,6 +424,5 @@
 		 * Gibt alle Bestellvariablen aus der Konfiguration zurÃŒck, gefÃŒllt mit den Werten einer Bestellung
 		 */
-		public function getOrderVarsByOrderID($order_id)
-		{
+		public function getOrderVarsByOrderID($order_id) {
 			
 			$arOV = $this->db->fetchAssocField("SELECT `id` FROM `".WPSG_TBL_ORDERVARS."` WHERE `deleted` != '1' ORDER BY `pos` ASC, `id` ASC ");
@@ -439,7 +432,6 @@
 			$data = array();
 			
-			foreach ($arOV as $ov_id)
-			{
-				
+			foreach ($arOV as $ov_id) {
+
 				$data[] = array(
 					'id' => $ov_id,
@@ -449,5 +441,5 @@
 				
 			}
-			
+
 			return $data;
 			
@@ -467,16 +459,18 @@
 		 * Gibt den Wert einer Bestellvariable fÃŒr eine ID und eine Bestell ID zurÃŒck
 		 */
-		public function getValueByIdAndOrder($ov_id, $order_id)
-		{
+		public function getValueByIdAndOrder($ov_id, $order_id) {
 
 			$order_data = $this->shop->cache->loadOrder($order_id);
 			$ov_db = $this->db->fetchRow("SELECT * FROM `".WPSG_TBL_ORDERVARS."` WHERE `id` = '".wpsg_q($ov_id)."'");
-			$arOV_order = @unserialize($order_data['bvars']);
-			
+			$arOV_order = @unserialize($order_data['bvars']); if (!is_array($arOV_order)) $arOV_order = [];
+
+			// Typensicherheit
+            $arOV_orderInt = []; foreach ($arOV_order as $k => $v) $arOV_orderInt[intval($k)] = $v; $arOV_order = $arOV_orderInt;
+            $ov_id = intval($ov_id);
+
 			if (!isset($arOV_order[$ov_id])) return __('Keine Angabe', 'wpsg');
-			
-			if ($ov_db['typ'] == '1')
-			{
-				
+
+			if ($ov_db['typ'] == '1') {
+
 				// Auswahl
 				if ($arOV_order[$ov_id] == '')
@@ -485,7 +479,5 @@
 				}  
 				
-			}
-			else if ($ov_db['typ'] == '2')
-			{
+			} else if ($ov_db['typ'] == '2') {
 				
 				// Textfeld
@@ -528,3 +520,2 @@
 	} // class wpsg_mod_ordervars extends wpsg_mod_basic
 
-?>
Index: /mods/wpsg_mod_paypalapi.class.php
===================================================================
--- /mods/wpsg_mod_paypalapi.class.php	(revision 7708)
+++ /mods/wpsg_mod_paypalapi.class.php	(revision 7709)
@@ -730,5 +730,4 @@
 
 			    $saleID = $jsonData['resource']['id'];
-
 			    $order_id = intval($this->db->fetchOne("SELECT `target_id` FROM `".WPSG_TBL_META."` WHERE `meta_table` = 'WPSG_TBL_ORDER' AND `meta_key` = 'wpsg_mod_paypalapi_saleid' AND `meta_value` = '".wpsg_q($saleID)."' "));
 			    $amount = $jsonData['resource']['amount']['value'];
@@ -756,4 +755,5 @@
             } else if ($this->shop->get_option('wpsg_mod_paypalapi_version') === 'v2' && $this->shop->setPayMent($oOrder->id, $amount) && $payment_state === 'COMPLETED' && $sale_state === 'COMPLETED') {
 
+                $oOrder->log(__('PayPal Status', 'wpsg'), print_r($result, true));
                 $oOrder->log(__('PayPalAPI V2 WebHook Erfolg', 'wpsg'), print_r($jsonData, 1));
 
Index: /mods/wpsg_mod_productvars.class.php
===================================================================
--- /mods/wpsg_mod_productvars.class.php	(revision 7708)
+++ /mods/wpsg_mod_productvars.class.php	(revision 7709)
@@ -752,5 +752,5 @@
 			$order_data = $this->shop->cache->loadOrder($order_id);
 			$arPVars = @unserialize($order_data['pvars']);
-			$arPVars = $arPVars[$product_index];
+			$arPVars = wpsg_getArray($arPVars[$product_index]);
 
 			$arReturn = array();
Index: /views/mods/mod_deliverynote/deliverynote_pdf.phtml
===================================================================
--- /views/mods/mod_deliverynote/deliverynote_pdf.phtml	(revision 7708)
+++ /views/mods/mod_deliverynote/deliverynote_pdf.phtml	(revision 7709)
@@ -121,8 +121,7 @@
 
 			}
-			
-			
+
 			// Benutzerdefinierte Felder
-			$arTexte = $shop->callMod('wpsg_mod_deliverynote', 'getTexte', array($shop->view['data']['id'])); 
+			$arTexte = $shop->callMod('wpsg_mod_deliverynote', 'getTexte', array($shop->view['order']['id']));
 			
 			foreach ((array)$arTexte as $text)
Index: /views/mods/mod_productvars/settings_edit.phtml
===================================================================
--- /views/mods/mod_productvars/settings_edit.phtml	(revision 7708)
+++ /views/mods/mod_productvars/settings_edit.phtml	(revision 7709)
@@ -49,5 +49,5 @@
 <div>
 	<ul class="nav nav-tabs">
-  		<li role="presentation" class="active"><a href="#tab1" role="tab" data-toggle="tab"><?php echo __('Globale Produktvarianten', 'wpsg'); ?></a></li>
+  		<li role="presentation" class="active"><a href="#tab1" role="tab" data-toggle="tab"><?php echo __('Produktvariablen', 'wpsg'); ?></a></li>
   		<li role="presentation"><a href="#tab2" role="tab" data-toggle="tab"><?php echo __('Einstellungen', 'wpsg'); ?></a></li>  
 	</ul>
