Index: /controller/wpsg_BasketController.class.php
===================================================================
--- /controller/wpsg_BasketController.class.php	(revision 5737)
+++ /controller/wpsg_BasketController.class.php	(revision 5740)
@@ -324,5 +324,5 @@
 		 * Verarbeitet die Anfragen und leitet anschlieÃend weiter
 		 */
-		public function wp_loaded()
+		public function template_redirect()
 		{
 			 
@@ -947,5 +947,5 @@
 			} 
 			
-		} // public function content_filter()
+		} // public function template_redirect()
 				
 	} // class wpsg_BasketController extends wpsg_SystemController
Index: /controller/wpsg_ShopController.class.php
===================================================================
--- /controller/wpsg_ShopController.class.php	(revision 5737)
+++ /controller/wpsg_ShopController.class.php	(revision 5740)
@@ -622,13 +622,8 @@
 							wpsg_trim($_REQUEST['wpsg']['checkout'], false)
 						)
-					);
-					
-				}
-				  
-				$this->basket->initFromSession();
-				
-				// Wenn Checkout abgeschickt wurde, dann Bestellung speichern
-				if (wpsg_isSizedArray($_REQUEST['wpsg']['checkout'])) $this->basket->save(false);
-								
+					); 
+					
+				}
+												
 			} 
 			
@@ -2480,25 +2475,4 @@
 			$this->checkEscape();
 			
-			if (wpsg_isSizedString($_REQUEST['wpsg_mod']) && wpsg_isSizedString($_REQUEST['wpsg_action']))
-			{
-			
-				if ($this->hasModulFunction($_REQUEST['wpsg_mod'], $_REQUEST['wpsg_action'].'Redirect'))
-				{
-				
-					$this->callMod($_REQUEST['wpsg_mod'], $_REQUEST['wpsg_action'].'Redirect'); return;
-									
-				}
-				
-			}
-			
-			$this->callMods('template_redirect');
-			
-		} // public function template_redirect()
-		
-		public function wp_load()
-		{
-			
-			load_plugin_textdomain('wpsg', false, dirname( plugin_basename( __FILE__ ) ).'/../lang/');
-			
 			$this->arStatus = array(
 				self::STATUS_EINGEGANGEN => __('Eingegangen', 'wpsg'),								
@@ -2513,35 +2487,51 @@
 				self::STATUS_UNVOLLSTAENDIG => __('UnvollstÃ€ndig', 'wpsg'),
 			);
-
+			
 			// Das Land muss vor addShipping gesetzt werden
 			if (isset($_REQUEST['wpsg']['checkout']['shipping_land'])) $_SESSION['wpsg']['checkout']['shipping_land'] = $_REQUEST['wpsg']['checkout']['shipping_land'];
 			if (isset($_REQUEST['wpsg']['checkout']['land'])) $_SESSION['wpsg']['checkout']['land'] = $_REQUEST['wpsg']['checkout']['land'];
 			
+			$this->basket->initFromSession();
+			
 			$this->callMods('addShipping', array(&$this->arShipping));
 			$this->callMods('addPayment', array(&$this->arPayment));
-
+			
 			if (!is_admin())
 			{
-				
-				// Wenn der Debug Modus an ist und die Debug URL aufgerufen wurde sollen hier die Infos angezeigt werden
-				if (wpsg_isSizedInt($_REQUEST['wpsg_debug']) && $this->get_option('wpsg_debugModus') == '1')
-				{
-				
-					die($this->render(WPSG_PATH_VIEW.'/admin/debugInfo.phtml', false));
-				
-				}	
-				
+								 				
 				// Sollte die Session noch nicht mit Werten gefÃŒllt sein dann hier die Kundenvoreinstellungen laden
 				$this->checkCustomerPreset();
 				
 				// Modulverarbeitung
-				$this->callMods('wp_loaded');
+				$this->callMods('template_redirect');
+				 
+				if (wpsg_isSizedString($_REQUEST['wpsg_mod']) && wpsg_isSizedString($_REQUEST['wpsg_action']))
+				{
+				
+					if ($this->hasModulFunction($_REQUEST['wpsg_mod'], $_REQUEST['wpsg_action'].'Redirect'))
+					{
+					
+						$this->callMod($_REQUEST['wpsg_mod'], $_REQUEST['wpsg_action'].'Redirect'); return;
+										
+					}
+					
+				}
 				
 				// Verarbeitung im BasketController
-				$this->basketController->wp_loaded();
-				
-			}
-			
-		}
+				$this->basketController->template_redirect();
+			
+				// Wenn Checkout abgeschickt wurde, dann Bestellung speichern
+				if (wpsg_isSizedArray($_REQUEST['wpsg']['checkout'])) $this->basket->save(false);
+				
+			}
+			
+		} // public function template_redirect()
+		
+		public function wp_load()
+		{
+			
+			load_plugin_textdomain('wpsg', false, dirname( plugin_basename( __FILE__ ) ).'/../lang/');
+			   
+		} // public function wp_load()
 		 		
 		/**
@@ -3816,5 +3806,5 @@
 				}
 
-				$this->arShipping = $arShippingNew;
+				$this->arShipping = $arShippingNew;				
 				$this->bShippingMerged = true;
 				
Index: /lib/functions.inc.php
===================================================================
--- /lib/functions.inc.php	(revision 5737)
+++ /lib/functions.inc.php	(revision 5740)
@@ -867,24 +867,16 @@
 	function wpsg_trim($value, $clearEntry = '')
 	{
+
+		if (!is_array($clearEntry)) $testClearEntry = array($clearEntry);
+		else $testClearEntry = $clearEntry;
 		
 		if (is_array($value))
 		{
-			
+
 			foreach ($value as $k => $v)
 			{
-
-				if ($clearEntry === false)
-				{
-					
-					$value[$k] = wpsg_trim($v);	
-					
-				}
-				else
-				{
-								
-					if (is_string($v) && trim($v) == '' || trim($v) == $clearEntry) unset($value[$k]);
-					else $value[$k] = wpsg_trim($v);
-					
-				}
+				
+				$value[$k] = wpsg_trim($v, $clearEntry);
+				if ($clearEntry !== false && in_array($value[$k], $testClearEntry)) unset($value[$k]);
 				
 			}
@@ -895,5 +887,5 @@
 			
 			$value = trim($value);
-			
+						
 		}
 		
Index: /lib/wpsg_basket.class.php
===================================================================
--- /lib/wpsg_basket.class.php	(revision 5737)
+++ /lib/wpsg_basket.class.php	(revision 5740)
@@ -668,5 +668,5 @@
 					}
 	
-					$k_id = $this->db->ImportQuery(WPSG_TBL_KU, $data);
+					$k_id = $this->db->ImportQuery(WPSG_TBL_KU, $data);					
 					$knr = $this->shop->buildKNR($k_id);
 					
@@ -1136,5 +1136,5 @@
 						else if ($c['typ'] == '0')
 						{
-							
+						 
 							// Texte
 							if (trim($this->arCheckout['custom'][$c_id]) == '')
@@ -1152,5 +1152,5 @@
 					
 				}
-				
+
 			}
 
@@ -1169,4 +1169,9 @@
 				{
 					 
+					echo '<pre>';
+					debug_print_backtrace();
+					echo '</pre>';
+					die();
+					
 					$this->shop->addFrontendError(__('Bitte eine gÃŒltige Versandart auswÃ€hlen.', 'wpsg'));
 					$_SESSION['wpsg']['errorFields'][] = 'shipping';
@@ -1585,5 +1590,5 @@
 						 * Ist fÃŒr die Auswahl der LÃ€nder, Zahlungsarten und Versandarten im Warenkorb nÃ¶tig geworden
 						 */
-						if (wpsg_isSizedInt($arReturn['checkout']['shipping']) && !array_key_exists($arReturn['checkout']['shipping'], $this->shop->arShipping)) 
+						if (wpsg_isSizedInt($arReturn['checkout']['shipping']) && !@array_key_exists($arReturn['checkout']['shipping'], $this->shop->arShipping)) 
 						{
 							
Index: /model/wpsg_product.class.php
===================================================================
--- /model/wpsg_product.class.php	(revision 5737)
+++ /model/wpsg_product.class.php	(revision 5740)
@@ -278,5 +278,5 @@
 			
 			$arAllowedPayment = explode(',', $this->allowedpayments);
-			$arAllowedPayment = wpsg_trim($arAllowedPayment, '0');
+			$arAllowedPayment = wpsg_trim($arAllowedPayment, array('', '0'));
 			
 			if (wpsg_isSizedArray($arAllowedPayment))
@@ -316,5 +316,5 @@
 				
 			$arAllowedShipping = explode(',', $this->allowedshipping);
-			$arAllowedShipping = wpsg_trim($arAllowedShipping, '0');
+			$arAllowedShipping = wpsg_trim($arAllowedShipping, array('', '0'));
 			
 			if (wpsg_isSizedArray($arAllowedShipping))
@@ -324,4 +324,6 @@
 		
 			}
+			
+			return false;
 				
 		} // public function hasLimitedShipping()
Index: /mods/wpsg_mod_abo.class.php
===================================================================
--- /mods/wpsg_mod_abo.class.php	(revision 5737)
+++ /mods/wpsg_mod_abo.class.php	(revision 5740)
@@ -377,5 +377,5 @@
 		} // public function admin_emailconf()
 				
-		public function wp_loaded()
+		public function template_redirect()
 		{
 			
@@ -456,5 +456,5 @@
 			$this->shop->redirect($this->shop->getURL(wpsg_ShopController::URL_BASKET));
 						
-		} // public function wp_loaded()
+		} // public function template_redirect()
 		  
 		public function basket_updateProduktFromSession(&$product_index, &$stock)
Index: /mods/wpsg_mod_basic.class.php
===================================================================
--- /mods/wpsg_mod_basic.class.php	(revision 5737)
+++ /mods/wpsg_mod_basic.class.php	(revision 5740)
@@ -573,5 +573,8 @@
 		public function calcPayment(&$arBasket) { }
 		
-		/** Wird vor der Ausgabe des Contents aufgerufen */
+		/** 
+		 * Wird vor der Ausgabe des Contents aufgerufen
+		 * DEPRECATED: Durch template_redirect ersetzt, da ich da mehr Funktionen nutzen kann
+		 */
 		public function wp_loaded() { }
 		
Index: /mods/wpsg_mod_billsafe.class.php
===================================================================
--- /mods/wpsg_mod_billsafe.class.php	(revision 5737)
+++ /mods/wpsg_mod_billsafe.class.php	(revision 5740)
@@ -556,5 +556,5 @@
 			}
 			
-		} // public function wp_loaded()
+		} // public function template_redirect()
 
 		public function setOrderStatus($order_id, $status_id, $inform) 
Index: /mods/wpsg_mod_cab.class.php
===================================================================
--- /mods/wpsg_mod_cab.class.php	(revision 5737)
+++ /mods/wpsg_mod_cab.class.php	(revision 5740)
@@ -314,5 +314,5 @@
 		} // public function order_ajax()
 		
-		public function wp_loaded() 
+		public function template_redirect() 
 		{ 
 				   
@@ -434,5 +434,5 @@
 			}
 			
-		} // public function wp_loaded() 
+		} // public function template_redirect() 
 		
 		public function calcPayment(&$arBasket) 
Index: /mods/wpsg_mod_crefopay.class.php
===================================================================
--- /mods/wpsg_mod_crefopay.class.php	(revision 5737)
+++ /mods/wpsg_mod_crefopay.class.php	(revision 5740)
@@ -206,8 +206,192 @@
 				
 		} // public function mail_payment()
-		
-		public function wp_loaded() 
-		{
-					
+		 
+		public function order_ajax()
+		{
+			
+			if (wpsg_isSizedString($_REQUEST['do'], 'status'))
+			{
+							
+				$bOK = $this->call_status($_REQUEST['edit_id']);
+				
+				if ($bOK !== false) $this->shop->addBackendMessage(__('CrefoPay Status wurde erfolgreich abgefragt.', 'wpsg'));
+				else $this->shop->addBackendError(__('CrefoPay Status konnte nicht abgefragt werden. Bitte beachten Sie das Bestellprotokoll.', 'wpsg'));
+				
+				$this->shop->redirect(WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Order&action=view&edit_id='.$_REQUEST['edit_id']);
+				
+			}
+			else if (wpsg_isSizedString($_REQUEST['do'], 'cancel'))
+			{
+								
+				$bOK = $this->call_cancel($_REQUEST['edit_id']);
+				
+				if ($bOK !== false) 
+				{
+					
+					$this->shop->addBackendMessage(__('CrefoPay Zahlungsabbruch wurde erfolgreich durchgefÃŒhrt. Der Kunde kann die Zahlung nun ÃŒber die BestellabschluÃseite (Link in E-Mail) neu starten.', 'wpsg'));
+					
+					// Zahlungsstatus auffrischen
+					$this->call_status($_REQUEST['edit_id'], true);
+					
+				}
+				else $this->shop->addBackendError(__('CrefoPay Zahlungsabbruch konnte nicht ÃŒbermittelt werden. Bitte beachten Sie das Bestellprotokoll.', 'wpsg'));
+			 	
+				$this->shop->redirect(WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Order&action=view&edit_id='.$_REQUEST['edit_id']);
+				
+			}
+			else if (wpsg_isSizedString($_REQUEST['do'], 'capture'))
+			{
+				
+				$bOK = $this->call_capture($_REQUEST['edit_id']);
+				
+				if ($bOK !== false)
+				{
+					
+					$this->shop->addBackendMessage(__('CrefoPay Zahlungseinzug wurde erfolgreich durchgefÃŒhrt.', 'wpsg'));
+
+					// Zahlungsstatus auffrischen
+					$this->call_status($_REQUEST['edit_id'], true);
+					
+				}
+				else $this->shop->addBackendError(__('CrefoPay Zahlungseinzug konnte nicht ÃŒbermittelt werden. Bitte beachten Sie das Bestellprotokoll.', 'wpsg'));
+					
+				$this->shop->redirect(WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Order&action=view&edit_id='.$_REQUEST['edit_id']);
+				
+			}
+			else if (wpsg_isSizedString($_REQUEST['do'], 'refund'))
+			{
+				
+				$bOK = $this->call_refund($_REQUEST['edit_id']);
+				
+				if ($bOK !== false)
+				{
+					
+					$this->shop->addBackendMessage(__('CrefoPay RÃŒckerstattung wurde erfolgreich durchgefÃŒhrt.', 'wpsg'));
+					
+					// Zahlungsstatus auffrischen
+					$this->call_status($_REQUEST['edit_id'], true);
+					
+				}
+				else $this->shop->addBackendError(__('CrefoPay RÃŒckerstattung konnte nicht ÃŒbermittelt werden. Bitte beachten Sie das Bestellprotokoll.', 'wpsg'));
+				
+				$this->shop->redirect(WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Order&action=view&edit_id='.$_REQUEST['edit_id']);
+				
+			}
+			else if (wpsg_isSizedString($_REQUEST['do'], 'finish'))
+			{
+				
+				$bOK = $this->call_finish($_REQUEST['edit_id']);
+				
+				if ($bOK !== false)
+				{
+					
+					$this->shop->addBackendMessage(__('CrefoPay Abschluss wurde erfolgreich durchgefÃŒhrt.', 'wpsg'));
+										
+				}
+				else $this->shop->addBackendError(__('CrefoPay Abschluss konnte nicht ÃŒbermittelt werden. Bitte beachten Sie das Bestellprotokoll.', 'wpsg'));
+				
+				$this->shop->redirect(WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Order&action=view&edit_id='.$_REQUEST['edit_id']);
+				
+			}
+			 
+		} // public function order_ajax()
+		
+		public function order_view_afterpayment(&$order_id)
+		{
+			
+			$this->shop->render(WPSG_PATH_VIEW.'/mods/mod_crefopay/order_view_afterpayment.phtml');
+			
+		} // public function order_view_sidebar(&$order_id)
+		
+		public function setOrderStatus($order_id, $status_id, $inform)
+		{
+
+			// Nur bei Stornierung etwas machen
+			if (!in_array($status_id, array('500')) || $this->mns === true) return;
+			
+			$oOrder = wpsg_order::getInstance($order_id);
+			
+			if ($status_id == '500' && $oOrder->getPaymentID() == $this->id) $response = $this->call_refund($order_id);
+			
+		}
+		
+		public function getPaymentName($payment_type, $order_id, &$payment_name) 
+		{ 
+			
+			if ($payment_type == $this->id) $payment_name = $this->getOrderPaymentName($order_id);
+			
+		} // public function getPaymentName($payment_type, $order_id)
+		
+		public function template_redirect() 
+		{ 
+
+			if (wpsg_isSizedString($_REQUEST['wpsg_mod'], 'wpsg_mod_crefopay') && wpsg_isSizedString($_REQUEST['wpsg_action'], 'doOrder'))
+			{
+				
+				// Hier die PrÃŒfung durchfÃŒhren und ggf. umleiten
+
+				// Zahlungsart auf CrefoPay setzen
+				$_SESSION['wpsg']['checkout']['payment'] = $this->id;
+				$this->shop->basket->arCheckout['payment'] = $this->id;
+				
+				// Bestellung abschlieÃen
+				$this->shop->basket->initFromSession();
+								
+				$bOK = $this->shop->basket->checkCheckout();
+				
+				if ($bOK)
+				{
+						
+					// Jetzt noch Module checken
+					$bModulError = false; $this->shop->callMods('checkFinaly', array(&$bModulError));
+						
+					if ($bModulError === true)
+					{
+				
+						$this->shop->redirect($this->shop->getURL(wpsg_ShopController::URL_CHECKOUT));
+				
+					}	
+					else 
+					{
+					
+						// Bestellung in Session sichern
+						$_SESSION['wpsg']['wpsg_mod_crefopay']['wpsg_preCommit'] = $_SESSION['wpsg'];
+												
+						$order_id = $this->shop->basket->save();
+							
+						$_SESSION['wpsg']['wpsg_mod_crefopay']['order_id'] = $order_id;
+						
+						$this->shop->redirect($this->getDoPayUrl($order_id));
+						
+					} 
+						
+				}
+				else
+				{
+						
+					$this->shop->redirect($this->shop->getURL(wpsg_ShopController::URL_CHECKOUT));
+						
+				}
+				
+			}
+			else if (isset($_REQUEST['orderNo']) && wpsg_isSizedInt($_SESSION['wpsg']['wpsg_mod_crefopay']['order_id']))
+			{
+
+				// Alte Bestellung aus Session laden
+				$oOrder = wpsg_order::getInstance($_SESSION['wpsg']['wpsg_mod_crefopay']['order_id']);
+				
+				if ($oOrder->onr != $_REQUEST['orderNo']) die($this->shop->throwErrorCode('4000_1'));
+
+				// Alte Bestellung lÃ¶schen
+				$oOrder->delete();
+				
+				// Hier kommt der Kunde zurÃŒck in den Warenkorb um die Bestellung abzuÃ€ndern
+				$_SESSION['wpsg'] = $_SESSION['wpsg']['wpsg_mod_crefopay']['wpsg_preCommit'];
+
+				// Zum Warenkorb umleiten
+				$this->shop->redirect($this->shop->getURL(wpsg_ShopController::URL_BASKET));
+				
+			}
+			
 			if (wpsg_isSizedString($_REQUEST['wpsg_plugin'], 'wpsg_mod_crefopay'))
 			{
@@ -373,193 +557,4 @@
 					
 				}
-				
-			}
-						
-		} // public function wp_loaded()
-		
-		public function order_ajax()
-		{
-			
-			if (wpsg_isSizedString($_REQUEST['do'], 'status'))
-			{
-							
-				$bOK = $this->call_status($_REQUEST['edit_id']);
-				
-				if ($bOK !== false) $this->shop->addBackendMessage(__('CrefoPay Status wurde erfolgreich abgefragt.', 'wpsg'));
-				else $this->shop->addBackendError(__('CrefoPay Status konnte nicht abgefragt werden. Bitte beachten Sie das Bestellprotokoll.', 'wpsg'));
-				
-				$this->shop->redirect(WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Order&action=view&edit_id='.$_REQUEST['edit_id']);
-				
-			}
-			else if (wpsg_isSizedString($_REQUEST['do'], 'cancel'))
-			{
-								
-				$bOK = $this->call_cancel($_REQUEST['edit_id']);
-				
-				if ($bOK !== false) 
-				{
-					
-					$this->shop->addBackendMessage(__('CrefoPay Zahlungsabbruch wurde erfolgreich durchgefÃŒhrt. Der Kunde kann die Zahlung nun ÃŒber die BestellabschluÃseite (Link in E-Mail) neu starten.', 'wpsg'));
-					
-					// Zahlungsstatus auffrischen
-					$this->call_status($_REQUEST['edit_id'], true);
-					
-				}
-				else $this->shop->addBackendError(__('CrefoPay Zahlungsabbruch konnte nicht ÃŒbermittelt werden. Bitte beachten Sie das Bestellprotokoll.', 'wpsg'));
-			 	
-				$this->shop->redirect(WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Order&action=view&edit_id='.$_REQUEST['edit_id']);
-				
-			}
-			else if (wpsg_isSizedString($_REQUEST['do'], 'capture'))
-			{
-				
-				$bOK = $this->call_capture($_REQUEST['edit_id']);
-				
-				if ($bOK !== false)
-				{
-					
-					$this->shop->addBackendMessage(__('CrefoPay Zahlungseinzug wurde erfolgreich durchgefÃŒhrt.', 'wpsg'));
-
-					// Zahlungsstatus auffrischen
-					$this->call_status($_REQUEST['edit_id'], true);
-					
-				}
-				else $this->shop->addBackendError(__('CrefoPay Zahlungseinzug konnte nicht ÃŒbermittelt werden. Bitte beachten Sie das Bestellprotokoll.', 'wpsg'));
-					
-				$this->shop->redirect(WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Order&action=view&edit_id='.$_REQUEST['edit_id']);
-				
-			}
-			else if (wpsg_isSizedString($_REQUEST['do'], 'refund'))
-			{
-				
-				$bOK = $this->call_refund($_REQUEST['edit_id']);
-				
-				if ($bOK !== false)
-				{
-					
-					$this->shop->addBackendMessage(__('CrefoPay RÃŒckerstattung wurde erfolgreich durchgefÃŒhrt.', 'wpsg'));
-					
-					// Zahlungsstatus auffrischen
-					$this->call_status($_REQUEST['edit_id'], true);
-					
-				}
-				else $this->shop->addBackendError(__('CrefoPay RÃŒckerstattung konnte nicht ÃŒbermittelt werden. Bitte beachten Sie das Bestellprotokoll.', 'wpsg'));
-				
-				$this->shop->redirect(WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Order&action=view&edit_id='.$_REQUEST['edit_id']);
-				
-			}
-			else if (wpsg_isSizedString($_REQUEST['do'], 'finish'))
-			{
-				
-				$bOK = $this->call_finish($_REQUEST['edit_id']);
-				
-				if ($bOK !== false)
-				{
-					
-					$this->shop->addBackendMessage(__('CrefoPay Abschluss wurde erfolgreich durchgefÃŒhrt.', 'wpsg'));
-										
-				}
-				else $this->shop->addBackendError(__('CrefoPay Abschluss konnte nicht ÃŒbermittelt werden. Bitte beachten Sie das Bestellprotokoll.', 'wpsg'));
-				
-				$this->shop->redirect(WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Order&action=view&edit_id='.$_REQUEST['edit_id']);
-				
-			}
-			 
-		} // public function order_ajax()
-		
-		public function order_view_afterpayment(&$order_id)
-		{
-			
-			$this->shop->render(WPSG_PATH_VIEW.'/mods/mod_crefopay/order_view_afterpayment.phtml');
-			
-		} // public function order_view_sidebar(&$order_id)
-		
-		public function setOrderStatus($order_id, $status_id, $inform)
-		{
-
-			// Nur bei Stornierung etwas machen
-			if (!in_array($status_id, array('500')) || $this->mns === true) return;
-			
-			$oOrder = wpsg_order::getInstance($order_id);
-			
-			if ($status_id == '500' && $oOrder->getPaymentID() == $this->id) $response = $this->call_refund($order_id);
-			
-		}
-		
-		public function getPaymentName($payment_type, $order_id, &$payment_name) 
-		{ 
-			
-			if ($payment_type == $this->id) $payment_name = $this->getOrderPaymentName($order_id);
-			
-		} // public function getPaymentName($payment_type, $order_id)
-		
-		public function template_redirect() 
-		{ 
-
-			if (wpsg_isSizedString($_REQUEST['wpsg_mod'], 'wpsg_mod_crefopay') && wpsg_isSizedString($_REQUEST['wpsg_action'], 'doOrder'))
-			{
-				
-				// Hier die PrÃŒfung durchfÃŒhren und ggf. umleiten
-
-				// Zahlungsart auf CrefoPay setzen
-				$_SESSION['wpsg']['checkout']['payment'] = $this->id;
-				$this->shop->basket->arCheckout['payment'] = $this->id;
-				
-				// Bestellung abschlieÃen
-				$this->shop->basket->initFromSession();
-								
-				$bOK = $this->shop->basket->checkCheckout();
-				
-				if ($bOK)
-				{
-						
-					// Jetzt noch Module checken
-					$bModulError = false; $this->shop->callMods('checkFinaly', array(&$bModulError));
-						
-					if ($bModulError === true)
-					{
-				
-						$this->shop->redirect($this->shop->getURL(wpsg_ShopController::URL_CHECKOUT));
-				
-					}	
-					else 
-					{
-					
-						// Bestellung in Session sichern
-						$_SESSION['wpsg']['wpsg_mod_crefopay']['wpsg_preCommit'] = $_SESSION['wpsg'];
-												
-						$order_id = $this->shop->basket->save();
-							
-						$_SESSION['wpsg']['wpsg_mod_crefopay']['order_id'] = $order_id;
-						
-						$this->shop->redirect($this->getDoPayUrl($order_id));
-						
-					} 
-						
-				}
-				else
-				{
-						
-					$this->shop->redirect($this->shop->getURL(wpsg_ShopController::URL_CHECKOUT));
-						
-				}
-				
-			}
-			else if (isset($_REQUEST['orderNo']) && wpsg_isSizedInt($_SESSION['wpsg']['wpsg_mod_crefopay']['order_id']))
-			{
-
-				// Alte Bestellung aus Session laden
-				$oOrder = wpsg_order::getInstance($_SESSION['wpsg']['wpsg_mod_crefopay']['order_id']);
-				
-				if ($oOrder->onr != $_REQUEST['orderNo']) die($this->shop->throwErrorCode('4000_1'));
-
-				// Alte Bestellung lÃ¶schen
-				$oOrder->delete();
-				
-				// Hier kommt der Kunde zurÃŒck in den Warenkorb um die Bestellung abzuÃ€ndern
-				$_SESSION['wpsg'] = $_SESSION['wpsg']['wpsg_mod_crefopay']['wpsg_preCommit'];
-
-				// Zum Warenkorb umleiten
-				$this->shop->redirect($this->shop->getURL(wpsg_ShopController::URL_BASKET));
 				
 			}
Index: /mods/wpsg_mod_downloadplus.class.php
===================================================================
--- /mods/wpsg_mod_downloadplus.class.php	(revision 5737)
+++ /mods/wpsg_mod_downloadplus.class.php	(revision 5740)
@@ -1050,5 +1050,5 @@
 		} // private function indivPDF($src_file, $trg_file)
 		
-		public function wp_loaded()
+		public function template_redirect()
 		{
 			
Index: /mods/wpsg_mod_downloadprodukte.class.php
===================================================================
--- /mods/wpsg_mod_downloadprodukte.class.php	(revision 5737)
+++ /mods/wpsg_mod_downloadprodukte.class.php	(revision 5740)
@@ -535,5 +535,5 @@
 		 * wird ausgefÃŒhrt wenn der Kunde den Link aus seiner Mail aufruft
 		 */
-		public function wp_loaded()
+		public function template_redirect()
 		{
 			
@@ -684,5 +684,5 @@
 			}	
 			
-		}// public function wp_loaded()
+		}// public function template_redirect()
  
 		/**
Index: /mods/wpsg_mod_flexipay.class.php
===================================================================
--- /mods/wpsg_mod_flexipay.class.php	(revision 5737)
+++ /mods/wpsg_mod_flexipay.class.php	(revision 5740)
@@ -257,5 +257,5 @@
 		} // public function order_done(&$order_id, &$done_view)
 		
-		public function wp_loaded()
+		public function template_redirect()
 		{
 		
@@ -321,5 +321,5 @@
 			}
 		
-		} // public function wp_loaded()
+		} // public function template_redirect()
 		
 		public function mail_payment()
Index: /mods/wpsg_mod_giropay.class.php
===================================================================
--- /mods/wpsg_mod_giropay.class.php	(revision 5737)
+++ /mods/wpsg_mod_giropay.class.php	(revision 5740)
@@ -278,5 +278,5 @@
 		} // public function order_done(&$order_id, &$done_view)
 		
-		public function wp_loaded()
+		public function template_redirect()
 		{
 		
@@ -394,5 +394,5 @@
 			}
 			
-		} // public function wp_loaded()
+		} // public function template_redirect()
 		
 		public function mail_payment()
Index: /mods/wpsg_mod_icp.class.php
===================================================================
--- /mods/wpsg_mod_icp.class.php	(revision 5737)
+++ /mods/wpsg_mod_icp.class.php	(revision 5740)
@@ -256,5 +256,5 @@
 		} // public function order_done(&$order_id, &$done_view)
 			
-		public function wp_loaded()
+		public function template_redirect()
 		{
 		
@@ -320,5 +320,5 @@
 			}
 		
-		} // public function wp_loaded()
+		} // public function template_redirect()
 		
 		public function mail_payment()
Index: /mods/wpsg_mod_kundenverwaltung.class.php
===================================================================
--- /mods/wpsg_mod_kundenverwaltung.class.php	(revision 5737)
+++ /mods/wpsg_mod_kundenverwaltung.class.php	(revision 5740)
@@ -512,5 +512,5 @@
 		} // public function admin_emailconf()
 		
-		public function wp_loaded() 
+		public function template_redirect() 
 		{ 
 			
@@ -907,5 +907,5 @@
 			}
 			
-		} // public function wp_loaded()
+		} // public function template_redirect()
 		
 		public function content_filter(&$content) 
Index: /mods/wpsg_mod_micropayment.class.php
===================================================================
--- /mods/wpsg_mod_micropayment.class.php	(revision 5737)
+++ /mods/wpsg_mod_micropayment.class.php	(revision 5740)
@@ -612,5 +612,5 @@
 		} // public function mail_payment()
 		
-		public function wp_loaded() 
+		public function template_redirect() 
 		{
 			
@@ -750,5 +750,5 @@
 			}
 				
-		} // public function wp_loaded()			
+		} // public function template_redirect()			
 		
 		public function admin_debugInfo() 
Index: /mods/wpsg_mod_paypal.class.php
===================================================================
--- /mods/wpsg_mod_paypal.class.php	(revision 5737)
+++ /mods/wpsg_mod_paypal.class.php	(revision 5740)
@@ -346,5 +346,5 @@
 		} // public function order_done(&$order_id)
 
-		public function wp_loaded() { 
+		public function template_redirect() { 
 			
 			if (wpsg_isSizedString($_REQUEST['wpsg_plugin'], 'wpsg_mod_paypal') && wpsg_isSizedString($_REQUEST['confirm'], 'pp'))			
@@ -451,5 +451,5 @@
 			}
 			
-		} // public function wp_loaded()
+		} // public function template_redirect()
 		
 		public function mail_payment() 
Index: /mods/wpsg_mod_rechnungen.class.php
===================================================================
--- /mods/wpsg_mod_rechnungen.class.php	(revision 5737)
+++ /mods/wpsg_mod_rechnungen.class.php	(revision 5740)
@@ -89,5 +89,5 @@
 		} // public function delOrder(&$order_id)
 		
-		public function wp_loaded() 
+		public function template_redirect() 
 		{ 
 			
@@ -108,5 +108,5 @@
 			}	
 			
-		} // public function wp_loaded()
+		} // public function template_redirect()
 		
 		public function init()
Index: /mods/wpsg_mod_securepay.class.php
===================================================================
--- /mods/wpsg_mod_securepay.class.php	(revision 5737)
+++ /mods/wpsg_mod_securepay.class.php	(revision 5740)
@@ -258,5 +258,5 @@
 		} // public function order_done(&$order_id, &$done_view)
 			
-		public function wp_loaded()
+		public function template_redirect()
 		{
 		
@@ -322,5 +322,5 @@
 			}		
 				
-		} // public function wp_loaded()
+		} // public function template_redirect()
 		
 		public function mail_payment()
Index: /mods/wpsg_mod_shs.class.php
===================================================================
--- /mods/wpsg_mod_shs.class.php	(revision 5737)
+++ /mods/wpsg_mod_shs.class.php	(revision 5740)
@@ -329,5 +329,5 @@
 		} // public function order_done(&$order_id)
 		
-		public function wp_loaded() 
+		public function template_redirect() 
 		{
 				
@@ -443,5 +443,5 @@
 			}
 			
-		} // public function wp_loaded() 
+		} // public function template_redirect() 
 		
 		public function mail_payment()
Index: /mods/wpsg_mod_skrill.class.php
===================================================================
--- /mods/wpsg_mod_skrill.class.php	(revision 5737)
+++ /mods/wpsg_mod_skrill.class.php	(revision 5740)
@@ -193,5 +193,5 @@
 		} // public function calcPayment(&$arBasket)
 		
-		public function wp_loaded() { 
+		public function template_redirect() { 
 			
 			if ($_REQUEST['wpsg_plugin'] == 'wpsg_mod_skrill' && $_REQUEST['confirm'] == 'skrill')			
@@ -265,5 +265,5 @@
 			}
 			
-		} // public function wp_loaded()
+		} // public function template_redirect()
 		
 		public function order_done(&$order_id, &$done_view) 
Index: /mods/wpsg_mod_su.class.php
===================================================================
--- /mods/wpsg_mod_su.class.php	(revision 5737)
+++ /mods/wpsg_mod_su.class.php	(revision 5740)
@@ -260,5 +260,5 @@
 		} // public function mail_payment()
 				
-		public function wp_loaded() 
+		public function template_redirect() 
 		{ 
 			
@@ -348,5 +348,5 @@
 			}
 		
-		} // public function wp_loaded()
+		} // public function template_redirect()
 			
 		/**
Index: /mods/wpsg_mod_test.class.php
===================================================================
--- /mods/wpsg_mod_test.class.php	(revision 5737)
+++ /mods/wpsg_mod_test.class.php	(revision 5740)
@@ -169,5 +169,5 @@
 			wp_cache_flush();
 			
-			$this->shop->wp_load();
+			$this->shop->template_redirect();
    			
 			if ($this->shop->hasMod('wpsg_mod_gutschein'))
Index: /mods/wpsg_mod_varianten.class.php
===================================================================
--- /mods/wpsg_mod_varianten.class.php	(revision 5737)
+++ /mods/wpsg_mod_varianten.class.php	(revision 5740)
@@ -49,5 +49,5 @@
 		} // public function install()
 		
-		public function wp_loaded()
+		public function template_redirect()
 		{
 			
@@ -84,5 +84,5 @@
 			}
 			
-		} // public function wp_loaded()
+		} // public function template_redirect()
 		
 		public function loadProduktArray(&$produkt_data) 
Index: /mods/wpsg_mod_versandarten.class.php
===================================================================
--- /mods/wpsg_mod_versandarten.class.php	(revision 5737)
+++ /mods/wpsg_mod_versandarten.class.php	(revision 5740)
@@ -229,5 +229,5 @@
 
 				$arBasket = $this->shop->basket->toArray();
-				
+			 
 				if (isset($arBasket['checkout']['shipping_land']) && $arBasket['checkout']['shipping_land'] > 0)
 				{
@@ -241,5 +241,5 @@
 				$vz = $this->db->fetchOne("SELECT `vz` FROM `".WPSG_TBL_LAND."` WHERE `id` = '".wpsg_q($land)."'"); 
 				
-				$arVersandarten = $this->db->fetchAssoc("
+				$strQuery = "
 					SELECT 
 						* 
@@ -251,6 +251,8 @@
 					ORDER BY 
 						`name` ASC
-				");
-								
+				";
+				
+				$arVersandarten = $this->db->fetchAssoc($strQuery);
+				 								
 			}
 			else
@@ -325,5 +327,5 @@
 								
 			}
-
+ 
 		} // public function addShipping(&$arShipping)
 		
Index: /mods/wpsg_mod_videodownload.class.php
===================================================================
--- /mods/wpsg_mod_videodownload.class.php	(revision 5737)
+++ /mods/wpsg_mod_videodownload.class.php	(revision 5740)
@@ -580,5 +580,5 @@
 		} // public function order_view_sidebar_renderList($order_id)
 
-		public function wp_loaded()
+		public function template_redirect()
 		{
 			
Index: /mods/wpsg_mod_wirecard.class.php
===================================================================
--- /mods/wpsg_mod_wirecard.class.php	(revision 5737)
+++ /mods/wpsg_mod_wirecard.class.php	(revision 5740)
@@ -504,5 +504,5 @@
 		}
 		
-		public function wp_loaded() 
+		public function template_redirect() 
 		{
 			
@@ -554,5 +554,5 @@
 			}
 			
-		} // public function wp_loaded() 
+		} // public function template_redirect() 
 		
 		public function mail_payment()
Index: /system/intern/mods/wpsg_mod_orderupload.class.php
===================================================================
--- /system/intern/mods/wpsg_mod_orderupload.class.php	(revision 5737)
+++ /system/intern/mods/wpsg_mod_orderupload.class.php	(revision 5740)
@@ -137,5 +137,5 @@
 		} // public function checkCheckout(&$state, &$error, &$arCheckout)
 		
-		public function wp_loaded() 
+		public function template_redirect() 
 		{ 
 			
@@ -152,5 +152,5 @@
 			}
 			
-		} // public function wp_loaded()
+		} // public function template_redirect()
 
 		public function order_ajax() 
