Index: /controller/wpsg_ProduktController.class.php
===================================================================
--- /controller/wpsg_ProduktController.class.php	(revision 6277)
+++ /controller/wpsg_ProduktController.class.php	(revision 6278)
@@ -693,5 +693,5 @@
 				$trans_id = $this->db->fetchOne("SELECT `id` FROM `".WPSG_TBL_PRODUCTS."` WHERE `lang_parent` = '".wpsg_q($_REQUEST['edit_id'])."' AND `lang_code` = '".wpsg_q($_REQUEST['wpsg_lang'])."'");
 				
-				if ($trans_id <= 0) throw new \Exception(__('ERROR: Ãbersetzung existiert noch nicht, das dÃŒrfte nicht passieren!', 'wpsg'));
+				if ($trans_id <= 0) throw new \wpsg\Exception(__('ERROR: Ãbersetzung existiert noch nicht, das dÃŒrfte nicht passieren!', 'wpsg'));
 				
 				$data = array(
Index: /controller/wpsg_ShopController.class.php
===================================================================
--- /controller/wpsg_ShopController.class.php	(revision 6277)
+++ /controller/wpsg_ShopController.class.php	(revision 6278)
@@ -51,4 +51,8 @@
 		/** Ob im Warenkorb mit gerundeten Werten weitergerechnet werden soll */
 		var $addRoundedValues = true;
+		
+		const CHECK_NOTICE = 1;
+		const CHECK_WARNING = 2;
+		const CHECK_ERROR = 3;
 		
 		/** URL Konstanten */
@@ -92,5 +96,5 @@
 		public function __construct() 
 		{
-			
+						
 			parent::__construct();
 			
@@ -100,5 +104,5 @@
 			
 			$this->cache = new wpsg_cache($this->db);
-			
+						
 			$this->basketController = new wpsg_BasketController();
 			
@@ -156,5 +160,5 @@
 		{
 
-			if (get_the_ID() == $this->get_option('wpsg_page_basket'))
+			if (get_the_ID() == $this->getPagePID(wpsg_ShopController::PAGE_BASKET))
 			{
 
@@ -469,6 +473,7 @@
 
 				case self::URL_PRODUCTDETAIL:
-
-					$url = get_permalink($this->get_option('wpsg_page_product'));
+					
+					$url = get_permalink($this->getPagePID(self::URL_PRODUCTDETAIL));
+					
 					break;
 					
@@ -1750,28 +1755,57 @@
 		{
 						
-			if (wpsg_isSizedInt($basket_data)) $produkt_id = $basket_data;
-			else if (isset($basket_data['product_id'])) $produkt_id = $basket_data['product_id'];
-			else if (wpsg_isSizedString($basket_data)) $produkt_id = $this->getProduktID($basket_data);
-			else $produkt_id = $this->getProduktID($basket_data['id']);
+			if (wpsg_isSizedInt($basket_data)) $product_id = $basket_data;
+			else if (isset($basket_data['product_id'])) $product_id = $basket_data['product_id'];
+			else if (wpsg_isSizedString($basket_data)) $product_id = $this->getProduktID($basket_data);
+			else $product_id = $this->getProduktID($basket_data['id']);
 			
 			$url = false;
-			$this->callMods('getProduktlink', array($produkt_id, &$url));
+			$this->callMods('getProduktlink', array($product_id, &$url));
 			
 			if ($url === false)
 			{
 								
-				$produkt_data = $this->cache->loadProduct($produkt_id);
+				$produkt_data = $this->cache->loadProduct($product_id);
 				
 				if ($produkt_data['partikel'] > 0)
-				{					
+				{		
+			
 					return get_permalink($produkt_data['partikel']);
+					
 				}
 				else if (isset($basket_data['referer']) && $basket_data['referer'] != '')
 				{
+
 					return $basket_data['referer'];
+					
 				}
 				else
 				{
-
+					
+					
+					//wpsg_debug("=".apply_filters( 'wpml_current_language', NULL ));
+					//do_action('wpml_switch_language', string $language_code )
+							
+					// FÃŒr das Bakend der Produktverwaltung, dass die Links auf die entsprechende Sprache gestellt werden
+					if (function_exists('icl_object_id'))
+					{
+					
+						if (wpsg_isSizedString($_REQUEST['wpsg_lang'])) 
+						{ 
+						
+							$lang_reset = apply_filters('wpml_current_language', null);
+							do_action('wpml_switch_language', $_REQUEST['wpsg_lang']); 
+					
+						}
+						else
+						{
+							
+							$lang_reset = apply_filters('wpml_current_language', null);
+							do_action('wpml_switch_language', $this->getDefaultLanguageCode());
+							
+						}
+						
+					}
+						
 					if ($this->get_option('wpsg_page_product') > 0)
 						$product_url = $this->getURL(wpsg_ShopController::URL_PRODUCTDETAIL);
@@ -1779,11 +1813,18 @@
 						$product_url = $this->getURL(wpsg_ShopController::URL_BASKET);
 					
+					if (function_exists('icl_object_id') && isset($lang_reset))
+					{
+						
+						do_action('wpml_switch_language', $lang_reset);
+						
+					}
+					
 					if (strpos($product_url, "?") > 0)
 					{
-						$product_url .= "&wpsg_action=showProdukt&produkt_id=".$produkt_id;
+						$product_url .= "&wpsg_action=showProdukt&produkt_id=".$product_id;
 					}
 					else
 					{
-						$product_url .= "?wpsg_action=showProdukt&produkt_id=".$produkt_id;
+						$product_url .= "?wpsg_action=showProdukt&produkt_id=".$product_id;
 					}
 					
@@ -1864,5 +1905,5 @@
 				{
 					
-					$product_trans_name = $this->db->fetchOne("SELECT `name` FROM `".WPSG_TBL_PRODUCTS."` WHERE `lang_parent` = '".wpsg_q($product_id)."' AND `lang_code` = '".wpsg_q($this->getCurrentLanguage())."'");
+					$product_trans_name = $this->db->fetchOne("SELECT `name` FROM `".WPSG_TBL_PRODUCTS."` WHERE `lang_parent` = '".wpsg_q($product_id)."' AND `lang_code` = '".wpsg_q($this->getCurrentLanguageCode())."'");
 					
 					if (wpsg_isSizedString($product_trans_name))
@@ -2207,8 +2248,9 @@
 				
 				case self::PAGE_BASKET: return $this->getPageId($this->get_option('wpsg_page_basket'));
-				
-			}
-			
-			throw new \Exception(__('UngÃŒltige Seite'));
+				case self::URL_PRODUCTDETAIL: return $this->getPageId($this->get_option('wpsg_page_product'));
+				
+			}
+			
+			throw new \wpsg\Exception(__('UngÃŒltige Seite'));
 			
 		}
@@ -2228,113 +2270,4 @@
 			
 		} // public function get_the_id()
-		
-		/**
-		 * Gibt die Locale der Standard Backend Sprache zurÃŒck
-		 * de / en etc.
-		 */
-		public function getDefaultLanguageCode()
-		{
-			
-			return $this->get_option('wpsg_backend_language');
-						
-		} // public function getDefaultLanguageCode()
-		
-		/**
-		 * Gibt die Locale fÃŒr die aktuelle Sprache zurÃŒck
-		 */
-		public function getDefaultLanguageLocale()
-		{
-
-			if (!$this->force_locale) 
-			{
-				
-				$arStoreLanguages = $this->getStoreLanguages();
-				
-				foreach ($arStoreLanguages as $lang)
-				{
-					
-					if ($lang['lang'] == $this->getDefaultLanguageCode()) return $lang['locale'];
-					
-				}
-				
-				return false; 
-				
-			}
-			else return $this->force_locale;
-			
-		} // public function getDefaultLanguageLocale()
-		
-		public function getCurrentLanguageCode()
-		{
-			
-			$arStoreLanguages = $this->getStoreLanguages();
-				
-			foreach ($arStoreLanguages as $lang)
-			{
-				
-				if ($lang['locale'] == $this->getCurrentLanguageLocale()) return $lang['lang'];
-				
-			}
-			
-			return '';
-			
-		}
-		
-		public function getCurrentLanguageLocale()
-		{
-			
-			return get_locale();
-			
-		}
-				
-		/**
-		 * Ãndert zeitweise die Locale, um z.B. die Sprache einer Bestellung zu berÃŒcksichtigen
-		 * Nach dem Aufruf und der DurchfÃŒhrung sollte wieder die Originalspreach mit restoreTemLocale gesetzt werden
-		 */
-		public function setTempLocale($locale)
-		{
-			
-			global $l10n;
-		
-			if (file_exists(dirname(__FILE__).'/../lang/wpsg-'.$locale.'.mo'))
-			{
-			
-				$this->old_l10n = clone $l10n['wpsg']; 
-				$this->force_locale = $locale;
-			 			
-				// Hier muss load_(text)domain genommen werden, sonst ging es nicht!
-				// Damit das Plugin nicht warnt, habe ich es bissl verscrambelt				
-				// load_(text)domain('wpsg', dirname(__FILE__).'/../lang/wpsg-'.$locale.'.mo');
-				call_user_func_array(
-					base64_decode('bG9hZF90ZXh0ZG9tYWlu'),
-					array(
-						'wpsg', dirname(__FILE__).'/../lang/wpsg-'.$locale.'.mo'
-					)
-				);
-				
-			}
-			
-		} // public function setTempLocale($locale)
-		
-		/**
-		 * Setzt die Sprache auf die Original Sprache zurÃŒck
-		 * Wird die Sprache zeitweise mit setTempLocale geÃ€ndert, so sollte sie am Ende wieder zurÃŒckgesetzt werden
-		 */
-		public function restoreTempLocale()
-		{
-			
-			global $l10n;
-			
-			if (isset($this->old_l10n) && $this->old_l10n !== false)
-			{
-				
-				$l10n['wpsg'] = clone $this->old_l10n;
-
-				$this->force_locale = false;
-				$this->old_l10n = false;
-				
-			}
-			
-		} // public function restoreTempLocale()
 		
 		/**
@@ -2367,5 +2300,5 @@
 			global $q_config;
 
-			if ($this->force_locale !== false && $this->getCurrentLanguage() != get_locale()) return true;
+			if ($this->force_locale !== false && $this->getCurrentLanguageLocale() != get_locale()) return true;
 
 			if (function_exists('icl_object_id')) //if (is_plugin_active('sitepress-multilingual-cms/sitepress.php'))
@@ -2488,25 +2421,5 @@
 			
 		} // public function getStoreLanguages()
-		
-		/**
-		 * Gibt true oder false zurÃŒck, jenachdem ob man sich in einem Blognetzwerk befindet
-		 */
-		public function isMultiBlog()
-		{
-			
-			if (defined('MULTISITE') && MULTISITE === true) 
-			{
-				
-				// Multiblog ist aktiviert
-				return true;
-				
-			}
-			else
-			{
-				return false;
-			}
-			
-		} // public function isMultiBlog()
-				
+		 				
 		/**
 		 * PrÃŒft die Einstellungen und setzt sie ggf. auf einen Standardwert
@@ -2598,5 +2511,5 @@
 			$out_content = $content;
 
-			if (wpsg_isSizedInt($this->get_option('wpsg_page_product')) && $this->get_option('wpsg_page_product') == get_the_ID() && wpsg_isSizedString($_REQUEST['wpsg_action'], 'showProdukt') && wpsg_isSizedInt($_REQUEST['produkt_id']))
+			if (wpsg_isSizedInt($this->get_option('wpsg_page_product')) && get_the_ID() == $this->getPagePID(self::URL_PRODUCTDETAIL) && wpsg_isSizedString($_REQUEST['wpsg_action'], 'showProdukt') && wpsg_isSizedInt($_REQUEST['produkt_id']))
 			{
 
@@ -3723,21 +3636,5 @@
 			
 		} // private function buildKNR($k_id)
-		
-		/**
-		 * Wird aufgerufen wenn ein Fehler im Shop aufgetreten ist
-		 */
-		public function throwErrorCode($code, $arDebugOut = array())
-		{
-
-			if (wpsg_isSizedArray($arDebugOut)) wpsg_debug($arDebugOut);
-
-			echo wpsg_translate(__('Systemfehler! Fehlercode::#1#', 'wpsg'), $code);
-			
-			debug_print_backtrace();
-			
-			die();
-			
-		} // public function throwErrorCode($code)
-
+		 
 		/**
 		 * Hilfsfunktion um die Versandarten zusammenzufÃŒgen und Kombinationen zu bilden
Index: /controller/wpsg_SystemController.class.php
===================================================================
--- /controller/wpsg_SystemController.class.php	(revision 6277)
+++ /controller/wpsg_SystemController.class.php	(revision 6278)
@@ -235,5 +235,5 @@
 		public function addPersistentBackendError($message, $message_key)
 		{
-			
+			 
 			$arPersistentBackendError = $this->get_option('wpsg_persistentBackendError');
 			if (!is_array($arPersistentBackendError)) $arPersistentBackendError = array();
@@ -277,4 +277,71 @@
 			
 		} // public function hidePersistentBackendError($message_key)
+
+		/**
+		 * Gibt true oder false zurÃŒck, jenachdem ob man sich in einem Blognetzwerk befindet
+		 */
+		public function isMultiBlog()
+		{
+			
+			if (defined('MULTISITE') && MULTISITE === true) 
+			{
+				
+				// Multiblog ist aktiviert
+				return true;
+				
+			}
+			else
+			{
+				return false;
+			}
+			
+		} // public function isMultiBlog() 
+		
+		/**
+		 * Gibt den Pfad zurÃŒck in dem wpShopGermany seine Daten ablegt
+		 * Der Pfad soll ab Version 4.0 nicht ÃŒber den Browser zugreifbar sein, die Funktion soll das sicherstellen
+		 */
+		public function getStorageRoot()
+		{
+			
+			if ($this->isMultiBlog())
+			{
+
+				$path = WP_CONTENT_DIR.'/'.WPSG_MB_UPLOADS.'/wpsg/';
+				$htaccess = WP_CONTENT_DIR.'/'.WPSG_MB_UPLOADS.'/wpsg/.htaccess';
+				 								 
+			}
+			else
+			{
+				
+				$path = WPSG_PATH_CONTENT.'uploads/wpsg/';				
+				$htaccess = WPSG_PATH_CONTENT.'uploads/wpsg/.htaccess';
+				
+			}
+			
+			if (!file_exists($path)) 
+			{
+				mkdir($path, 0777, true);
+			}
+			
+			/*
+ 			 * Zur Sicherheit ÃŒberprÃŒfe ich immer ob die .htaccess existiert
+ 			 */
+			
+			if (!file_exists($htaccess))
+			{
+				
+				$handle = fopen($htaccess, "w+");
+				
+				$content = 'Deny from all';
+							
+				fwrite($handle, $content, strlen($content));
+				fclose($handle);
+				
+			}
+			
+			return $path;
+			
+		} // public function getStorageRoot()
 		
 		/**
@@ -664,4 +731,115 @@
 		} // public function render($file)
 		
+		/**
+		 * Gibt die Locale der Standard Backend Sprache zurÃŒck
+		 * de / en etc.
+		 */
+		public function getDefaultLanguageCode()
+		{
+			
+			return $this->get_option('wpsg_backend_language');
+						
+		} // public function getDefaultLanguageCode()
+		
+				
+		/**
+		 * Gibt die Locale fÃŒr die aktuelle Sprache zurÃŒck
+		 */
+		public function getDefaultLanguageLocale()
+		{
+
+			if (!$this->force_locale) 
+			{
+				
+				$arStoreLanguages = $this->getStoreLanguages();
+				
+				foreach ($arStoreLanguages as $lang)
+				{
+					
+					if ($lang['lang'] == $this->getDefaultLanguageCode()) return $lang['locale'];
+					
+				}
+				
+				return false; 
+				
+			}
+			else return $this->force_locale;
+			
+		} // public function getDefaultLanguageLocale()
+ 
+		public function getCurrentLanguageCode()
+		{
+			 
+			$arStoreLanguages = $this->getStoreLanguages();
+				
+			foreach ($arStoreLanguages as $lang)
+			{
+				
+				if ($lang['locale'] == $this->getCurrentLanguageLocale()) return $lang['lang'];
+				
+			}
+			
+			return '';
+			
+		}
+		
+		public function getCurrentLanguageLocale()
+		{
+			
+			return get_locale();
+			
+		}
+				
+		
+		/**
+		 * Ãndert zeitweise die Locale, um z.B. die Sprache einer Bestellung zu berÃŒcksichtigen
+		 * Nach dem Aufruf und der DurchfÃŒhrung sollte wieder die Originalspreach mit restoreTemLocale gesetzt werden
+		 */
+		public function setTempLocale($locale)
+		{
+			
+			global $l10n;
+		
+			if (file_exists(dirname(__FILE__).'/../lang/wpsg-'.$locale.'.mo'))
+			{
+			
+				$this->old_l10n = clone $l10n['wpsg']; 
+				$this->force_locale = $locale;
+			 			
+				// Hier muss load_(text)domain genommen werden, sonst ging es nicht!
+				// Damit das Plugin nicht warnt, habe ich es bissl verscrambelt				
+				// load_(text)domain('wpsg', dirname(__FILE__).'/../lang/wpsg-'.$locale.'.mo');
+				call_user_func_array(
+					base64_decode('bG9hZF90ZXh0ZG9tYWlu'),
+					array(
+						'wpsg', dirname(__FILE__).'/../lang/wpsg-'.$locale.'.mo'
+					)
+				);
+				
+			}
+			
+		} // public function setTempLocale($locale)
+		
+		/**
+		 * Setzt die Sprache auf die Original Sprache zurÃŒck
+		 * Wird die Sprache zeitweise mit setTempLocale geÃ€ndert, so sollte sie am Ende wieder zurÃŒckgesetzt werden
+		 */
+		public function restoreTempLocale()
+		{
+			
+			global $l10n;
+			
+			if (isset($this->old_l10n) && $this->old_l10n !== false)
+			{
+				
+				$l10n['wpsg'] = clone $this->old_l10n;
+
+				$this->force_locale = false;
+				$this->old_l10n = false;
+				
+			}
+			
+		} // public function restoreTempLocale()
+			
 		/**
 		 * Erstellt eine neue Seite im Wordpress 
@@ -711,4 +889,18 @@
 				), "`ID` = '".wpsg_q($page_id)."'");
 				
+				 $set_language_args = array(
+					'element_id' => $page_id,
+					'element_type'  => 'post_page',
+					'trid' => false,
+					'language_code' => 'de'
+				);
+		 
+				if (function_exists('icl_object_id'))
+				{
+				
+					do_action('wpml_set_element_language_details', $set_language_args);
+				
+				}
+								
 			}
 			
Index: /lib/functions.inc.php
===================================================================
--- /lib/functions.inc.php	(revision 6277)
+++ /lib/functions.inc.php	(revision 6278)
@@ -435,5 +435,5 @@
 		{
 			
-			$GLOBALS['wpsg_sc']->throwErrorCode('100_8');
+			throw new \wpsg\Exception(__('Beim umsortieren eines Arrays gab es im Original Array mehr Elemente als in der angegebenen Sortierung', 'wpsg'));
 			
 		}
@@ -466,6 +466,5 @@
 			{
 				
-				wpsg_debug(print_r(debug_backtrace(), 1));
-				die($GLOBALS['wpsg_sc']->throwErrorCode('100_3'));
+				throw new \wpsg\Exception(__('Beim escapen wurde ein Objekt ÃŒbergeben, hier sind nur Strings erlaubt.', 'wpsg'));
 				
 			}
Index: /lib/wpsg_db.class.php
===================================================================
--- /lib/wpsg_db.class.php	(revision 6277)
+++ /lib/wpsg_db.class.php	(revision 6278)
@@ -17,5 +17,7 @@
 			$lastQuery = $wpdb->last_query;
 			
-			throw new \Exception("Datenbankfehler: ".$wpdb->last_error);
+			throw new \wpsg\Exception("Datenbankfehler: ".$wpdb->last_error, \wpsg\Exception::TYP_DB, array(
+				array(__('Letzter Query', 'wpsg'), $lastQuery)
+			));
 		
 		} // function handleError()
Index: /lib/wpsg_exceptionhandler.class.php
===================================================================
--- /lib/wpsg_exceptionhandler.class.php	(revision 6278)
+++ /lib/wpsg_exceptionhandler.class.php	(revision 6278)
@@ -0,0 +1,32 @@
+<?php
+
+    /**
+     * User: Daschmi (daschmi@daschmi.de)
+     * Date: 18.05.2017
+     * Time: 08:44
+     */
+
+    namespace wpsg;
+    
+    abstract class Exceptionhandler
+    {
+
+        /**
+         * Wird aufgerufen wenn eine Exception nicht im Code behandelt wird
+         * @param $ex
+         */
+        static function exception($ex) 
+        {
+         
+            if (get_class($ex) === "wpsg\Exception")
+            {
+            
+                die("SYSTEMFEHLER:".$ex->getMessage());
+                // TODO: Eventuell Umleitung / Debug Ausgabe etc.
+               
+            }
+                
+        } // static function myCallbackMethod($ex)
+        
+    } // abstract class exceptionhandler
+    
Index: /model/wpsg_exception.class.php
===================================================================
--- /model/wpsg_exception.class.php	(revision 6278)
+++ /model/wpsg_exception.class.php	(revision 6278)
@@ -0,0 +1,62 @@
+<?php
+
+    /**
+     * User: Daschmi (daschmi@daschmi.de)
+     * Date: 18.05.2017
+     * Time: 08:57
+     */
+
+    namespace wpsg;
+ 
+    class Exception extends \Exception
+    {
+        
+        const TYP_UNEXPECTED = 0;
+        const TYP_DB = 1;
+         
+        private $_typ = null;
+        
+        public function __construct($message, $typ = null, $arData = array(), $code = 0, Exception $previous = null)
+        {
+                        
+            parent::__construct($message, $code, $previous);
+            
+            if ($typ === null) $typ = self::TYP_UNEXPECTED;
+            
+            $this->_typ = $typ;
+            
+            $strLogText  = str_pad($this->getTypLabel(), 50, ' ')." ".date('d.m.Y H:i:s')."\r\n";
+            $strLogText .= $this->getMessage()."\r\n";
+                        
+            foreach ($arData as $d)
+            {
+                
+                $strLogText .= $d[0].': '.$d[1]."\r\n";
+                
+            }
+            
+            $strLogText .= str_pad('', 120, '-')."\r\n";
+            
+            $log_file = $GLOBALS['wpsg_sc']->getStorageRoot().'exception.log';
+            
+            if (file_exists($log_file)) file_put_contents($log_file, $strLogText.file_get_contents($log_file));
+            else file_put_contents($log_file, $strLogText); 
+            
+        } // public function __construct($message, $code = 0, Exception $previous = null)
+ 
+        public function getTypLabel() 
+        {
+        
+            switch ($this->_typ)
+            {
+                
+                case 0: return __('Unerwartetes Programmverhalten', 'wpsg'); break;
+                case 1: return __('Datenbankfehler', 'wpsg'); break;
+                
+                default: return __('Ungekannter Fehlertyp', 'wpsg'); break;
+                
+            } // switch ($this->_typ)
+            
+        } // public function getTypLabel()
+        
+    } // class exception extends \Exception
Index: /model/wpsg_order.class.php
===================================================================
--- /model/wpsg_order.class.php	(revision 6277)
+++ /model/wpsg_order.class.php	(revision 6278)
@@ -31,16 +31,9 @@
 			$this->bShippingAdress = $this->shop->callMod('wpsg_mod_shippingadress', 'check_different_shippingadress', array($this->data['k_id'], $order_id));
 				
-			if ($this->data['id'] != $order_id) $this->shop->throwErrorCode('100_1');
+			if ($this->data['id'] != $order_id) throw new \wpsg\Exception(__('Die Daten eines Bestellobjekts konnten nicht geladen werden ', 'wpsg'));
 				
 			if (wpsg_isSizedInt($this->data['adress_id'])) $this->adress_data = $this->db->fetchRow("SELECT * FROM `".WPSG_TBL_ADRESS."` WHERE `id` = '".wpsg_q($this->data['adress_id'])."' ");
 			if (wpsg_isSizedInt($this->data['shipping_adress_id'])) $this->shipping_adress_data = $this->db->fetchRow("SELECT * FROM `".WPSG_TBL_ADRESS."` WHERE `id` = '".wpsg_q($this->data['shipping_adress_id'])."' ");
-				
-			/*
-			@$this->data = &$this->shop->cache->loadOrder($order_id);
-			@$this->customer = &$this->shop->cache->loadCustomerObject($this->data['k_id']);			
-						
-			if ($this->data['id'] != $order_id) $this->shop->throwErrorCode('100_1');
-			*/
-			
+	 			
 			return true;
 			
Index: /model/wpsg_order_product.class.php
===================================================================
--- /model/wpsg_order_product.class.php	(revision 6277)
+++ /model/wpsg_order_product.class.php	(revision 6278)
@@ -19,5 +19,5 @@
 			$this->data = $this->db->fetchRow("SELECT OP.* FROM `".WPSG_TBL_ORDERPRODUCT."` AS OP WHERE OP.`id` = '".wpsg_q($order_product_id)."' ");
 			
-			if ($this->data['id'] != $order_product_id) $this->shop->throwErrorCode('100_6');
+			if ($this->data['id'] != $order_product_id) throw new \wpsg\Exception(__('Die Daten eines bestellten Produktes konnten nicht geladen werden', 'wpsg')); 
 			
 		} // public function load($order_product_id)
Index: /model/wpsg_product.class.php
===================================================================
--- /model/wpsg_product.class.php	(revision 6277)
+++ /model/wpsg_product.class.php	(revision 6278)
@@ -52,5 +52,5 @@
 			$this->loadedData = $this->shop->loadProduktArray($product_id);
 			
-			if ($this->data['id'] != $product_id) $this->shop->throwErrorCode('100_5', array('Gesuchte ID:'.$product_id, 'Gefundene ID:'.$this->data['id']));
+			if ($this->data['id'] != $product_id) throw new \wpsg\Exception(wpsg_translate(__('Gesuchte ID:#1# Gefundene ID:#2#', 'wpsg'), $product_id, $this->data['id']));
 
 			return true;
Index: /mods/mod_deliverynote/wpsg_deliverynote.class.php
===================================================================
--- /mods/mod_deliverynote/wpsg_deliverynote.class.php	(revision 6277)
+++ /mods/mod_deliverynote/wpsg_deliverynote.class.php	(revision 6278)
@@ -20,5 +20,5 @@
 			$this->data = $this->db->fetchRow("SELECT DN.* FROM `".WPSG_TBL_DELIVERYNOTE."` AS DN WHERE DN.`id` = '".wpsg_q($deliverynote_id)."' ");
 			
-			if ($this->data['id'] != $deliverynote_id) $this->shop->throwErrorCode('2000_1');
+			if ($this->data['id'] != $deliverynote_id) throw new \wpsg\Exception(__('Konnte Lieferschein nicht laden, ungÃŒltige ID ÃŒbergeben', 'wpsg'));
 			
 			return true;
Index: /mods/wpsg_mod_abo.class.php
===================================================================
--- /mods/wpsg_mod_abo.class.php	(revision 6277)
+++ /mods/wpsg_mod_abo.class.php	(revision 6278)
@@ -201,6 +201,6 @@
 						$abo_entry = $this->db->fetchRow("SELECT * FROM `".WPSG_TBL_ABO."` WHERE `order_id` = '".wpsg_q($order_base_id)."' AND `product_key` = '".wpsg_q($product['productkey'])."'");
  
-						if ($abo_entry['id'] <= 0) die($this->shop->throwErrorCode('1630_2'));						
-						if ($product_data['wpsg_mod_abo_resell'] != 0 && $abo_entry['rebuy'] + $product['menge'] > $product_data['wpsg_mod_abo_resell']) die($this->shop->throwErrorCode('1630_3'));
+						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')); 
 
 						if (strtotime($abo_entry['expiration']) < time())
@@ -385,5 +385,5 @@
 			{
 
-				$this->shop->throwErrorCode('1630_1');
+				throw new \wpsg\Exception(__('Beim VerlÃ€ngerungslink keine BestellID oder ProductKey ÃŒbergeben', 'wpsg'));
 				return false;
 				
Index: /mods/wpsg_mod_basic.class.php
===================================================================
--- /mods/wpsg_mod_basic.class.php	(revision 6277)
+++ /mods/wpsg_mod_basic.class.php	(revision 6278)
@@ -1206,5 +1206,7 @@
  		 */
  		public function delOrder(&$order_id) { } // public function delOrder(&$order_id)
- 		
+
+		public function systemcheck(&$arData) { } // public function systemcheck($arData)
+		
 	} // class wpsg_mod_basic
 
Index: /mods/wpsg_mod_crefopay.class.php
===================================================================
--- /mods/wpsg_mod_crefopay.class.php	(revision 6277)
+++ /mods/wpsg_mod_crefopay.class.php	(revision 6278)
@@ -381,5 +381,5 @@
 				$oOrder = wpsg_order::getInstance($_SESSION['wpsg']['wpsg_mod_crefopay']['order_id']);
 				
-				if ($oOrder->onr != $_REQUEST['orderNo']) die($this->shop->throwErrorCode('4000_1'));
+				if ($oOrder->onr != $_REQUEST['orderNo']) throw new \wpsg\Exception(__('Hier wurde die Warenkorb mit einer Bestellnummer aufgerufen die nicht mit der BestellID der Session ÃŒbereinstimmt', 'wpsg'));
 
 				// Alte Bestellung lÃ¶schen
Index: /mods/wpsg_mod_customergroup.class.php
===================================================================
--- /mods/wpsg_mod_customergroup.class.php	(revision 6277)
+++ /mods/wpsg_mod_customergroup.class.php	(revision 6278)
@@ -138,5 +138,5 @@
 		{
 				
-			if (!wpsg_isSizedInt($_REQUEST['edit_id'])) $this->shop->throwErrorCode('3090_1');
+			if (!wpsg_isSizedInt($_REQUEST['edit_id'])) throw new \wpsg\Exception(__('Beim bearbeiten einer Kundengruppe wurde keine ID ÃŒbergeben', 'wpsg'));
 				
 			$this->shop->view['data'] = new wpsg_customergroup();
Index: /mods/wpsg_mod_deliverynote.class.php
===================================================================
--- /mods/wpsg_mod_deliverynote.class.php	(revision 6277)
+++ /mods/wpsg_mod_deliverynote.class.php	(revision 6278)
@@ -232,5 +232,5 @@
 				$dn->load($_REQUEST['dn_id']);
 				
-				if ($dn->order_id != $_REQUEST['edit_id']) $this->shop->throwErrorCode('2000_7');
+				if ($dn->order_id != $_REQUEST['edit_id']) throw new \wpsg\Exception(__('Es wurde versucht ein Lieferschein von einer anderen Bestellung anzuzeigen', 'wpsg'));
 				
 				$filename = 'deliverynote_'.$dn->id.'.pdf';
@@ -243,5 +243,5 @@
 			{
 				
-				if ($_REQUEST['edit_id'] <= 0) $this->shop->throwErrorCode('2000_3');
+				if ($_REQUEST['edit_id'] <= 0) throw new \wpsg\Exception(__('Beim Erstellen des Lieferscheindokumentes wurde keine BestellID ÃŒbergeben', 'wpsg'));
 				
 				$lnr = $this->buildLnr($_REQUEST['edit_id']);
@@ -252,10 +252,5 @@
 				{
 			 
-					if (!wpsg_deliverynote::checkProductKey($product_key, $_REQUEST['edit_id']))
-					{
-						
-						$this->shop->throwErrorCode('2000_6');
-						
-					}
+					if (!wpsg_deliverynote::checkProductKey($product_key, $_REQUEST['edit_id'])) throw new \wpsg\Exception(__('Ein Lieferschein wurde fÃŒr ein Produkt bereits erstellt', 'wpsg'));
 					
 				} 
@@ -294,5 +289,5 @@
 						
 						$this->db->Query("DELETE FROM `".WPSG_TBL_DELIVERYNOTE."` WHERE `id` = '".wpsg_q($dn_id)."'");
-						$this->shop->throwErrorCode('2000_4');
+						throw new \wpsg\Exception(__('Das Lieferscheindokument wurde nicht wie vorgesehen angelegt', 'wpsg'));
 						
 					}
@@ -339,5 +334,5 @@
 					
 					$this->db->Query("DELETE FROM `".WPSG_TBL_DELIVERYNOTE."` WHERE `id` = '".wpsg_q($dn_id)."'");
-					$this->shop->throwErrorCode('2000_2');
+					throw new \wpsg\Exception(__('Beim Erstellen des Lieferscheindokumentes ist ein Fehler aufgetreten', 'wpsg'));
 					
 				}
@@ -524,5 +519,5 @@
 			$file = $this->getFilePath($order_id).$filename;
 
-			if (!file_exists($file) || !is_file($file)) $this->shop->throwErrorCode('2000_5');
+			if (!file_exists($file) || !is_file($file)) throw new \wpsg\Exception(__('Das Lieferscheindokument wurde beim Senden der Bestellmail nicht gefunden', 'wpsg'));
 			
 			$this->shop->view['order'] = $this->shop->cache->loadOrder($order_id);
Index: /mods/wpsg_mod_discount.class.php
===================================================================
--- /mods/wpsg_mod_discount.class.php	(revision 6277)
+++ /mods/wpsg_mod_discount.class.php	(revision 6278)
@@ -1189,5 +1189,5 @@
 				case 'customer': return __('Kundengruppenrabatt', 'wpsg'); break;
 				
-				default: $this->shop->throwErrorCode('700_1');
+				default: throw new \wpsg\Exception(__('Es konnte kein Name fÃŒr einen Rabatttyp zurÃŒckgegeben werden', 'wpsg'));
 				
 			}
Index: /mods/wpsg_mod_giropay.class.php
===================================================================
--- /mods/wpsg_mod_giropay.class.php	(revision 6277)
+++ /mods/wpsg_mod_giropay.class.php	(revision 6278)
@@ -224,7 +224,5 @@
 						break; 
 		
-					default:
-		
-						$this->shop->throwErrorCode('3050_3');
+					default: throw new \wpsg\Exception(__('GebÃŒhr konnte nicht berechnet werden, da eine ungÃŒltige Zahlungsart verwendet wurde', 'wpsg'));
 		
 				}
@@ -289,5 +287,5 @@
 				$order_id = preg_replace('/(^O)|(T\d+$)/', '', $_REQUEST['order_id']);
 				
-				if (!wpsg_isSizedInt($order_id)) $this->shop->throwErrorCode('3050_2');
+				if (!wpsg_isSizedInt($order_id)) throw new \wpsg\Exception(__('Keine gÃŒltige Bestellung aus Request gefiltert', 'wpsg'));
 				
 				$order = $this->shop->cache->loadOrderObject($order_id);
@@ -355,5 +353,5 @@
 				$order_id = preg_replace('/(^O)|(T\d+$)/', '', $_REQUEST['order_id']);
 				
-				if (!wpsg_isSizedInt($order_id)) $this->shop->throwErrorCode('3050_2');
+				if (!wpsg_isSizedInt($order_id)) throw new \wpsg\Exception(__('Keine gÃŒltige Bestellung aus Request gefiltert', 'wpsg'));
 				
 				$order = $this->shop->cache->loadOrderObject($order_id);
@@ -539,7 +537,5 @@
 					break;
 			
-				default:
-			
-					$this->shop->throwErrorCode('3050_1');
+				default: throw new \wpsg\Exception(__('Es wurde versucht einen Zahlungslink fÃŒr eine ungÃŒltige Zahlungsart zu generieren', 'wpsg'));
 			
 			}
Index: /mods/wpsg_mod_gutschein.class.php
===================================================================
--- /mods/wpsg_mod_gutschein.class.php	(revision 6277)
+++ /mods/wpsg_mod_gutschein.class.php	(revision 6278)
@@ -507,12 +507,6 @@
 			$gs_db = $this->db->fetchRow("SELECT G.`id`, G.`productgroups`, G.`products` FROM `".WPSG_TBL_GUTSCHEIN."` AS G WHERE G.`id` = '".wpsg_q($_SESSION['wpsg']['gs']['id'])."'");
 			
-			if ($gs_db['id'] != $_SESSION['wpsg']['gs']['id'])
-			{
-				
-				$this->shop->throwErrorCode('160_1');
-				return;
-				
-			}
-			
+			if ($gs_db['id'] != $_SESSION['wpsg']['gs']['id']) throw new \Exception(__('In der Session befindet sich eine Gutschein ID, die es nicht in der Datenbank gibt', 'wpsg'));
+						
 			$product_id = $this->shop->getProduktID($_REQUEST['wpsg']['produkt_id']);
 			
@@ -744,9 +738,9 @@
 			
 			if (!wpsg_isSizedArray($arBasket['gs'])) return true;
-			if (!wpsg_isSizedInt($_SESSION['wpsg']['gs']['id'])) { $this->shop->throwErrorCode('160_2'); return true; }			
+			if (!wpsg_isSizedInt($_SESSION['wpsg']['gs']['id']))  throw new \wpsg\Exception(__('In der Session ist keine ID fÃŒr den Gutschein im Basket Array, sollte nicht passieren', 'wpsg'));			
 			
 			$gs_db = $this->db->fetchRow("SELECT G.`id`, G.`minvalue` FROM `".WPSG_TBL_GUTSCHEIN."` AS G WHERE G.`id` = '".wpsg_q($_SESSION['wpsg']['gs']['id'])."'");
 
-			if ($gs_db['id'] != $_SESSION['wpsg']['gs']['id']) { $this->shop->throwErrorCode('160_1'); return true; }
+			if ($gs_db['id'] != $_SESSION['wpsg']['gs']['id']) throw new \wpsg\Exception(__('In der Session befindet sich eine Gutschein ID, die es nicht in der Datenbank gibt', 'wpsg')); 
 			
 			if (wpsg_tf($gs_db['minvalue']) > 0 && ($arBasket['sum']['preis'] + $arBasket['sum']['gs']) < $gs_db['minvalue'])
Index: /mods/wpsg_mod_kundenverwaltung.class.php
===================================================================
--- /mods/wpsg_mod_kundenverwaltung.class.php	(revision 6277)
+++ /mods/wpsg_mod_kundenverwaltung.class.php	(revision 6278)
@@ -1213,10 +1213,5 @@
 																
 				}
-				else if (!wpsg_isSizedInt($wp_user_id))
-				{
-
-					$this->shop->throwErrorCode('100_4');
-					
-				}
+				else if (!wpsg_isSizedInt($wp_user_id)) throw new \wpsg\Exception(__('Beim Anlegen des Wordpress Nutzers gab es eine unerwartete RÃŒckgabe', 'wpsg'));
 				else
 				{
@@ -2150,5 +2145,5 @@
 					$count_order = $this->db->fetchOne("SELECT COUNT(*) FROM `".WPSG_TBL_ORDER."` WHERE `k_id` = '".wpsg_q($temp_k_id)."'  AND `id` != '".wpsg_q($_SESSION['wpsg']['order_id'])."' ");
 			
-					if ($count_order > 0) $this->shop->throwErrorCode('3100_1');
+					if ($count_order > 0) throw new \wpsg\Exception(__('Die Daten eines Bestellobjekts konnten nicht geladen werden', 'wpsg'));
 					else
 					{
Index: /mods/wpsg_mod_legaltexts.class.php
===================================================================
--- /mods/wpsg_mod_legaltexts.class.php	(revision 6277)
+++ /mods/wpsg_mod_legaltexts.class.php	(revision 6278)
@@ -63,10 +63,5 @@
 					
 				}
-				else
-				{
-					
-					$this->shop->throwErrorCode('1900_2');
-					
-				}
+				else throw new \wpsg\Exception(__('Es wurde beim Speichern der Einstellungen ein ungÃŒltiger Provider ÃŒbergeben', 'wpsg'));
 				
 			}
@@ -155,10 +150,5 @@
 					
 				}
-				else
-				{
-
-					$this->shop->throwErrorCode('1900_1');
-					
-				}
+				else throw new \wpsg\Exception(__('Es wurde bei der Ajax Anfrage der Provider ein ungÃŒltiger Provider angegeben', 'wpsg'));
 							
 			}
Index: /mods/wpsg_mod_micropayment.class.php
===================================================================
--- /mods/wpsg_mod_micropayment.class.php	(revision 6277)
+++ /mods/wpsg_mod_micropayment.class.php	(revision 6278)
@@ -482,7 +482,5 @@
 						break;
 						
-					default:
-						
-						$this->shop->throwErrorCode('1750_1');
+					default: throw new \wpsg\Exception(__('Im Basket Array war eine Micropayment Zahlungsart die nicht definiert ist (Innerhalb calcPayment)', 'wpsg'));
 					
 				}
@@ -565,7 +563,5 @@
 						break;
 						
-					default:
-						
-						$this->shop->throwErrorCode('1750_1');
+					default: throw new \wpsg\Exception(__('Im Basket Array war eine Micropayment Zahlungsart die nicht definiert ist (Innerhalb calcPayment)', 'wpsg'));
 					
 				}
@@ -716,9 +712,9 @@
 				$order_data = $this->shop->cache->loadOrder($order_id);
 				
-				if ($order_data['id'] != $order_id || $order_id <= 0) die($this->shop->throwErrorCode('1750_4'));
+				if ($order_data['id'] != $order_id || $order_id <= 0) throw new \wpsg\Exception(__('UngÃŒltiger Titel oder Bestellung nicht gefunden bei MP Request', 'wpsg'));
 				
 				$token_check = md5($this->shop->get_option('wpsg_mod_micropayment_accesskey').$order_data['cdate']);
 				
-				if ($token_check != $token) die($this->shop->throwErrorCode('1750_5'));
+				if ($token_check != $token) throw new \wpsg\Exception(__('UngÃŒltiger Sicherheitstoken bei MP Request', 'wpsg'));
 				
 				$this->db->ImportQuery(WPSG_TBL_OL, array(
@@ -1043,11 +1039,5 @@
 			$order_data = $this->shop->cache->loadOrder($order_id);
 			 
-			if (!preg_match('/^'.$this->id.'_\d+$/', $order_data['type_payment'])) 
-			{
-
-				$this->shop->throwErrorCode('1750_2');
-				return;
-				
-			}
+			if (!preg_match('/^'.$this->id.'_\d+$/', $order_data['type_payment'])) throw new \wpsg\Exception(__('Es wurde versucht einen Zahlungslink fÃŒr eine Bestellung anzufragen, die nicht mit Micropayment bezahlt wurde', 'wpsg'));
 			
 			$subPayTyp = preg_replace('/^\d+_/', '', $order_data['type_payment']);
@@ -1115,8 +1105,5 @@
 					break;
 					
-				default:
-					
-					$this->shop->throwErrorCode('1750_3');
-					return;
+				default: throw new \wpsg\Exception(__('Es wurde keine gÃŒltige Micropayment Zahlungsart beim generieren des Bezahllinks gefunden', 'wpsg'));
 				
 			}
Index: /mods/wpsg_mod_packagetracking.class.php
===================================================================
--- /mods/wpsg_mod_packagetracking.class.php	(revision 6277)
+++ /mods/wpsg_mod_packagetracking.class.php	(revision 6278)
@@ -154,5 +154,5 @@
 			{
 				
-				if (!wpsg_isSizedInt($_REQUEST['trackingprovider_id'])) $this->shop->throwErrorCode('3130_3');
+				if (!wpsg_isSizedInt($_REQUEST['trackingprovider_id'])) throw new \wpsg\Exception(__('Delete Anfrage ohne ID', 'wpsg'));
 				
 				$tp_id = $this->db->UpdateQuery(WPSG_TBL_TRACKINGPROVIDER, array(
@@ -166,5 +166,5 @@
 			{
 				
-				if (!wpsg_isSizedInt($_REQUEST['trackingprovider_id'])) $this->shop->throwErrorCode('3130_2');
+				if (!wpsg_isSizedInt($_REQUEST['trackingprovider_id'])) throw new \wpsg\Exception(__('Inline Edit ohne ID', 'wpsg'));
 				
 				if ($_REQUEST['field'] == 'name')
@@ -193,5 +193,5 @@
 				}
 				
-				$this->shop->throwErrorCode('3130_1');
+				throw new \wpsg\Exception(__('Inline Edit eines ungÃŒltigen Feldes', 'wpsg'));
 				
 			}
Index: /mods/wpsg_mod_paypal.class.php
===================================================================
--- /mods/wpsg_mod_paypal.class.php	(revision 6277)
+++ /mods/wpsg_mod_paypal.class.php	(revision 6278)
@@ -592,5 +592,5 @@
 		{
 				
-			if (!wpsg_isSizedInt($_REQUEST['order_id'])) $this->shop->throwErrorCode('2_1');
+			if (!wpsg_isSizedInt($_REQUEST['order_id'])) throw new \wpsg\Exception(__('Beim start der Zahlung wurde keine BestellID ÃŒbergeben.', 'wpsg'));
 				
 			$oOrder = wpsg_order::getInstance($_REQUEST['order_id']);
@@ -640,5 +640,5 @@
 			}
 				
-			if ($this->id != $oOrder->getPaymentID()) $this->shop->throwErrorCode('2_2');
+			if ($this->id != $oOrder->getPaymentID()) throw new \wpsg\Exception(__('Es wurde versucht eine Zahlung zu starten zu einer Bestellung die nicht mit PayPalAPI ausgefÃŒhrt wurde', 'wpsg'));
 		
 			$payer = new \PayPal\Api\Payer();
@@ -899,5 +899,5 @@
 				
 			$oOrder = wpsg_order::getInstance($order_id);
-			if ($oOrder === false) $this->shop->throwErrorCode('2_3');
+			if ($oOrder === false) throw new \wpsg\Exception(__('Bei einer Stornierung konnte Bestellung nicht geladen werden', 'wpsg'));
 				
 			$sale_id = $oOrder->getMeta('wpsg_mod_paypal_saleid');
Index: /mods/wpsg_mod_paypalapi.class.php
===================================================================
--- /mods/wpsg_mod_paypalapi.class.php	(revision 6277)
+++ /mods/wpsg_mod_paypalapi.class.php	(revision 6278)
@@ -970,5 +970,5 @@
 			
 			$oOrder = wpsg_order::getInstance($order_id);
-			if ($oOrder === false) $this->shop->throwErrorCode('10_3');
+			if ($oOrder === false) throw new \wpsg\Exception(__('Bei einer Stornierung konnte Bestellung nicht geladen werden', 'wpsg'));
 			
 			$sale_id = $oOrder->getMeta('wpsg_mod_paypalapi_saleid');
Index: /mods/wpsg_mod_productgroups.class.php
===================================================================
--- /mods/wpsg_mod_productgroups.class.php	(revision 6277)
+++ /mods/wpsg_mod_productgroups.class.php	(revision 6278)
@@ -209,5 +209,5 @@
 				$lang = @unserialize($arrGrp['lang']);
 				
-				if (is_array($lang) && wpsg_isSizedString($lang[$this->shop->getCurrentLanguage()]['name'])) $arrGrp['name'] = $lang[$this->shop->getCurrentLanguage()]['name'];
+				if (is_array($lang) && wpsg_isSizedString($lang[$this->shop->getCurrentLanguageCode()]['name'])) $arrGrp['name'] = $lang[$this->shop->getCurrentLanguageCode()]['name'];
 				
 			}
@@ -330,5 +330,5 @@
 					$lang = @unserialize($arrGrp['lang']);
 					
-					if (is_array($lang) && wpsg_isSizedString($lang[$this->shop->getCurrentLanguage()]['name'])) $arrGrp['name'] = $lang[$this->shop->getCurrentLanguage()]['name']; 
+					if (is_array($lang) && wpsg_isSizedString($lang[$this->shop->getCurrentLanguageCode()]['name'])) $arrGrp['name'] = $lang[$this->shop->getCurrentLanguageCode()]['name']; 
 					
 				}
@@ -432,5 +432,5 @@
 						$lang = @unserialize($pg['lang']);
 						
-						if (is_array($lang) && wpsg_isSizedString($lang[$this->shop->getCurrentLanguage()]['name'])) $pg['name'] = $lang[$this->shop->getCurrentLanguage()]['name'];
+						if (is_array($lang) && wpsg_isSizedString($lang[$this->shop->getCurrentLanguageCode()]['name'])) $pg['name'] = $lang[$this->shop->getCurrentLanguageCode()]['name'];
 						
 					}
@@ -596,5 +596,5 @@
 					$lang = @unserialize($pg['lang']);
 					
-					if (is_array($lang) && wpsg_isSizedString($lang[$this->shop->getCurrentLanguage()]['name'])) $arPG['name'] = $lang[$this->shop->getCurrentLanguage()]['name'];
+					if (is_array($lang) && wpsg_isSizedString($lang[$this->shop->getCurrentLanguageCode()]['name'])) $arPG['name'] = $lang[$this->shop->getCurrentLanguageCode()]['name'];
 					
 				}
Index: /mods/wpsg_mod_productvariants.class.php
===================================================================
--- /mods/wpsg_mod_productvariants.class.php	(revision 6277)
+++ /mods/wpsg_mod_productvariants.class.php	(revision 6278)
@@ -405,21 +405,8 @@
         				unset($vp_data[$order]);
         
-        			}
-        			else
-        			{
-        
-        				$this->shop->throwErrorCode('98_1');
-        
-        			}
-        				
-        		}
-        
-        		if (wpsg_isSizedArray($vp_data))
-        		{
-        
-        			$this->shop->throwErrorCode('98_2');
-        
-        		}
-        
+        			} 
+        				
+        		}
+                 
         		$this->saveVarianten($_REQUEST['edit_id'], $vp_data_neu);
         
@@ -887,5 +874,5 @@
         
         				// Den Namen der Variante auf die aktuelle Sprache stellen
-        				if (wpsg_isSizedString($vp_data[$k]['lang'][$this->shop->getCurrentLanguage()]['name'])) $vp_data[$k]['name'] = $vp_data[$k]['lang'][$this->shop->getCurrentLanguage()]['name'];
+        				if (wpsg_isSizedString($vp_data[$k]['lang'][$this->shop->getCurrentLanguageCode()]['name'])) $vp_data[$k]['name'] = $vp_data[$k]['lang'][$this->shop->getCurrentLanguageCode()]['name'];
         
         				if (wpsg_isSizedArray($vp_data[$k]['vari']))
@@ -896,5 +883,5 @@
         
         						// Den Namen der Variation auf die aktuelle Sprache korrigieren
-        						if (wpsg_isSizedString($vp_data[$k]['lang'][$this->shop->getCurrentLanguage()]['vari'][$k2]['name'])) $vp_data[$k]['vari'][$k2]['name'] = $vp_data[$k]['lang'][$this->shop->getCurrentLanguage()]['vari'][$k2]['name'];
+        						if (wpsg_isSizedString($vp_data[$k]['lang'][$this->shop->getCurrentLanguageCode()]['vari'][$k2]['name'])) $vp_data[$k]['vari'][$k2]['name'] = $vp_data[$k]['lang'][$this->shop->getCurrentLanguageCode()]['vari'][$k2]['name'];
         
         					}
@@ -1133,5 +1120,5 @@
 			{
 			
-				$produkt_trans_id = $this->db->fetchOne("SELECT `id` FROM `".WPSG_TBL_PRODUCTS."` WHERE `lang_parent` = '".wpsg_q($produkt_id)."' AND `lang_locale` = '".wpsg_q($this->shop->getCurrentLanguage())."'");
+				$produkt_trans_id = $this->db->fetchOne("SELECT `id` FROM `".WPSG_TBL_PRODUCTS."` WHERE `lang_parent` = '".wpsg_q($produkt_id)."' AND `lang_locale` = '".wpsg_q($this->shop->getCurrentLanguageCode())."'");
 			
 				if (wpsg_isSizedInt($produkt_trans_id)) $produkt_id = $produkt_trans_id;
Index: /mods/wpsg_mod_produktartikel.class.php
===================================================================
--- /mods/wpsg_mod_produktartikel.class.php	(revision 6277)
+++ /mods/wpsg_mod_produktartikel.class.php	(revision 6278)
@@ -93,4 +93,22 @@
    			
 		} 
+		
+		public function be_ajax() 
+		{ 
+			 
+			if (wpsg_getStr($_REQUEST['do'], 'setWPMLPathKey'))
+			{
+				
+				$icl_sitepress_settings = $this->shop->get_option('icl_sitepress_settings');
+				
+				$icl_sitepress_settings['custom_posts_sync_option'][$this->shop->get_option('wpsg_mod_produktartikel_pathkey')] = '1';
+				$this->shop->update_option('icl_sitepress_settings', $icl_sitepress_settings);
+				
+				$this->shop->addBackendMessage(__('Der Custom Post Type fÃŒr die Produkte kann nun ÃŒbersetzt werden.', 'wpsg'));				
+				$this->shop->redirect(WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Admin&action=ueber&subaction=systemcheck');
+				
+			}
+			
+		}
 		
 		public function the_excerpt(&$content) 
@@ -465,5 +483,5 @@
 					
 					// Gibt es zu dem Post schon eine trid?
-					$trid = $this->db->fetchOne("SELECT `trid` FROM `".$this->shop->prefix."icl_translations` WHERE `element_type` = '".wpsg_q($this->shop->get_option('wpsg_mod_produktartikel_pathkey'))."' AND `element_id` = '".wpsg_q($post_id)."' ");
+					$trid = $this->db->fetchOne("SELECT `trid` FROM `".$this->shop->prefix."icl_translations` WHERE `element_type` = '".wpsg_q('post_'.$this->shop->get_option('wpsg_mod_produktartikel_pathkey'))."' AND `element_id` = '".wpsg_q($post_id)."' ");
 					if (!wpsg_isSizedInt($trid))
 					{
@@ -471,5 +489,5 @@
 						$trid = 1 + $this->db->fetchOne("SELECT MAX(`trid`) FROM ".$this->shop->prefix."icl_translations");
 						$this->db->ImportQuery($this->shop->prefix."icl_translations", array(
-							'element_type' => wpsg_q($this->shop->get_option('wpsg_mod_produktartikel_pathkey')),
+							'element_type' => wpsg_q('post_'.$this->shop->get_option('wpsg_mod_produktartikel_pathkey')),
 							'element_id' => wpsg_q($post_id),
 							'trid' => wpsg_q($trid),
@@ -481,10 +499,10 @@
 					
 					// Gibt es schon einen ICL Eintrag zur Ãbersetzung?
-					$icl_id = $this->db->fetchOne("SELECT `translation_id` FROM `".$this->shop->prefix."icl_translations` WHERE `element_type` = '".wpsg_q($this->shop->get_option('wpsg_mod_produktartikel_pathkey'))."' AND `element_id` = '".wpsg_q($trans_post_id)."' ");
+					$icl_id = $this->db->fetchOne("SELECT `translation_id` FROM `".$this->shop->prefix."icl_translations` WHERE `element_type` = '".wpsg_q('post_'.$this->shop->get_option('wpsg_mod_produktartikel_pathkey'))."' AND `element_id` = '".wpsg_q($trans_post_id)."' ");
 					if (!wpsg_isSizedInt($icl_id))
 					{
 						
 						$this->db->ImportQuery($this->shop->prefix."icl_translations", array(
-							'element_type' => wpsg_q($this->shop->get_option('wpsg_mod_produktartikel_pathkey')),
+							'element_type' => wpsg_q('post_'.$this->shop->get_option('wpsg_mod_produktartikel_pathkey')),
 							'element_id' => wpsg_q($trans_post_id),
 							'trid' => wpsg_q($trid),
@@ -562,8 +580,8 @@
 		} // public function create_wpsg_post_types()
 
-		public function getProduktlink($produkt_id, &$url) 
-		{ 
-
-			$produkt_id = $this->shop->getProduktId($produkt_id);
+		public function getProduktlink($product_id, &$url) 
+		{
+
+			$produkt_id = $this->shop->getProduktId($product_id);
 			
 			$post_id = $this->db->fetchOne("
@@ -589,5 +607,5 @@
 			}
 			
-			return -1;
+			return -1; 
 			
 		} // public function getProduktlink($produkt_id)
@@ -671,4 +689,30 @@
 		} // public function loadProduktArray(&$produkt_data)
 		
+		public function systemcheck(&$arData) 
+		{ 
+		
+			if (function_exists('icl_object_id'))
+			{
+				
+				$icl_sitepress_settings = $this->shop->get_option('icl_sitepress_settings');
+				
+				if (wpsg_getStr($icl_sitepress_settings['custom_posts_sync_option'][$this->shop->get_option('wpsg_mod_produktartikel_pathkey')]) !== '1')
+				{
+					
+					$arData[] = array(
+						'wpsg_mod_produktartikel_wpml_custom_post_type',
+						wpsg_ShopController::CHECK_ERROR,
+						wpsg_translate(
+							__('Sie haben WPML aktiviert und den Custom Post Type der Produkte nicht ÃŒbersetzt. Die Ãbersetzung der Produkte kann so nicht korrekt arbeiten. Klicken Sie <a href="#1#">hier</a> um das Problem zu lÃ¶sen.', 'wpsg'),
+							WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Admin&action=module&noheader=1&modul=wpsg_mod_produktartikel&do=setWPMLPathKey'
+						)
+					);
+					
+				}
+				
+			}
+			
+		} // public function systemcheck($arData)
+		
 		/* Modulfunktionen */
 		
@@ -953,5 +997,5 @@
 				return $post_id;
 
-			};
+			}
 			
 		} // private function getPostIdFromProductId($product_id)
Index: /mods/wpsg_mod_rechnungen.class.php
===================================================================
--- /mods/wpsg_mod_rechnungen.class.php	(revision 6277)
+++ /mods/wpsg_mod_rechnungen.class.php	(revision 6278)
@@ -1533,5 +1533,5 @@
  		 */
  		public function getFilePath($order_id, $url = false)
- 		{
+ 		{ 
  		  			
  			if ($this->shop->isMultiBlog())
Index: /mods/wpsg_mod_scaleprice.class.php
===================================================================
--- /mods/wpsg_mod_scaleprice.class.php	(revision 6277)
+++ /mods/wpsg_mod_scaleprice.class.php	(revision 6278)
@@ -339,11 +339,5 @@
 				
 				}
-				else
-				{
-				
-					$this->shop->throwErrorCode('1640_4');
-					return;
-				
-				}
+				else throw new \wpsg\Exception(__('UngÃŒltige Preisberechnung bei Produkttemplate', 'wpsg'));
 				
 				if ($this->shop->get_option('wpsg_preisangaben') == WPSG_NETTO)
@@ -430,11 +424,5 @@
 					
 				}
-				else
-				{
-					
-					$this->shop->throwErrorCode('1640_3');
-					return $price;
-					
-				}
+				else throw new \wpsg\Exception(__('UngÃŒltige Preisberechnung im Frontend', 'wpsg'));
 				
 			}
Index: /mods/wpsg_mod_wirecard.class.php
===================================================================
--- /mods/wpsg_mod_wirecard.class.php	(revision 6277)
+++ /mods/wpsg_mod_wirecard.class.php	(revision 6278)
@@ -26,5 +26,5 @@
 			$this->desc = __('ErmÃ¶glicht die Zahlungsart wirecard.', 'wpsg');
 		
-			if (is_object($this->shop) && method_exists($this->shop, 'getCurrentLanguage') && $this->shop->getCurrentLanguage() == 'en_US') $this->hilfeURL = 'http://wpshopgermany.de/?p=17187';
+			if (is_object($this->shop) && method_exists($this->shop, 'getCurrentLanguage') && $this->shop->getCurrentLanguageCode() == 'en') $this->hilfeURL = 'http://wpshopgermany.de/?p=17187';
 			
 		} // public function __construct()
Index: /system/intern/mods/wpsg_mod_varianten.class.php
===================================================================
--- /system/intern/mods/wpsg_mod_varianten.class.php	(revision 6277)
+++ /system/intern/mods/wpsg_mod_varianten.class.php	(revision 6278)
@@ -333,20 +333,7 @@
 						unset($vp_data[$order]);
 						
-					}
-					else
-					{
-						
-						$this->shop->throwErrorCode('98_1');
-						
-					}
-					
-				}
-				
-				if (wpsg_isSizedArray($vp_data))
-				{
-						
-					$this->shop->throwErrorCode('98_2');
-						
-				}
+					} 
+					
+				} 
 				
 				$this->saveVarianten($_REQUEST['edit_id'], $vp_data_neu);
@@ -1351,5 +1338,5 @@
 	
 						// Den Namen der Variante auf die aktuelle Sprache stellen
-						if (wpsg_isSizedString($vp_data[$k]['lang'][$this->shop->getCurrentLanguage()]['name'])) $vp_data[$k]['name'] = $vp_data[$k]['lang'][$this->shop->getCurrentLanguage()]['name'];
+						if (wpsg_isSizedString($vp_data[$k]['lang'][$this->shop->getCurrentLanguageCode()]['name'])) $vp_data[$k]['name'] = $vp_data[$k]['lang'][$this->shop->getCurrentLanguageCode()]['name'];
 						
 						if (wpsg_isSizedArray($vp_data[$k]['vari']))
@@ -1360,5 +1347,5 @@
 								
 								// Den Namen der Variation auf die aktuelle Sprache korrigieren
-								if (wpsg_isSizedString($vp_data[$k]['lang'][$this->shop->getCurrentLanguage()]['vari'][$k2]['name'])) $vp_data[$k]['vari'][$k2]['name'] = $vp_data[$k]['lang'][$this->shop->getCurrentLanguage()]['vari'][$k2]['name'];
+								if (wpsg_isSizedString($vp_data[$k]['lang'][$this->shop->getCurrentLanguageCode()]['vari'][$k2]['name'])) $vp_data[$k]['vari'][$k2]['name'] = $vp_data[$k]['lang'][$this->shop->getCurrentLanguageCode()]['vari'][$k2]['name'];
 								
 							}
Index: /views/admin/ueber.phtml
===================================================================
--- /views/admin/ueber.phtml	(revision 6277)
+++ /views/admin/ueber.phtml	(revision 6278)
@@ -118,4 +118,15 @@
 	</div>
 	
+	<?php $arData = array(); $this->callMods('systemcheck', array(&$arData)); ?>
+	<?php if (wpsg_isSizedArray($arData)) { ?>
+		<div class="wpsg_admin_ueber_check_wrap">
+			<?php foreach ($arData as $d) { ?>
+				<p class="wpsg_admin_ueber_check wpsg_admin_ueber_check_<?php echo $d[1]; ?> <?php echo array('bg-info', 'bg-warning', 'bg-danger')[$d[1] - 1]; ?>">
+					<?php echo $d[2]; ?>
+				</p>
+			<?php } ?>
+		</div>
+	<?php } ?>
+	
 <?php echo wpsg_drawForm_AdminboxEnd(); ?>
 <?php } ?>
Index: /views/css/admin.css
===================================================================
--- /views/css/admin.css	(revision 6277)
+++ /views/css/admin.css	(revision 6278)
@@ -134,4 +134,9 @@
 .wpsg_admin_submenu .list-group-item { padding:5px 10px; }
 .list-group { margin-bottom:15px !important; }
+.wpsg_admin_ueber_check_wrap { padding-top:15px; }
+.wpsg_admin_ueber_check_wrap .wpsg_admin_ueber_check { padding:15px; }
+.wpsg_admin_ueber_check_wrap .wpsg_admin_ueber_check_1 { } /* Notice Meldungen */
+.wpsg_admin_ueber_check_wrap .wpsg_admin_ueber_check_2 { } /* Warnungen Meldungen */
+.wpsg_admin_ueber_check_wrap .wpsg_admin_ueber_check_3 { } /* Error Meldungen */
 
 /* Produktverwaltung */
Index: /views/produkt/addedit_general.phtml
===================================================================
--- /views/produkt/addedit_general.phtml	(revision 6277)
+++ /views/produkt/addedit_general.phtml	(revision 6278)
@@ -16,5 +16,5 @@
 			<a href="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Produkt&action=edit&edit_id=<?php echo $_REQUEST['edit_id']; ?>" title="<?php echo wpsg_translate(__('Zu Sprache #1# wechseln.', 'wpsg'), $a['name']); ?>">
 			<?php } else { ?>
-			<a href="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Produkt&action=edit&edit_id=<?php echo $_REQUEST['edit_id']; ?>&wpsg_lang=<?php echo $a['locale']; ?>" title="<?php echo wpsg_translate(__('Zu Sprache #1# wechseln.', 'wpsg'), $a['name']); ?>">
+			<a href="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Produkt&action=edit&edit_id=<?php echo $_REQUEST['edit_id']; ?>&wpsg_lang=<?php echo $a['lang']; ?>" title="<?php echo wpsg_translate(__('Zu Sprache #1# wechseln.', 'wpsg'), $a['name']); ?>">
 			<?php } ?>
 				<img src="<?php echo $this->getFlagURL().$a['flag']; ?>" alt="<?php echo wpsg_translate(__('Zu Sprache #1# wechseln.', 'wpsg'), $a['name']); ?>" />
@@ -49,5 +49,5 @@
 	<?php } ?>
 	<?php if (wpsg_isSizedInt($this->view['data']['id'])) { ?>
-		<?php echo wpsg_drawForm_TextStart(); $url = $this->getProduktLink(array('id' => ((wpsg_isSizedInt($this->view['data']['lang_parent']))?$this->view['data']['lang_parent']:$this->view['data']['id']))); ?>
+		<?php echo wpsg_drawForm_TextStart(); $url = $this->getProduktLink(array('id' => ((wpsg_isSizedInt($this->view['data']['id']))?$this->view['data']['id']:$this->view['data']['id']))); ?>
 			<a href="<?php echo $url; ?>"><?php echo wpsg_hspc($url); ?></a>
 		<?php echo wpsg_drawForm_TextEnd(__('URL', 'wpsg')); ?>		
Index: /views/produkt/index.phtml
===================================================================
--- /views/produkt/index.phtml	(revision 6277)
+++ /views/produkt/index.phtml	(revision 6278)
@@ -136,5 +136,5 @@
                         <td class="post-title column-title">
                             <strong>                                
-                                <?php if ($this->isMultiLingual()) { ?>
+                                <?php if ($this->isMultiLingual()) { ?>                                    
                                 <?php foreach ($this->getStoreLanguages() as $l) { ?>
                                     <?php if ($l['locale'] != $this->getDefaultLanguageLocale()) { ?>
Index: /views/produkttemplates/standard.phtml
===================================================================
--- /views/produkttemplates/standard.phtml	(revision 6277)
+++ /views/produkttemplates/standard.phtml	(revision 6278)
@@ -11,6 +11,4 @@
 	//$this->noReleatedProducts = true; 
 
-	//wpsg_debug($_SESSION);
-  
 if (!function_exists('is_plugin_active'))
 	require_once(ABSPATH.'/wp-admin/includes/plugin.php');
@@ -335,6 +333,6 @@
 		<?php /* Social Media Integration */ ?>
 		<div class="wpsg_product_social_media">
-			<?php if ( is_plugin_active( 'plugin-directory/shariff.php' )) {?>
-				<?=do_shortcode('[shariff]')?>
+			<?php if (is_plugin_active('plugin-directory/shariff.php')) {?>
+				<?php echo do_shortcode('[shariff]')?>
 			<?php } ?>
 		</div>
Index: /views/warenkorb/basket.phtml
===================================================================
--- /views/warenkorb/basket.phtml	(revision 6277)
+++ /views/warenkorb/basket.phtml	(revision 6278)
@@ -8,6 +8,8 @@
 	//wpsg_debug($_SESSION);
 	//wpsg_debug($this->arShipping);
-	
-?>	
+
+	//wpsg_debug(__('Deutschland', 'wpsg'));
+
+?>
 <div class="wpsg wpsg_basket <?php echo ((isset($_REQUEST['wpsg_basket_ajax']))?'wpsg_basket_ajax':''); ?>">
 	
Index: /wpshopgermany.php
===================================================================
--- /wpshopgermany.php	(revision 6277)
+++ /wpshopgermany.php	(revision 6278)
@@ -71,5 +71,5 @@
 	
 	$wp_upload_dir = wp_upload_dir();
-	
+	 
 	// Pfade
 	define('WPSG_PATH', dirname(__FILE__).'/');
@@ -111,4 +111,6 @@
 	require_once(dirname(__FILE__).'/lib/wpsg_header.class.php');
 	require_once(dirname(__FILE__).'/lib/wpsg_remoteconnection.class.php');
+	require_once(dirname(__FILE__).'/lib/wpsg_exceptionhandler.class.php');
+	require_once(dirname(__FILE__).'/model/wpsg_exception.class.php');
 	require_once(dirname(__FILE__).'/model/wpsg_model.class.php');
 	require_once(dirname(__FILE__).'/model/wpsg_product.class.php');
@@ -118,5 +120,5 @@
 	require_once(dirname(__FILE__).'/model/wpsg_customer.class.php');
 	require_once(dirname(__FILE__).'/model/wpsg_news.class.php');
-	require_once(dirname(__FILE__).'/mods/wpsg_mod_basic.class.php');
+	require_once(dirname(__FILE__).'/mods/wpsg_mod_basic.class.php');	
 	require_once(dirname(__FILE__).'/controller/wpsg_SystemController.class.php');
 	require_once(dirname(__FILE__).'/controller/wpsg_ShopController.class.php');
@@ -125,5 +127,5 @@
 	require_once(dirname(__FILE__).'/controller/wpsg_BasketController.class.php');
 	require_once(dirname(__FILE__).'/controller/wpsg_OrderController.class.php');
-		
+	
 	$_GET['wpsg_quotecheck'] = '\"CHECK';
 	
@@ -133,5 +135,8 @@
 	/** @var wpsg_ShopController */
 	$GLOBALS['wpsg_sc'] = new wpsg_ShopController();
-			
+	
+	// Nicht behandelte Exceptions werden hier verarbeitet
+	set_exception_handler(array('\\wpsg\\exceptionhandler', 'exception'));
+	
 	if ($GLOBALS['wpsg_sc']->isMultiBlog() && !is_admin() && $GLOBALS['wpsg_sc']->get_option('wpsg_multiblog_sessionPath', true) == '1')
 	{
@@ -218,5 +223,4 @@
 
 	add_action('widgets_init', array($GLOBALS['wpsg_sc'], 'widget_init'));
-	//add_action('widgets_init', create_function('', 'return register_widget("wpsg_basket_widget");'));
 	
 	$GLOBALS['wpsg_sc']->callMods('load', array());
