Index: /controller/wpsg_OrderController.class.php
===================================================================
--- /controller/wpsg_OrderController.class.php	(revision 7196)
+++ /controller/wpsg_OrderController.class.php	(revision 7197)
@@ -93,30 +93,17 @@
 		    $oCalculation = new \wpsg\wpsg_calculation();
 		    $oCalculation->fromDB($_REQUEST['edit_id']);
-		    
-            $_REQUEST['shipping_price'] = wpsg_tf($_REQUEST['shipping_price']);
-            $_REQUEST['payment_price'] = wpsg_tf($_REQUEST['payment_price']);
-            
-            if ($this->shop->getBackendTaxview() === WPSG_BRUTTO) {
-                
-                $shipping_netto = wpsg_calculatePreis($_REQUEST['shipping_price'], WPSG_NETTO,$oDefaultCountry->getTax('c'));
-                $payment_netto = wpsg_calculatePreis($_REQUEST['payment_price'], WPSG_NETTO,$oDefaultCountry->getTax('c'));
-                                
-            } else {
-                
-                $shipping_netto = $_REQUEST['shipping_price'];
-                $payment_netto = $_REQUEST['payment_price'];
-                
-            }
-
-            $oCalculation->setShipping(
-                $_REQUEST['shipping_key'],
-                $shipping_netto,
-                $this->shop->arShipping[$_REQUEST['shipping_key']]['mwst_key']
+		     
+            $oCalculation->addShipping(
+				$_REQUEST['shipping_price'],
+				$this->shop->getBackendTaxview(),
+                $this->shop->arShipping[$_REQUEST['shipping_key']]['mwst_key'],
+				$_REQUEST['shipping_key']
             );
 
-            $oCalculation->setPayment(
-                $_REQUEST['payment_key'],
-                $payment_netto,
-                $this->shop->arPayment[$_REQUEST['payment_key']]['mwst_key']
+            $oCalculation->addPayment(
+                $_REQUEST['payment_price'],
+				$this->shop->getBackendTaxview(),
+                $this->shop->arPayment[$_REQUEST['payment_key']]['mwst_key'],
+				$_REQUEST['payment_key']
             );
 
@@ -1182,17 +1169,7 @@
 					} else if ($_REQUEST['do'] === 'submit') {
 						
-						$oDefaultCountry = $this->shop->getDefaultCountry();
-						
-						if (strpos($_REQUEST['be_voucher_amount'], '%') !== false) $voucher_netto = wpsg_ff(wpsg_tf($_REQUEST['be_voucher_amount']), $this->shop->get_option('wpsg_currency'));
-						else {
-							
-							if ($this->shop->getBackendTaxview() === WPSG_BRUTTO) $voucher_netto = wpsg_calculatePreis(wpsg_tf($_REQUEST['be_voucher_amount']), WPSG_NETTO, $oDefaultCountry->getTax('c'));
-							else $voucher_netto = $_REQUEST['be_voucher_amount'];
-							
-						}
-						
-						if (wpsg_tf($voucher_netto) <= 0) $this->shop->view['oCalculation']->removeVoucher();
-						else $this->shop->view['oCalculation']->addVoucher($voucher_netto, wpsg_tf($_REQUEST['be_voucher_amount'],true), $_REQUEST['be_voucher_code'], $_REQUEST['be_voucher_id']);
-						
+						if (wpsg_tf($_REQUEST['be_voucher_amount']) < 0) $this->shop->view['oCalculation']->removeVoucher();
+						else $this->shop->view['oCalculation']->addVoucher($_REQUEST['be_voucher_amount'], $this->shop->getBackendTaxview(), '0', 1, $_REQUEST['be_voucher_code'], $_REQUEST['be_voucher_id']);
+						 						
 					} else if ($_REQUEST['do'] === 'search') {
 						
@@ -1223,5 +1200,5 @@
 					
 					$this->shop->view['oCalculation']->toDB($_REQUEST['edit_id']);
-					
+					 					
 					wpsg_header::JSONData([
 						'product_table' => $this->shop->render(WPSG_PATH_VIEW.'order/product_table.phtml', false)
@@ -1236,24 +1213,15 @@
             } else if (wpsg_isSizedString($_REQUEST['subaction'], 'editDiscount')) {
 
-		        $this->shop->view['oCalculation'] = new \wpsg\wpsg_calculation();
-                $this->shop->view['oCalculation']->fromDb($_REQUEST['edit_id']);
-		        
+		    	/** @var \wpsg\wpsg_calculation */
+		        $oCalculation = new \wpsg\wpsg_calculation();
+                $oCalculation->fromDb($_REQUEST['edit_id']);
+			
+				$this->shop->view['oCalculation'] = $oCalculation;
+                
                 if (wpsg_isSizedString($_REQUEST['do'], 'submit')) {
-
-                    $oDefaultCountry = $this->shop->getDefaultCountry();
-                    
-                    if (strpos($_REQUEST['be_discount_amount'], '%') !== false) $discount_netto = $_REQUEST['be_discount_amount'];
-                    else {
-                        
-                        if ($this->shop->getBackendTaxview() === WPSG_BRUTTO) $discount_netto = wpsg_calculatePreis(wpsg_tf($_REQUEST['be_discount_amount']), WPSG_NETTO, $oDefaultCountry->getTax('c'));
-                        else $discount_netto = $_REQUEST['be_discount_amount'];
-                    
-                    }
-                    
-                    if (wpsg_tf($discount_netto) <= 0) $this->shop->view['oCalculation']->removeDiscount(); 
-                    else $this->shop->view['oCalculation']->addDiscount($discount_netto, wpsg_tf($_REQUEST['be_discount_amount'],true));
-
-                    $this->shop->view['oCalculation']->toDB($_REQUEST['edit_id']);
-
+	
+					$oCalculation->addDiscount($_REQUEST['be_discount_amount'], $this->shop->getBackendTaxview(), '0',1);
+                    $oCalculation->toDB($_REQUEST['edit_id']);
+	 
                     wpsg_header::JSONData([
                         'product_table' => $this->shop->render(WPSG_PATH_VIEW.'order/product_table.phtml', false)
@@ -1262,8 +1230,7 @@
                 } else if (wpsg_isSizedString($_REQUEST['do'], 'remove')) {
 	
-					$this->shop->view['oCalculation']->removeDiscount();
-                	
-					$this->shop->view['oCalculation']->toDB($_REQUEST['edit_id']);
-	
+					$oCalculation->removeDiscount();
+					$oCalculation->toDB($_REQUEST['edit_id']);
+	 
 					wpsg_header::JSONData([
 						'product_table' => $this->shop->render(WPSG_PATH_VIEW.'order/product_table.phtml', false)
@@ -1328,24 +1295,16 @@
 
                     $order_product_id = ((wpsg_isSizedInt($_REQUEST['order_product_id']))?$_REQUEST['order_product_id']:false);
-		            
 		            $oProduct = wpsg_product::getInstance($_REQUEST['product_id']);
-		            $oDefaultCountry = $this->shop->getDefaultCountry();
-		            
-		            $product_key = $_REQUEST['product_id'];		            
-		            $this->shop->callMod('wpsg_mod_productvariants', 'getProductKeyFromRequest', [&$product_key, $_REQUEST['product_id'], $_REQUEST]);
-		            
-		            if ($this->shop->getBackendTaxview() === WPSG_NETTO) $price_netto = wpsg_tf($_REQUEST['add_price']);
-		            else $price_netto = wpsg_calculatePreis(wpsg_tf($_REQUEST['add_price']), WPSG_NETTO, $oDefaultCountry->getTax($oProduct->mwst_key));
-
-                    $oCalculation->addProduct($product_key, $oCalculation->getMaxProductIndex() + 1, $price_netto, $_REQUEST['add_amount'], $oProduct->mwst_key, $order_product_id);
-
-                    $oCalculation->toDB($_REQUEST['edit_id']);
-
-                    $this->shop->view['oCalculation'] = $oCalculation;
-                    
-                    wpsg_header::JSONData([
-                        'product_table' => $this->shop->render(WPSG_PATH_VIEW.'order/product_table.phtml', false)
-                    ]);
-		            
+					 
+					$oCalculation->addProduct($_REQUEST['add_price'], $this->shop->getBackendTaxview(), $oProduct->mwst_key, $_REQUEST['add_amount'], $_REQUEST['product_id'], false, $order_product_id);
+			
+					$oCalculation->toDB($_REQUEST['edit_id']);
+			
+					$this->shop->view['oCalculation'] = $oCalculation;
+			
+					wpsg_header::JSONData([
+						'product_table' => $this->shop->render(WPSG_PATH_VIEW.'order/product_table.phtml', false)
+					]);
+					 		            
                 }
 		        
Index: /lib/install.php
===================================================================
--- /lib/install.php	(revision 7196)
+++ /lib/install.php	(revision 7197)
@@ -116,28 +116,10 @@
    		useragent VARCHAR(255) NOT NULL,
    		comment TEXT NOT NULL,
-   		shipping_tax_key VARCHAR(10) NOT NULL,
-   		payment_tax_key VARCHAR(10) NOT NULL,
    		price_gesamt DOUBLE(10,4) NOT NULL,
 		price_gesamt_netto DOUBLE(10,4) NOT NULL,
-		price_gesamt_brutto DOUBLE(10,4) NOT NULL,
-   		price_shipping DOUBLE(10,4) NOT NULL,
-		price_shipping_netto DOUBLE(10,4) NOT NULL,
-		price_shipping_brutto DOUBLE(10,4) NOT NULL,			
-   		price_payment DOUBLE(10,4) NOT NULL,
-		price_payment_netto DOUBLE(10,4) NOT NULL,
-		price_payment_brutto DOUBLE(10,4) NOT NULL,
-   		price_rabatt DOUBLE(10,4) NOT NULL,
-   		price_rabatt_netto DOUBLE(10,4) NOT NULL,
-   		price_rabatt_brutto DOUBLE(10,4) NOT NULL,
+		price_gesamt_brutto DOUBLE(10,4) NOT NULL,   		
    		discount_tax_key VARCHAR(10) NOT NULL,
-   		discount_set VARCHAR(100) NOT NULL COMMENT 'Eventuell in %',
-		price_gs DOUBLE(10,4) NOT NULL,
-		price_gs_netto DOUBLE(10,4) NOT NULL,
-		price_gs_brutto DOUBLE(10,4) NOT NULL,
-		price_frontend INT(1) NOT NULL,
-   		mwst_payment DOUBLE(10,4) NOT NULL,
-   		mwst_shipping DOUBLE(10,4) NOT NULL,
-   		type_shipping VARCHAR(255) NOT NULL,
-   		type_payment VARCHAR(255) NOT NULL,   		
+   		discount_set VARCHAR(100) NOT NULL COMMENT 'Eventuell in %',		
+		price_frontend INT(1) NOT NULL,   		   		
 	  	bname VARCHAR(500) NOT NULL,
 		bblz VARCHAR(500) NOT NULL,
@@ -150,7 +132,5 @@
    		transaction varchar(255) NOT NULL,   			
    		dp_cron_planed datetime NOT NULL,
-   		dp_cron_done datetime NOT NULL,
-   		gs_id INT(11) NOT NULL,
-   		gs_code VARCHAR(1000) NOT NULL COMMENT 'Der Gutscheincode',
+   		dp_cron_done datetime NOT NULL,   		 
    		kleinunternehmer INT(1) NOT NULL,
    		custom_data MEDIUMBLOB NOT NULL,
@@ -158,7 +138,52 @@
    		language VARCHAR(10) NOT NULL,
    		adress_id INT(11) NOT NULL COMMENT 'Link zu WPSG_TBL_ADRESS (Rechnungsadresse)',
-   		shipping_adress_id INT(11) NOT NULL COMMENT 'Link zu WPSG_TBL_ADRESS (Lieferanschrift)',
+   		shipping_adress_id INT(11) NOT NULL COMMENT 'Link zu WPSG_TBL_ADRESS (Lieferanschrift)',   		   		
+   		be_bruttonetto INT(1) NOT NULL COMMENT 'Preisanzeige Backend',
+   		fe_bruttonetto INT(1) NOT NULL COMMENT 'Preisanzeige Frontend',   		   		
+   		shipping_set VARCHAR(255) NOT NULL COMMENT 'Versandkosten evtl. mit %',
+   		shipping_key VARCHAR(255) NOT NULL COMMENT 'AusgewÃ€hlte Versandart',
+   		shipping_bruttonetto INT(1) NOT NULL COMMENT 'Versandkosten in Brutto/Netto',
+   		shipping_tax_key VARCHAR(10) COMMENT 'SteuerschlÃŒssel der Versandart',   		
+   		type_shipping VARCHAR(255) COMMENT 'DEPRECATED durch shipping_key ersetzt',
+   		price_shipping DOUBLE(10,4) COMMENT 'DEPRECATED sollte nicht verwendet werden',
+		price_shipping_netto DOUBLE(10,4) COMMENT 'DEPRECATED sollte nicht verwendet werden',
+		price_shipping_brutto DOUBLE(10,4) COMMENT 'DEPRECATED sollte nicht verwendet werden',
+		mwst_shipping DOUBLE(10,4) COMMENT 'DEPRECATED durch shipphig_tax ersetzt',	   		
+   		payment_set VARCHAR(255) COMMENT 'Zahlungsarten evtl. mit %',
+   		payment_key VARCHAR(255) COMMENT 'AusgewÃ€hlte Zahlungsart',
+   		payment_bruttonetto INT(1) COMMENT 'Zahlungskoten in Brutto/Netto',
+   		payment_tax_key VARCHAR(10) COMMENT 'SteuerschlÃŒssel der Zahlungsart',   		
+   		type_payment VARCHAR(255) COMMENT 'DEPRECATED durch payment_key ersetzt',
+   		price_payment DOUBLE(10,4) COMMENT 'DEPRECATED sollte nicht verwendet werden',
+		price_payment_netto DOUBLE(10,4) COMMENT 'DEPRECATED sollte nicht verwendet werden',
+		price_payment_brutto DOUBLE(10,4) COMMENT 'DEPRECATED sollte nicht verwendet werden',
+   		mwst_payment DOUBLE(10,4) COMMENT 'DEPRECATED durch payment_tax ersetzt',   		
+   		discount_set VARCHAR(255) COMMENT 'Rabattwert aus Backend',
+   		discount_bruttonetto INT(1) COMMENT 'Brutto/Netto Rabatt',
+   		discount_tax_key VARCHAR(10) COMMENT 'SteuerschlÃŒssel Rabatt',   		
+   		price_rabatt DOUBLE(10,4) NOT NULL COMMENT 'DEPRECATED',
+   		price_rabatt_netto DOUBLE(10,4) NOT NULL COMMENT 'DEPRECATED',
+   		price_rabatt_brutto DOUBLE(10,4) NOT NULL COMMENT 'DEPRECATED',   		
+   		voucher_tax_key VARCHAR(10) COMMENT 'SteuerschlÃŒssel Gutschein'   		
+   		price_gs DOUBLE(10,4) NOT NULL COMMENT 'DEPRECATED sollte nicht verwendet werden',
+		price_gs_netto DOUBLE(10,4) NOT NULL COMMENT 'DEPRECATED sollte nicht verwendet werden',
+		price_gs_brutto DOUBLE(10,4) NOT NULL COMMENT 'DEPRECATED sollte nicht verwendet werden',
    		gs_set VARCHAR(100) NOT NULL COMMENT 'Eventuell in % (Wert des Gutscheins)',
    		gs_tax_key VARCHAR(10) NOT NULL COMMENT 'Steuersatz des Gutscheins',
+   		voucher_bruttonetto INT(1) COMMENT 'Brutto/Netto Gutschein',
+   		gs_id INT(11) NOT NULL,
+   		gs_code VARCHAR(1000) NOT NULL COMMENT 'Der Gutscheincode',   		   		   		
+   		shop_country_id INT(11) COMMENT 'ID des Landes vom Shop',
+   		shop_country_tax INT(1) COMMENT 'MwSt. Grundlage',
+   		shop_country_tax_a INT(1) COMMENT 'Steuersatz A',
+   		shop_country_tax_b INT(1) COMMENT 'Steuersatz B',
+   		shop_country_tax_c INT(1) COMMENT 'Steuersatz C',
+   		shop_country_tax_d INT(1) COMMENT 'Steuersatz D',   		
+   		target_country_id INT(11) COMMENT 'ID des Landes vom Zie',
+   		target_country_tax INT(1) COMMENT 'MwSt. Grundlage',
+   		target_country_tax_a INT(1) COMMENT 'Steuersatz A',
+   		target_country_tax_b INT(1) COMMENT 'Steuersatz B',
+   		target_country_tax_c INT(1) COMMENT 'Steuersatz C',
+   		target_country_tax_d INT(1) COMMENT 'Steuersatz D',
    		KEY adress_id (adress_id),
    		KEY shipping_adress_id (shipping_adress_id),
@@ -167,5 +192,5 @@
    		PRIMARY KEY  (id)
    	) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;";
-	
+	 	
 	dbDelta($sql);
 	
@@ -176,5 +201,7 @@
    		id mediumint(9) NOT NULL AUTO_INCREMENT,
    		o_id int(25) NOT NULL,
-   		p_id int(25) NOT NULL,
+   		p_id int(25) NOT NULL,   		
+   		product_set VARCHAR(255) COMMENT 'Preis des Produktes im Backend',
+   		product_bruttonetto INT(1) COMMENT 'Preiseinstellung Brutto/Netto',   		   		
 		productkey varchar(255) NOT NULL,
 		product_index int(11) NOT NULL,
Index: /lib/wpsg_calculation.class.php
===================================================================
--- /lib/wpsg_calculation.class.php	(revision 7196)
+++ /lib/wpsg_calculation.class.php	(revision 7197)
@@ -20,33 +20,20 @@
         private $shop = null;
 
-        /**
-         * @var null 
-         */
+        /** @var array */
+        private $arCountry = null;
+        
+        /** @var array */
         private $arCalculation = null;
         
-        /** @var array */
-        private $arProducts = [];
-        
-        /** @var array */
-        private $shipping = null;
-        
-        /** @var array */
-        private $payment = null;
-        
-        /** @var \wpsg_country */
-        private $oCountry = null;
-        
-        /** @var array */
-        private $arDiscount = null;
-        
-        /** @var array */
-        private $arVoucher = null;
-        
+        /** @var array  */
+    	private $arCalculationRow = null;
+                                
         public function __construct() {
             
             $this->db = &$GLOBALS['wpsg_db'];
             $this->shop = &$GLOBALS['wpsg_sc'];
-            
-            $this->oCountry = $this->shop->getDefaultCountry();
+                        
+            $this->arCalculationRow = [];
+            $this->arCountry = [];
             
         }        
@@ -55,7 +42,14 @@
          * Setzt das Standardland fÃŒr die Steuerberechnung wenn im $tax_key kein Land definiert ist 
          */
-        public function setCountry($oCountry) {
-            
-            $this->oCountry = $oCountry;
+        public function addCountry($country_id, $tax_mode, $tax_a, $tax_b, $tax_c, $tax_d, $default = true) {
+            
+            $this->arCountry[$country_id] = [
+            	'tax_mode' => $tax_mode,
+				'default' => $default,
+            	'a_'.$country_id => $tax_a,
+				'b_'.$country_id => $tax_b,
+				'c_'.$country_id => $tax_c,
+				'd_'.$country_id => $tax_d,
+			];
             
         }
@@ -63,84 +57,99 @@
         public function removeVoucher() {
         	
-        	$this->arVoucher = null;
+        	foreach ($this->arCalculationRow as $k => $cr) {
+        		
+        		if ($cr['type'] === 'voucher') {
+        			
+        			unset($this->arCalculationRow[$k]);
+        			
+				}
+        		
+			}
         	
 		}
 	
 		/**
-		 * @param $voucher_value Der Netto Betrg
-		 * @param $voucher_set Der Wert der ÃŒbergeben wurde, eventuell mit %
+		 * @param $voucher_set Der Wert aus dem Backend, eventuell mit %
+		 * @param $voucher_bruttonetto WPSG_BRUTTO oder WPSG_NETTO je nach Backend Einstellung
 		 * 
 		 */
-		public function addVoucher($voucher_value, $voucher_set, $voucher_code = "", $voucher_id = 0) {
-			
-			$this->arVoucher = [
-				[
-					'set' => $voucher_set,
-					'value' => $voucher_value,
-					'tax_key' => '0',
-					'code' => $voucher_code,
-					'id' => $voucher_id
+		public function addVoucher($set, $bruttonetto, $tax_key, $amount = 1, $code = false, $id = false) {
+		 
+			$tax_key = $this->normalizeTaxKey($tax_key);
+			
+			if (strpos($set, '-') === false) $set = '-'.$set; 
+			
+			$this->arCalculationRow['voucher'] = [
+				'type' => 'voucher',
+				'amount' => $amount,
+				'set' => $set,
+				'tax_key' => $tax_key,
+				'bruttonetto' => $bruttonetto,
+				'data' => [
+					'code' => $code,
+					'id' => $id
+				]
+			]; 
+			
+		}
+        
+        public function removeDiscount() {
+	
+			foreach ($this->arCalculationRow as $k => $cr) {
+		
+				if ($cr['type'] === 'discount') {
+			
+					unset($this->arCalculationRow[$k]);
+			
+				}
+		
+			}
+            
+        }
+        
+        public function addDiscount($set, $bruttonetto, $tax_key, $amount = 1) {
+	 
+			$tax_key = $this->normalizeTaxKey($tax_key);
+	
+			if (strpos($set, '-') === false) $set = '-'.$set;
+			
+			$this->arCalculationRow['discount'] = [
+				'type' => 'discount',
+				'amount' => $amount,
+				'set' => $set,
+				'tax_key' => $tax_key,
+				'bruttonetto' => $bruttonetto,
+				'data' => [ ]
+			];
+	                    
+        }
+        
+        public function addProduct($set, $bruttonetto, $tax_key, $amount, $product_key, $product_index = false, $order_product_id = false) {
+            					
+            $tax_key = $this->normalizeTaxKey($tax_key);
+          
+            if ($product_index === false) $product_index = $this->getMaxProductIndex();
+            
+            $this->arCalculationRow[] = [
+            	'type' => 'product',
+				'amount' => $amount,
+				'set' => $set,
+				'tax_key' => $tax_key,
+				'bruttonetto' => $bruttonetto,
+				'data' => [
+					'product_id' => $this->shop->getProduktID($product_key),
+					'product_key' => $product_key,
+					'product_index' => $product_index,
+					'order_product_id' => $order_product_id
 				]
 			];
-        	
-		}
-        
-        public function removeDiscount() {
-            
-            $this->arDiscount = null;
-            
-        }
-        
-        public function addDiscount($discount_value, $discount_set) {
-            
-            $this->arDiscount = [
-                [
-                    'set' => $discount_set,
-                    'value' => $discount_value,
-                    'tax_key' => '0'
-                ]
-            ];
                         
         }
         
-        public function addProduct($product_key, $product_index, $price_netto, $amount, $tax_key, $order_product_id = false) {
-            
-            $tax_key = $this->normalizeTaxKey($tax_key);
-          
-            $p_set = [
-                'product_key' => $product_key,
-                'product_id' => $this->shop->getProduktId($product_key),
-                'product_index' => $product_index,
-                'netto' => $price_netto,
-                'amount' => $amount,
-                'tax_key' => $tax_key,
-                'order_product_id' => $order_product_id
-            ];
-            
-            if (wpsg_isSizedInt($order_product_id)) {
-                
-                // Ersetzen wenn vorhanden
-                foreach ($this->arProducts as $k => $p) {
-                    
-                    if ($p['order_product_id'] == $order_product_id) {
-                        
-                        $this->arProducts[$k] = $p_set;
-                        return;
-                        
-                    }
-                    
-                }
-                
-            }
-            
-            $this->arProducts[] = $p_set;
-            
-        }
-        
         public function removeProduct($order_product_id) {
             
-            foreach ($this->arProducts as $k => $p) {
-                
-                if ($p['order_product_id'] == $order_product_id) unset($this->arProducts[$k]);
+            foreach ($this->arCalculationRow as $k => $cr) {
+                
+                if ($cr['type'] === 'product' && $cr['data']['order_product_id'] == $order_product_id) unset($this->arCalculationRow[$k]);
                 
             }
@@ -151,13 +160,17 @@
          * Setzt die Versandkosten
          */
-        public function setShipping($key, $netto, $tax_key) {
+        public function addShipping($set, $bruttonetto, $tax_key, $shipping_key) {
 
             $tax_key = $this->normalizeTaxKey($tax_key);
-            
-            $this->shipping = [
-                'key' => $key,
-                'netto' => $netto,
-                'brutto' => 0,
-                'tax_key' => $tax_key
+                                    
+            $this->arCalculationRow['shipping'] = [
+            	'type' => 'shipping',
+				'amount' => 1,
+            	'set' => $set,
+				'bruttonetto' => $bruttonetto,
+                'tax_key' => $tax_key,
+				'data' => [
+					'shipping_key' => $shipping_key
+				]
             ];
                          
@@ -167,86 +180,128 @@
          * Setzt die Zahlungskosten
          */
-        public function setPayment($key, $netto, $tax_key) {
-
-            $tax_key = $this->normalizeTaxKey($tax_key);
-            
-            $this->payment = [
-                'key' => $key,
-                'netto' => $netto,
-                'brutto' => 0,
-                'tax_key' => $tax_key
-            ];
-            
-        }
-
-        public function getCalculationArray($taxView = false, $force_rebuild = false) {
-
-            if ($this->oCountry === null) throw new \Exception(__('Warenkorb kann nicht ohne ein gesetztes Land berechnet werden.', 'wpsg'));
-            if ($this->shipping === null) throw new \Exception(__('Kein Versand definiert.'));
-            if ($this->payment === null) throw new \Exception(__('Keine Zahlung definiert.'));
-
+        public function addPayment($set, $bruttonetto, $tax_key, $payment_key) {
+	
+			$tax_key = $this->normalizeTaxKey($tax_key);
+	
+			$this->arCalculationRow['payment'] = [
+				'type' => 'payment',
+				'amount' => 1,
+				'set' => $set,
+				'bruttonetto' => $bruttonetto,
+				'tax_key' => $tax_key,
+				'data' => [
+					'payment_key' => $payment_key
+				]
+			];
+            
+        }
+
+        public function getCalculationArray($force_rebuild = false) {
+
+            if ($this->arCountry === null) throw new \Exception(__('Warenkorb kann nicht ohne ein gesetztes Land berechnet werden.', 'wpsg'));
+            
             if ($force_rebuild === true || is_null($this->arCalculation)) {
 
-                $this->arCalculation = [
-                    'land' => $this->db->fetchRow("SELECT * FROM `".WPSG_TBL_LAND."` WHERE `id` = '".wpsg_q($this->oCountry->id)."' "),
-                    'products' => $this->arProducts
-                ];
-
-                $this->arCalculation['discount'] = [];                
-                $this->arCalculation['sum'] = [
-                    'product_netto' => 0,
-                    'product_brutto' => 0,
-                    'prediscount_netto' => 0,
-                    'prediscount_brutto' => 0,
-                    'netto' => 0,
-                    'brutto' => 0,
-                    'tax' => 0,
-                    'discount_netto' => 0,
-                    'discount_brutto' => 0,
-					'prevoucher_netto' => 0,
-					'prevoucher_brutto' => 0,
-					'voucher_netto' => 0,
-					'voucher_brutto' => 0
-                ];
-
-                $this->arCalculation['products'] = $this->arProducts;
-                
-                foreach ($this->arProducts as $k => $p) {
-                    
-                    $amount_price_netto = $p['netto'] * $p['amount'];
-                    
-                    $this->arCalculation['sum']['product_netto'] += $amount_price_netto;
-                    $this->arCalculation['sum']['netto'] += $amount_price_netto;
-
-                    $this->addTax($amount_price_netto, $p['tax_key']);
-
-                }
-                
-                // Gutscheine einbeziehen
-				$this->calculateVoucher();
-
-                $this->arCalculation['shipping'] = $this->shipping;
-                $this->arCalculation['payment'] = $this->payment;
-
-                $this->arCalculation['sum']['netto'] += $this->shipping['netto'];
-                $this->addTax($this->shipping['netto'], $this->shipping['tax_key']);
-
-                $this->arCalculation['sum']['netto'] += $this->payment['netto'];
-                $this->addTax($this->payment['netto'], $this->payment['tax_key']);
-                                
-                // Rabatte einbeziehen
-                $this->calculateDiscount();
-                
-                // Jetzt den Bruttopreis berechnen
-                $this->calculateTax();
-
-            }
-
-            if ($taxView !== false) {
-            
-                $this->setTaxView($taxView);
-            
-            }
-                
+            	$this->arCalculation = [
+            		'sum' => [
+            			'product_netto' => 0,
+						'product_brutto' => 0,
+						'product_tax' => 0,
+						'productsum_netto' => 0,
+						'productsum_brutto' => 0,
+						'netto' => 0,
+						'brutto' => 0,
+						'tax' => 0
+					]
+            	];
+            	
+            	$arTypeOrder = ['product', 'voucher', 'shipping', 'payment', 'discount'];
+            	            	
+            	uasort($this->arCalculationRow, function($a, $b) use ($arTypeOrder) {
+            		
+            		return strcmp(array_search($a['type'], $arTypeOrder),array_search($b['type'], $arTypeOrder));
+            		
+				});
+	            	
+                foreach ($this->arCalculationRow as $cr) {
+                	            
+                	$this->addTax($cr['tax_key']);
+                	$this->calculateTaxProportionally($cr['bruttonetto']);
+                	
+                	if (strpos($cr['set'], '%') !== false) {
+                		
+                		// Prozentualer Wert
+						$netto = $this->arCalculation['sum']['netto'] / 100 * wpsg_tf($cr['set']);
+						$brutto = $this->arCalculation['sum']['brutto'] / 100 * wpsg_tf($cr['set']);
+				
+					} else {
+                	
+						// Netto / Brutto berechnen
+						if ($cr['bruttonetto'] === WPSG_NETTO) {
+							
+							$netto = wpsg_tf($cr['set']);
+							
+							list($netto, $brutto) = $this->calculateTaxPart(WPSG_NETTO, $netto, $cr['tax_key']); 
+							
+							
+						} else {
+							
+							$brutto = wpsg_tf($cr['set']);
+							
+							list($netto, $brutto) = $this->calculateTaxPart(WPSG_BRUTTO, $brutto, $cr['tax_key']);
+								
+						}
+																		
+					}
+					  
+					$netto_single = $netto;
+                	$brutto_single = $brutto;
+					
+					$netto *= $cr['amount'];
+					$brutto *= $cr['amount'];
+						
+					$this->arCalculation['tax'][$cr['tax_key']]['netto'] += $netto;
+					$this->arCalculation['tax'][$cr['tax_key']]['brutto'] += $brutto;
+					
+					$tax = $brutto - $netto;
+					       					
+					$this->arCalculation[$cr['type']][] = $cr['data'] + [
+						'netto' => $netto,
+						'brutto' => $brutto,
+						'netto_single' => $netto_single,
+						'brutto_single' => $brutto_single,
+						'tax' => $tax,
+						'amount' => $cr['amount'],
+						'tax_key' => $cr['tax_key'],
+						'bruttonetto' => $cr['bruttonetto'],
+						'set' => $cr['set']
+					];
+					
+					$this->arCalculation['sum'][$cr['type'].'_netto'] += $netto;
+					$this->arCalculation['sum'][$cr['type'].'_brutto'] += $brutto;
+					$this->arCalculation['sum'][$cr['type'].'_tax'] += $tax;
+					
+					$this->arCalculation['sum']['netto'] += $netto;
+					$this->arCalculation['sum']['brutto'] += $brutto;
+					$this->arCalculation['sum']['tax'] += $tax;
+						
+					if (in_array($cr['type'], ['product', 'voucher'])) {
+						
+						$this->arCalculation['sum']['productsum_netto'] += $netto;
+						$this->arCalculation['sum']['productsum_brutto'] += $brutto;
+					} 
+										
+				}
+				
+				foreach ($this->arCalculation['tax'] as $tax_key => $tax) {
+		
+					$this->arCalculation['tax'][$tax_key]['sum'] = $tax['brutto'] - $tax['netto'];
+		
+				}
+                 				
+				//die(wpsg_debug($this->arCalculation));
+
+            }
+
             return $this->arCalculation;
 
@@ -259,64 +314,119 @@
          */
         public function toDB($id = false, $db_data = []) {
-           
-        	$this->setTaxView($this->shop->getFrontendTaxview());
-        	
+            
             $arCalculation = $this->getCalculationArray();
 
             $db_data['price_gesamt_netto'] = wpsg_q($arCalculation['sum']['netto']);
-            $db_data['price_shipping_netto'] = wpsg_q($this->arCalculation['shipping']['netto']);
-            $db_data['price_payment_netto'] = wpsg_q($this->arCalculation['payment']['netto']);
-            
             $db_data['price_gesamt_brutto'] = wpsg_q($arCalculation['sum']['brutto']);
-            $db_data['price_shipping_brutto'] = wpsg_q($this->arCalculation['shipping']['brutto']);
-            $db_data['price_payment_brutto'] = wpsg_q($this->arCalculation['payment']['brutto']);
-            
-            if ($this->shop->getFrontendTaxview() === WPSG_NETTO) {
-                
-                $db_data['price_gesamt'] = wpsg_q($arCalculation['sum']['netto']);
-                $db_data['price_shipping'] = wpsg_q($arCalculation['shipping']['netto']);
-                $db_data['price_payment'] = wpsg_q($arCalculation['payment']['netto']);
-                $db_data['price_rabatt'] = wpsg_q($arCalculation['sum']['discount_netto']);
-                
-            } else {
-
-                $db_data['price_gesamt'] = wpsg_q($arCalculation['sum']['brutto']);
-                $db_data['price_shipping'] = wpsg_q($arCalculation['shipping']['brutto']);
-                $db_data['price_payment'] = wpsg_q($arCalculation['payment']['brutto']);
-                $db_data['price_rabatt'] = wpsg_q($arCalculation['sum']['discount_brutto']);
-                
-            }
-            
-            
-            $db_data['price_rabatt_netto'] = wpsg_q($arCalculation['sum']['discount_netto']);
-            $db_data['price_rabatt_brutto'] = wpsg_q($arCalculation['sum']['discount_brutto']);
                         
-            if (wpsg_isSizedArray($this->arDiscount)) {
-            
-                foreach ($this->arDiscount as $d) {
-                    
-                    $db_data['discount_tax_key'] = $d['tax_key'];
-                    $db_data['discount_set'] = $d['set'];
-                    
-                }
-                    
-            }
-	
-			$db_data['price_gs_netto'] = wpsg_q($arCalculation['sum']['voucher_netto']);
-			$db_data['price_gs_brutto'] = wpsg_q($arCalculation['sum']['voucher_brutto']);
-	
-			if (wpsg_isSizedArray($this->arVoucher)) {
-		
-				foreach ($this->arVoucher as $v) {
-			
-					$db_data['gs_tax_key'] = $v['tax_key'];
-					$db_data['gs_set'] = $v['set'];
-					$db_data['gs_id'] = intval($v['id']);
-					$db_data['gs_code'] = $v['code'];
-			 					
-				}
-		
-			}
-                        
+            if ($this->shop->getFrontendTaxview() === WPSG_NETTO) $display = 'netto';
+            else  $display = 'brutto';
+	
+			$db_data['price_gesamt'] = wpsg_q($arCalculation['sum'][$display]);
+	
+			// Shipping leeren
+			$db_data['shipping_set'] = '';
+			$db_data['shipping_key'] = '';
+			$db_data['shipping_bruttonetto'] = '';
+			$db_data['shipping_tax_key'] = '';
+			$db_data['type_shipping'] = '';
+			$db_data['price_shipping'] = '';
+			$db_data['price_shipping_netto'] = '';
+			$db_data['price_shipping_brutto'] = '';
+			$db_data['mwst_shipping'] = '';
+	
+			// Payment leeren
+			$db_data['payment_set'] = '';
+			$db_data['payment_key'] = '';
+			$db_data['payment_bruttonetto'] = '';
+			$db_data['payment_tax_key'] = '';
+			$db_data['type_payment'] = '';
+			$db_data['price_payment'] = '';
+			$db_data['price_payment_netto'] = '';
+			$db_data['price_payment_brutto'] = '';
+			$db_data['mwst_payment'] = '';
+		
+			// Gutschein leeren
+			$db_data['voucher_tax_key'] = '';
+			$db_data['price_gs'] = '';
+			$db_data['price_gs_netto'] = '';
+			$db_data['price_gs_brutto'] = '';
+			$db_data['gs_set'] = '';
+			$db_data['gs_tax_key'] = '';
+			$db_data['voucher_bruttonetto'] = '';
+			$db_data['gs_id'] = '';
+			$db_data['gs_code'] = '';
+			
+			// Rabatt leeren
+			$db_data['discount_set'] = '';
+			$db_data['discount_bruttonetto'] = '';
+			$db_data['discount_tax_key'] = '';
+			$db_data['price_rabatt'] = '';
+			$db_data['price_rabatt_netto'] = '';
+			$db_data['price_rabatt_brutto'] = '';
+			
+            foreach ($this->arCalculationRow as $cr) {
+            	
+            	if ($cr['type'] === 'discount') {
+		
+					$db_data['discount_set'] = wpsg_q($cr['set']);
+					$db_data['discount_bruttonetto'] = wpsg_q($cr['bruttonetto']);
+					$db_data['discount_tax_key'] = wpsg_q($cr['tax_key']);
+					$db_data['price_rabatt'] = wpsg_q($arCalculation['sum']['discount'.$display]);
+					$db_data['price_rabatt_netto'] = wpsg_q($arCalculation['sum']['discount_netto']);
+					$db_data['price_rabatt_brutto'] = wpsg_q($arCalculation['sum']['discount_brutto']);
+					            		
+				} else if ($cr['type'] === 'voucher') {
+            	 
+            		$db_data['voucher_tax_key'] = wpsg_q($cr['tax_key']);
+					$db_data['price_gs'] = wpsg_q($arCalculation['sum']['voucher_'.$display]);
+					$db_data['price_gs_netto'] = wpsg_q($arCalculation['sum']['voucher_netto']);
+					$db_data['price_gs_brutto'] = wpsg_q($arCalculation['sum']['voucher_brutto']);
+					$db_data['gs_set'] = wpsg_q($cr['set']);
+					$db_data['gs_tax_key'] = wpsg_q($cr['tax_key']);
+					$db_data['voucher_bruttonetto'] = wpsg_q($cr['bruttonetto']);
+					$db_data['gs_id'] = wpsg_q($cr['data']['id']);
+					$db_data['gs_code'] = wpsg_q($cr['data']['code']);
+            		 
+				} else if ($cr['type'] === 'shipping') {
+            		
+            		$db_data['shipping_set'] = wpsg_q($cr['set']);
+					$db_data['shipping_key'] = wpsg_q($cr['data']['shipping_key']);
+					$db_data['shipping_bruttonetto'] = wpsg_q($cr['bruttonetto']);
+					$db_data['shipping_tax_key'] = wpsg_q($cr['tax_key']);
+					$db_data['type_shipping'] = wpsg_q($cr['data']['shipping_key']);
+					$db_data['price_shipping'] = wpsg_q($arCalculation['sum']['shipping_'.$display]);
+					$db_data['price_shipping_netto'] = wpsg_q($arCalculation['sum']['shipping_netto']);
+					$db_data['price_shipping_brutto'] = wpsg_q($arCalculation['sum']['shipping_brutto']);
+					$db_data['mwst_shipping'] = wpsg_q($arCalculation['sum']['shipping_brutto'] - $arCalculation['sum']['shipping_netto']);
+            		
+				} else if ($cr['type'] === 'payment') {
+		
+					$db_data['payment_set'] = wpsg_q($cr['set']);
+					$db_data['payment_key'] = wpsg_q($cr['data']['payment_key']);
+					$db_data['payment_bruttonetto'] = wpsg_q($cr['bruttonetto']);
+					$db_data['payment_tax_key'] = wpsg_q($cr['tax_key']);
+					$db_data['type_payment'] = wpsg_q($cr['data']['payment_key']);
+					$db_data['price_payment'] = wpsg_q($arCalculation['sum']['payment_'.$display]);
+					$db_data['price_payment_netto'] = wpsg_q($arCalculation['sum']['payment_netto']);
+					$db_data['price_payment_brutto'] = wpsg_q($arCalculation['sum']['payment_brutto']);
+					$db_data['mwst_payment'] = wpsg_q($arCalculation['sum']['payment_brutto'] - $arCalculation['sum']['payment_netto']);
+		 					
+				}
+				             	
+			}
+            
+			$db_data['be_bruttonetto'] = wpsg_q($this->shop->getBackendTaxview());
+            $db_data['fe_bruttonetto'] = wpsg_q($this->shop->getFrontendTaxview());
+	
+            $oDefaultCountry = $this->shop->getDefaultCountry();
+            
+			$db_data['shop_country_id'] = wpsg_q($oDefaultCountry->id);
+			$db_data['shop_country_tax'] = wpsg_q($oDefaultCountry->mwst);
+			$db_data['shop_country_tax_a'] = wpsg_q($oDefaultCountry->mwst_a);
+			$db_data['shop_country_tax_b'] = wpsg_q($oDefaultCountry->mwst_b);
+			$db_data['shop_country_tax_c'] = wpsg_q($oDefaultCountry->mwst_c);
+			$db_data['shop_country_tax_d'] = wpsg_q($oDefaultCountry->mwst_d);
+            
             if (wpsg_isSizedInt($id)) {
                 
@@ -331,4 +441,5 @@
             }
             
+            /*
             if (wpsg_isSizedArray($this->arVoucher)) {
 				
@@ -346,35 +457,38 @@
 				
 			}
+            */
 
             $arOrderProductID = [];
             
             // Produkte speichern
-            foreach ($arCalculation['products'] as $p) {
-                
-                $db_data = [
-                    'o_id' => wpsg_q($id),
-                    'p_id' => wpsg_q($p['product_id']),
-                    'productkey' => wpsg_q($p['product_key']),
-                    'product_index' => wpsg_q($p['product_index']),
-                    'menge' => wpsg_q($p['amount']),
-                    'price_netto' => wpsg_q($p['netto']),
-                    'price_brutto' => wpsg_q($p['brutto']),
-					'price' => wpsg_q($p['price']),
-					'mwst_value' => wpsg_q($p['brutto'] - $p['netto']),
-                    'mwst_key' => wpsg_q($p['tax_key'])
-                ];
-                
-                if (wpsg_isSizedInt($p['order_product_id'])) {
-                    
-                    $arOrderProductID[] = $p['order_product_id'];
-                    
-                    $this->db->UpdateQuery(WPSG_TBL_ORDERPRODUCT, $db_data, " `id` = '".wpsg_q($p['order_product_id'])."' ");
-                    
-                } else {
-
-                    $arOrderProductID[] = $this->db->ImportQuery(WPSG_TBL_ORDERPRODUCT, $db_data);
-                    
-                }
-                
+			foreach ($arCalculation['product'] as $p) {
+                 
+				$db_data = [
+					'o_id' => wpsg_q($id),
+					'p_id' => wpsg_q($p['product_id']),
+					'productkey' => wpsg_q($p['product_key']),
+					'product_index' => wpsg_q($p['product_index']),
+					'menge' => wpsg_q($p['amount']),
+					'price_netto' => wpsg_q($p['netto_single']),
+					'price_brutto' => wpsg_q($p['brutto_single']),
+					'price' => wpsg_q($p[$display]),
+					'mwst_value' => wpsg_q($p['netto_single'] - $p['netto_single']),
+					'mwst_key' => wpsg_q($p['tax_key']),
+					'product_set' => wpsg_q($p['set']),
+					'product_bruttonetto' => wpsg_q($p['bruttonetto'])
+				];
+				
+				if (wpsg_isSizedInt($p['order_product_id'])) {
+					
+					$arOrderProductID[] = $p['order_product_id'];
+					
+					$this->db->UpdateQuery(WPSG_TBL_ORDERPRODUCT, $db_data, " `id` = '".wpsg_q($p['order_product_id'])."' ");
+					
+				} else {
+
+					$arOrderProductID[] = $this->db->ImportQuery(WPSG_TBL_ORDERPRODUCT, $db_data);
+					
+				}
+				
             }
             
@@ -384,4 +498,6 @@
                 
             }
+	
+			$this->arCalculation = null;
                 
             return $id;
@@ -394,74 +510,43 @@
             $db_products = $this->db->fetchAssoc("SELECT * FROM `".WPSG_TBL_ORDERPRODUCT."` WHERE `o_id` = '".wpsg_q($id)."' ");
             
-            $this->setCountry(\wpsg_country::getInstance($db_order['land']));
-            $this->setShipping($db_order['type_shipping'], $db_order['price_shipping_netto'],$db_order['shipping_tax_key']);
-            $this->setPayment($db_order['type_payment'], $db_order['price_payment_netto'], $db_order['payment_tax_key']);
+            $this->addCountry($db_order['shop_country_id'], $db_order['shop_country_tax'], $db_order['shop_country_tax_a'],$db_order['shop_country_tax_b'], $db_order['shop_country_tax_c'], $db_order['shop_country_tax_d'], true);
+			$this->addCountry($db_order['target_country_id'], $db_order['target_country_tax'], $db_order['target_country_tax_a'],$db_order['target_country_tax_b'], $db_order['target_country_tax_c'], $db_order['target_country_tax_d'], false);
+            
+            $this->addShipping($db_order['shipping_set'],$db_order['shipping_bruttonetto'],$db_order['shipping_tax_key'],$db_order['shipping_key']);
+            $this->addPayment($db_order['payment_set'], $db_order['payment_bruttonetto'], $db_order['payment_tax_key'],$db_order['payment_key']);
             
             foreach ($db_products as $db_p) {
                
-                $this->addProduct($db_p['productkey'], $db_p['product_index'], $db_p['price_netto'], $db_p['menge'],$db_p['mwst_key'], $db_p['id']);
+                $this->addProduct($db_p['product_set'], $db_p['product_bruttonetto'], $db_p['mwst_key'], $db_p['menge'],$db_p['productkey'], $db_p['product_index']);
                 
             }
             
             // Rabatte
-            if (wpsg_tf($db_order['price_rabatt_netto']) > 0) {
-                
-                $this->addDiscount($db_order['price_rabatt_netto'], $db_order['discount_set']);
+            if (wpsg_isSizedString($db_order['discount_set'])) {
+                
+                $this->addDiscount($db_order['discount_set'], $db_order['discount_bruttonetto'], $db_order['discount_tax_key']);
                 
             }
             
             // Gutschein
-			if (wpsg_tf($db_order['price_gs_netto']) > 0) {
-            	
-            	$this->addVoucher($db_order['price_gs_netto'], $db_order['gs_set'], $db_order['gs_code'], $db_order['gs_id']);
+			if (wpsg_isSizedString($db_order['gs_set'])) {
+            	
+            	$this->addVoucher($db_order['gs_set'], $db_order['voucher_bruttonetto'], $db_order['gs_tax_key'], 1, $db_order['gs_code'],$db_order['gs_id']);
             	
 			}            
             
+			if (wpsg_isSizedInt($db_order['shop_country_id'])) {
+            	
+            	$this->addCountry($db_order['shop_country_id'], $db_order['shop_country_tax'], $db_order['shop_country_tax_a'], $db_order['shop_country_tax_b'], $db_order['shop_country_tax_c'], $db_order['shop_country_tax_d']);
+            	
+			} else {
+            	
+            	$oDefaultCountry = $this->shop->getDefaultCountry();
+            	
+            	$this->addCountry($oDefaultCountry->id, $oDefaultCountry->mwst, $oDefaultCountry->mwst_a, $oDefaultCountry->mwst_b, $oDefaultCountry->mwst_c, $oDefaultCountry->mwst_d);
+            	
+			}
+			
         } // public function fromDB($id)
-
-        /**
-         * Gibt einen Array zurÃŒck, in dem die beteiligten SteuersÃ€tze mit LÃ€nderkÃŒrzel definiert sind
-         */
-        public function getTaxLabelArray($short = false) {
-
-            $arTaxLabel = [];
-            $arTaxGgroup = wpsg_tax_groups(false, true);            
-            $arCalculation = $this->getCalculationArray();
-            
-            foreach ($arCalculation['tax'] as $tax) {
-                                    
-                if (preg_match('/_\d+/', $tax['key'])) {
-                    
-                    $arTaxKey = explode('_', $tax['key']);
-                    $tax_key = $arTaxKey[0];
-                    
-                    $oCountry = \wpsg_country::getInstance($arTaxKey[1]);
-                    
-                } else {
-                    
-                    $tax_key = $tax['key'];
-                    $oCountry = $this->shop->getDefaultCountry();
-                                        
-                }
-
-                $tax_value = $oCountry->getTax($tax_key);
-
-                if ($short === true) {
-
-                    if ($tax_key !== '0') $arTaxLabel[$tax['key']] = wpsg_ff(wpsg_tf($tax_value), '%');
-                    else $arTaxLabel[$tax['key']] = 'anteilig';
-
-                } else {
-                
-                    if ($tax_key !== '0') $arTaxLabel[$tax['key']] = $arTaxGgroup[$tax_key].' ('.wpsg_ff(wpsg_tf($tax_value), '%').' / '.$oCountry->kuerzel.')';
-                    else $arTaxLabel[$tax['key']] = $arTaxGgroup[$tax_key];
-                    
-                }
-                                    
-            }
-            
-            return $arTaxLabel;
-                
-        } 
         
         public function getMaxProductIndex() {
@@ -469,290 +554,107 @@
             $max_index = 0;
             
-            foreach ($this->arProducts as $p) {
-                
-                $max_index = max($max_index, $p['product_index']);
-                
-            }
-            
-            return max($max_index, sizeof($this->arProducts) - 1);
+            foreach ($this->arCalculationRow as $cr) {
+                
+            	if ($cr['type'] === 'product') $max_index = max($max_index, $cr['data']['product_index']);
+                
+            }
+            
+            return $max_index;
             
         }
         
         /* Private */
-
-        private function setTaxView($taxView) {
-
-            $this->getCalculationArray();
-
-            if ($taxView === WPSG_BRUTTO) {
-
-                $suffix = 'brutto';
-
-            } else {
-
-                $suffix = 'netto';
-
-            }
-
-            $this->arCalculation['sum']['product'] = $this->arCalculation['sum']['product_'.$suffix];
-            $this->arCalculation['sum']['display'] = $this->arCalculation['sum'][$suffix];
-            $this->arCalculation['sum']['shipping'] = $this->arCalculation['shipping'][$suffix];
-            $this->arCalculation['sum']['payment'] = $this->arCalculation['payment'][$suffix];
-
-            $this->arCalculation['shipping']['price'] = $this->arCalculation['shipping'][$suffix];
-            $this->arCalculation['payment']['price'] = $this->arCalculation['payment'][$suffix];
-            $this->arCalculation['sum']['discount_display'] = $this->arCalculation['sum']['discount_'.$suffix];
-            $this->arCalculation['sum']['prediscount_display'] = $this->arCalculation['sum']['prediscount_'.$suffix];
-	
-			$this->arCalculation['sum']['voucher_display'] = $this->arCalculation['sum']['voucher_'.$suffix];
-			$this->arCalculation['sum']['prevoucher_display'] = $this->arCalculation['sum']['prevoucher_'.$suffix];
-            
-            foreach ($this->arCalculation['products'] as $k => $p) {
-
-                $this->arCalculation['products'][$k]['price'] = $this->arCalculation['products'][$k][$suffix];
-                $this->arCalculation['products'][$k]['sum_display'] = $this->arCalculation['products'][$k]['sum_'.$suffix];
-
-            }
-
-        }
-	
+		
 		/**
-		 * Bezieht die Gutscheine in die Berechnung ein
+		 * Ermittelt die Verteilung der SteuersÃ€tze
 		 */
-        private function calculateVoucher() {
-        	
-        	$this->arCalculation['sum']['prevoucher_netto'] = $this->arCalculation['sum']['netto'];
-        	$this->arCalculation['sum']['voucher_netto'] = 0;
-        	
-        	if (wpsg_isSizedArray($this->arVoucher)) {
-        		
-        		$this->arCalculation['voucher'] = $this->arVoucher;
-        		
-        		foreach ($this->arVoucher as $k => $v) {
-			
-        			$this->addTax(0,$v['tax_key']);
-        			
-					if (strpos($v['value'], '%') !== false) {
-				
-						// Prozentualer Wert
-						$voucher_netto = $this->arCalculation['sum']['netto'] / 100 * wpsg_tf($v['value']);
-				
-					} else {
-				
-						// Absoluter Netto Wert
-						$voucher_netto = wpsg_tf($v['value']);
-				
+		private function calculateTaxProportionally($bruttonetto) {
+			
+			if ($bruttonetto === WPSG_NETTO) $bruttonetto = 'netto';
+			else $bruttonetto = 'brutto';
+	 
+			$sum = $this->arCalculation['sum'][$bruttonetto]; 
+			
+			// Den Anteiligen Netto Betrag beachte ich nicht bei der Anteilermittlung
+			//$sum -= $this->arCalculation['tax'][0][$bruttonetto]; 
+			
+			foreach ($this->arCalculation['tax'] as $tax_key => $tax) {
+				
+				if ($tax_key == '0') {
+					
+					$this->arCalculation['tax'][$tax_key]['part'] = 0;
+					
+				}
+				else {
+					
+					$this->arCalculation['tax'][$tax_key]['part'] = $tax[$bruttonetto] / $sum;
+					
+				}
+				
+			}
+			
+		}
+		
+		/**
+		 * Berechnet den Netto Wert zu einem Bruttowert
+		 * 
+		 * @param $brutto
+		 * @param $tax_key
+		 */
+        private function calculateTaxPart($bruttonetto, $val, $tax_key) {
+	        	
+        	if ($tax_key == '0') {
+		
+				$ret_netto = 0;
+				$ret_brutto = 0;
+				
+				foreach ($this->arCalculation['tax'] as $tax_key2 => $tax) {
+			
+					if ($tax_key2 != '0') {
+				 
+						if ($bruttonetto === WPSG_NETTO) {
+							
+							$netto = $val * $tax['part'];
+							$brutto =  $netto * (1 + $this->arCalculation['tax'][$tax_key2]['tax_value'] / 100);
+														
+						} else {
+							
+							$brutto = $val * $tax['part'];
+							$netto = $brutto / (1 + $this->arCalculation['tax'][$tax_key2]['tax_value'] / 100);
+							
+						}
+						 
+						$ret_netto += $netto;
+						$ret_brutto += $brutto;
+						
+						if ($tax_key !== $tax_key2) {
+						
+							$this->arCalculation['tax'][$tax_key2]['netto'] += $netto;
+							$this->arCalculation['tax'][$tax_key2]['brutto'] += $brutto;
+							
+						}
+												
 					}
 			
-					$this->arCalculation['voucher'][$k]['netto'] = $voucher_netto;
-					$this->arCalculation['tax'][$v['tax_key']]['netto'] -= $voucher_netto;
-			
-					$this->arCalculation['sum']['voucher_netto'] += $voucher_netto;
-					$this->arCalculation['sum']['netto'] -= $voucher_netto; 
-					$this->arCalculation['sum']['product_netto'] -= $voucher_netto;
-					
-				}
-        		
-			}
-        	
-		}
-        
-        /**
-         * Bezieht die Rabatte in die Berechnung ein
-         */
-        private function calculateDiscount() {
-
-            $this->arCalculation['sum']['prediscount_netto'] = $this->arCalculation['sum']['netto'];
-            $this->arCalculation['sum']['discount_netto'] = 0;
-            
-            if (wpsg_isSizedArray($this->arDiscount)) {
-
-                $this->arCalculation['discount'] = $this->arDiscount;
-                                                
-                foreach ($this->arDiscount as $k => $d) {
-	
-					$this->addTax(0,$d['tax_key']);
-                	
-                    if (strpos($d['value'], '%') !== false) {
-                        
-                        // Prozentualer Wert
-                        $discount_netto = $this->arCalculation['sum']['netto'] / 100 * wpsg_tf($d['value']);
-                        
-                    } else {
-                        
-                        // Absoluter Netto Wert
-                        $discount_netto = wpsg_tf($d['value']);
-                        
-                    }
-                    
-                    $this->arCalculation['discount'][$k]['netto'] = $discount_netto;                    
-                    $this->arCalculation['tax'][$d['tax_key']]['netto'] -= $discount_netto;
-                    
-                    $this->arCalculation['sum']['discount_netto'] += $discount_netto;
-                    $this->arCalculation['sum']['netto'] -= $discount_netto;
-                    
-                }
-                                
-            }
-            
-        } // private function calculateDiscount()
-        
-        /** 
-         * Berechnet den Steueranteil 
-         */
-        private function calculateTax() {
-            
-            if ($this->arCalculation === null) throw new \Exception(__('Warenkorb nicht gefÃŒllt.', 'wpsg'));
-            
-            // Den Anteiligen Satz ermitteln
-            if (array_key_exists('0', $this->arCalculation['tax'])) {
-                
-                $sum_netto = $this->arCalculation['sum']['netto'];
-                
-                // Den Anteiligen Netto Betrag beachte ich nicht bei der Anteilermittlung
-                $sum_netto -= $this->arCalculation['tax'][0]['netto'];
-                
-                foreach ($this->arCalculation['tax'] as $tax_key => $tax) {
-                    
-                    if ($tax_key == '0') $this->arCalculation['tax'][$tax_key]['part'] = 0;
-                    else $this->arCalculation['tax'][$tax_key]['part'] = $tax['netto'] / $sum_netto;
-                    
-                }
-                                
-            }
-                 
-            // Produkte
-            foreach ($this->arCalculation['products'] as $k => $p) {
-
-                $this->arCalculation['products'][$k]['brutto'] = $this->calculateTaxPart($p['netto'], $p['tax_key']);
-                
-                if ($this->arCalculation['products'][$k]['brutto'] > 0) $this->arCalculation['products'][$k]['sum_tax'] = $this->arCalculation['products'][$k]['brutto'] - $this->arCalculation['products'][$k]['netto'];
-                else $this->arCalculation['products'][$k]['sum_tax'] = 0;
-
-                $this->arCalculation['tax'][$p['tax_key']]['sum_tax'] += $this->arCalculation['products'][$k]['sum_tax'] * $this->arCalculation['products'][$k]['amount'];                 
-                $this->arCalculation['sum']['tax'] += $this->arCalculation['products'][$k]['sum_tax'] * $this->arCalculation['products'][$k]['amount'];
-                
-                $this->arCalculation['sum']['brutto'] += $this->arCalculation['products'][$k]['brutto'] * $this->arCalculation['products'][$k]['amount'];
-                $this->arCalculation['sum']['prediscount_brutto'] += $this->arCalculation['products'][$k]['brutto'] * $this->arCalculation['products'][$k]['amount'];
-				$this->arCalculation['sum']['prevoucher_brutto'] += $this->arCalculation['products'][$k]['brutto'] * $this->arCalculation['products'][$k]['amount'];
-                $this->arCalculation['sum']['product_brutto'] += $this->arCalculation['products'][$k]['brutto'] * $this->arCalculation['products'][$k]['amount'];
-                
-            }
-	
-			// Gutscheine
-			if (wpsg_isSizedArray($this->arCalculation['voucher'])) {
-		
-				foreach ($this->arCalculation['voucher'] as $k => $v) {
-			
-					$this->arCalculation['voucher'][$k]['brutto'] = $this->calculateTaxPart($v['netto'], $v['tax_key']);
-					
-					if ($this->arCalculation['voucher'][$k]['brutto'] > 0) $this->arCalculation['voucher'][$k]['sum_tax'] = $this->arCalculation['voucher'][$k]['brutto'] - $this->arCalculation['voucher'][$k]['netto'];
-					else $this->arCalculation['voucher'][$k]['sum_tax'] = 0;
-			
-					$this->arCalculation['tax'][$v['tax_key']]['sum_tax'] -= $this->arCalculation['voucher'][$k]['sum_tax'];
-			
-					$this->arCalculation['sum']['tax'] -= $this->arCalculation['voucher'][$k]['sum_tax'];
-					$this->arCalculation['sum']['brutto'] -= $this->arCalculation['voucher'][$k]['brutto'];
-					$this->arCalculation['sum']['voucher_brutto'] += $this->arCalculation['voucher'][$k]['brutto'];
-					$this->arCalculation['sum']['product_brutto'] -= $this->arCalculation['voucher'][$k]['brutto'];
-					$this->arCalculation['sum']['prediscount_brutto'] -= $this->arCalculation['voucher'][$k]['brutto'];
-					
-				}
-		
-			}
-
-            // Versand
-            $this->arCalculation['shipping']['brutto'] = $this->calculateTaxPart($this->arCalculation['shipping']['netto'], $this->arCalculation['shipping']['tax_key']);
-            $this->arCalculation['sum']['brutto'] += $this->arCalculation['shipping']['brutto'];
-            $this->arCalculation['sum']['prediscount_brutto'] += $this->arCalculation['shipping']['brutto'];
-
-            if ($this->arCalculation['shipping']['brutto'] > 0) $this->arCalculation['shipping']['sum_tax'] = $this->arCalculation['shipping']['brutto'] - $this->arCalculation['shipping']['netto'];
-            else $this->arCalculation['shipping']['sum_tax'] = 0;
-
-            $this->arCalculation['tax'][$this->shipping['tax_key']]['brutto'] += $this->arCalculation['shipping']['brutto'];
-            $this->arCalculation['tax'][$this->shipping['tax_key']]['sum_tax'] += $this->arCalculation['shipping']['sum_tax'];
-            
-            // Zahlung
-            $this->arCalculation['payment']['brutto'] = $this->calculateTaxPart($this->arCalculation['payment']['netto'], $this->arCalculation['payment']['tax_key']);
-            $this->arCalculation['sum']['brutto'] += $this->arCalculation['payment']['brutto'];
-            $this->arCalculation['sum']['prediscount_brutto'] += $this->arCalculation['payment']['brutto'];
-
-            if ($this->arCalculation['payment']['brutto'] > 0) $this->arCalculation['payment']['sum_tax'] = $this->arCalculation['payment']['brutto'] - $this->arCalculation['payment']['netto'];
-            else $this->arCalculation['payment']['sum_tax'] = 0;
-
-            $this->arCalculation['tax'][$this->payment['tax_key']]['brutto'] += $this->arCalculation['payment']['brutto'];
-            $this->arCalculation['tax'][$this->payment['tax_key']]['sum_tax'] += $this->arCalculation['payment']['sum_tax'];
-            
-            // Rabatte
-			if (wpsg_isSizedArray($this->arCalculation['discount'])) {
-            
-				foreach ($this->arCalculation['discount'] as $k => $d) {
-                
-					$this->arCalculation['discount'][$k]['brutto'] = $this->calculateTaxPart($d['netto'], $d['tax_key']);
-	
-					if ($this->arCalculation['discount'][$k]['brutto'] > 0) $this->arCalculation['discount'][$k]['sum_tax'] = $this->arCalculation['discount'][$k]['brutto'] - $this->arCalculation['discount'][$k]['netto'];
-					else $this->arCalculation['discount'][$k]['sum_tax'] = 0;
-	
-					$this->arCalculation['tax'][$d['tax_key']]['sum_tax'] -= $this->arCalculation['discount'][$k]['sum_tax'];
-	
-					$this->arCalculation['sum']['tax'] -= $this->arCalculation['discount'][$k]['sum_tax'];
-					$this->arCalculation['sum']['brutto'] -= $this->arCalculation['discount'][$k]['brutto'];                
-					$this->arCalculation['sum']['discount_brutto'] += $this->arCalculation['discount'][$k]['brutto'];
-					
-				}
-				
-			}
-            
-            // Gesamt
-            if ($this->arCalculation['sum']['brutto'] > 0) $this->arCalculation['sum']['tax'] = $this->arCalculation['sum']['brutto'] - $this->arCalculation['sum']['netto'];
-            else $this->arCalculation['sum']['tax'] = 0;
-            
-            // Anteilig noch auf die SteuersÃ€tze verteilen
-            if (isset($this->arCalculation['tax'][0]['sum_tax'])) {
-                
-                $part_sum_tax = $this->arCalculation['tax'][0]['sum_tax'];
-                $part_netto = $this->arCalculation['tax'][0]['netto'];
-                $part_brutto = $this->arCalculation['tax'][0]['brutto'];
-                
-                foreach ($this->arCalculation['tax'] as $tax_key => $tax_data) {
-                    
-                    $this->arCalculation['tax'][$tax_key]['sum_tax'] += $part_sum_tax * $tax_data['part'];
-                    $this->arCalculation['tax'][$tax_key]['netto'] += $part_netto * $tax_data['part'];
-                    $this->arCalculation['tax'][$tax_key]['brutto'] += $part_brutto * $tax_data['part'];
-                    
-                }
-                
-            }
-            
-        }
-
-        /**
-         * Berechnet den Brutto Wert zu einem Nettowert
-         */
-        private function calculateTaxPart($netto, $tax_key) {
-            
-            if ($tax_key == '0') {
-                
-                $brutto = 0;
-                
-                foreach ($this->arCalculation['tax'] as $tax_key => $tax) {
-                    
-                    if ($tax_key != '0') {
-                        
-                        $brutto += $netto * $tax['part'] * (1 + $tax['tax_value'] / 100);
-                        
-                    }
-                    
-                }
-                
-                return $brutto;
-                
-            } else {
-
-                return $netto * (1 + $this->arCalculation['tax'][$tax_key]['tax_value'] / 100);
-                
-            }
-            
-        }
+				}
+									
+				return [$ret_netto, $ret_brutto];
+		
+			} else {
+				
+				if ($bruttonetto === WPSG_NETTO) {
+					
+					return [$val, $val * (1 + $this->arCalculation['tax'][$tax_key]['tax_value'] / 100)];
+					
+				}
+				else {
+					
+					return [$val / (1 + $this->arCalculation['tax'][$tax_key]['tax_value'] / 100), $val];
+					
+				}
+		
+			}
+			
+		} 
 
         /**
@@ -763,11 +665,103 @@
             if ($tax_key == '') $tax_key = '0';
             
-            if ($tax_key != '0' && !preg_match('/\_\d+$/', $tax_key)) return $tax_key.'_'.$this->oCountry->id;
-            else return $tax_key;
-            
-        }
-        
-        private function addTax($price_netto, $tax_key) {
-            
+            if ($tax_key != '0' && !preg_match('/\_\d+$/', $tax_key)) {
+            	
+            	foreach ($this->arCountry as $country_id => $c) {
+            		
+            		if ($c['default'] === true) return $tax_key.'_'.$country_id;
+            		
+				}
+            	
+            	throw new \Exception(__('Kein Standardland fÃŒr Berechnung gesetzt.', 'wspg'));
+				
+			} else return $tax_key;
+            
+        }
+	
+		/**
+		 * Gibt einen Array zurÃŒck, in dem die beteiligten SteuersÃ€tze mit LÃ€nderkÃŒrzel definiert sind
+		 */
+		public function getTaxLabelArray($short = false) {
+		
+			$arTaxLabel = [];
+			$arTaxGgroup = wpsg_tax_groups(false, true);
+			$arCalculation = $this->getCalculationArray();
+			
+			$country_default_id = false;
+			
+			foreach ($this->arCountry as $country_id => $country) {
+				
+				if ($country['default'] === true) $country_default_id = $country_id;
+				
+			}
+			
+			if (!wpsg_isSizedInt($country_default_id)) throw new \Exception(__('Standardland konnte in Berechnung nicht ermittelt werden.'));
+			
+			foreach ($arCalculation['tax'] as $tax) {
+			
+				if (preg_match('/_\d+/', $tax['key'])) {
+				
+					$arTaxKey = explode('_', $tax['key']);
+					$tax_key = $arTaxKey[0];
+				
+					$country_id = $arTaxKey[1];
+									
+				} else {
+				
+					$tax_key = $tax['key'];
+					
+					$country_id = $country_default_id;
+				
+				}
+								
+				$oCountry = \wpsg_country::getInstance($country_id);
+			
+				$tax_value = $this->arCountry[$country_id][$tax['key']];
+				
+				if ($oCountry->isLoaded()) {
+									
+					$kuerzel = $oCountry->kuerzel;
+										
+				} else {
+					
+					$kuerzel = '';
+					
+				}
+				
+				if ($short === true) {
+					
+					if ($tax_key !== '0') $arTaxLabel[$tax['key']] = wpsg_ff(wpsg_tf($tax_value), '%');
+					else $arTaxLabel[$tax['key']] = 'anteilig';
+					
+				} else {
+					
+					if ($tax_key !== '0') $arTaxLabel[$tax['key']] = $arTaxGgroup[$tax_key].' ('.wpsg_ff(wpsg_tf($tax_value), '%').' / '.$kuerzel.')';
+					else $arTaxLabel[$tax['key']] = $arTaxGgroup[$tax_key];
+					
+				}
+				
+			}
+		
+			return $arTaxLabel;
+		
+		}
+	
+		private function addTax($tax_key) {
+	
+			if (!isset($this->arCalculation['tax'][$tax_key])) {
+				
+				$arTaxKey = explode('_', $tax_key);
+				
+				$country = \wpsg_country::getInstance($arTaxKey[1]);
+				$tax_value = $country->getTax($arTaxKey[0]);
+				
+				$this->arCalculation['tax'][$tax_key] = [
+					'key' => $tax_key,
+					'tax_value' => $tax_value
+				];
+				
+			}
+        	
+        	/*
             if (!isset($this->arCalculation['tax'][$tax_key])) {
                    
@@ -790,4 +784,5 @@
                 
             }
+        	*/
             
         }
Index: /mods/wpsg_mod_downloadplus.class.php
===================================================================
--- /mods/wpsg_mod_downloadplus.class.php	(revision 7196)
+++ /mods/wpsg_mod_downloadplus.class.php	(revision 7197)
@@ -754,7 +754,10 @@
 				{
 				
-					if (is_numeric($k)) $arProduct['preis'] += $v['preis'];
-				
-					if ($v['value'] !== 'Nein') $varName_checkbox .= ' '.$v['name'];
+					if (is_numeric($k)) {
+						
+						$arProduct['preis'] += $v['preis'];
+						if ($v['value'] !== 'Nein') $varName_checkbox .= ' '.$v['name'];
+						
+					}
 				
 				}
Index: /mods/wpsg_mod_relatedproducts.class.php
===================================================================
--- /mods/wpsg_mod_relatedproducts.class.php	(revision 7196)
+++ /mods/wpsg_mod_relatedproducts.class.php	(revision 7197)
@@ -184,4 +184,6 @@
 				$html .= $this->shop->render(WPSG_PATH_VIEW.'/mods/mod_relatedproducts/relatedproducts.phtml', false);
 				
+				$this->shop->noReleatedProducts = false;
+				
 			}
 			
Index: /mods/wpsg_mod_su.class.php
===================================================================
--- /mods/wpsg_mod_su.class.php	(revision 7196)
+++ /mods/wpsg_mod_su.class.php	(revision 7197)
@@ -144,5 +144,5 @@
 				'hint' => __($this->shop->get_option('wpsg_mod_su_hint')),
 				'preis' => $this->shop->get_option('wpsg_mod_su_gebuehr'),
-				'mwst' => $this->shop->get_option('wpsg_mod_su_mwst'),
+				'mwst_key' => $this->shop->get_option('wpsg_mod_su_mwst'),
 				'mwst_value' => $mwst_value,
 				'mwst_null' => $this->shop->get_option('wpsg_mod_su_mwstland'),
Index: /system/tests/wpsg_calculationTestTest.php
===================================================================
--- /system/tests/wpsg_calculationTestTest.php	(revision 7196)
+++ /system/tests/wpsg_calculationTestTest.php	(revision 7197)
@@ -10,158 +10,103 @@
     
     class wpsg_calculationTestTest extends TestCase {
+	    	
+		public function test1() {
+			
+			//$this->markTestSkipped(); return;
+			
+			$b = new \wpsg\wpsg_calculation();
+			
+			$b->addCountry(1, 0, 0, 7, 19, 0);
+			
+			$b->addShipping('119', WPSG_BRUTTO, 'c','sss');
+			$b->addProduct('119', WPSG_BRUTTO, 'c', 10,'1');
+			$b->addPayment('119', WPSG_BRUTTO, 'c', 'ppp');
+			
+			$ar = $b->getCalculationArray();
+			 
+			$this->assertTrue($this->compareArray($ar, [
+				'sum' => [
+					'product_netto' => 1000,
+					'product_brutto' => 1190,
+					'netto' => 1200,
+					'brutto' => 1428,
+				]
+			]));
+			
+		}
 	
-    	public function test2() {
-		
+		public function test2() {
+			
+			//$this->markTestSkipped(); return;
+			
 			$b = new \wpsg\wpsg_calculation();
-		
-			$b->setCountry(\wpsg_country::getInstance(1));
-		
-			$b->addProduct('1', 0, 1260.5, '1','c');
-			$b->setShipping('1', '0', '0');
-			$b->setPayment('1', '0', '0');
-		
+			
+			$b->addCountry(1, 0, 0, 7, 19, 0);
+			
+			$b->addProduct('6', WPSG_BRUTTO, 'c', 1,'1');
+			$b->addProduct('100', WPSG_BRUTTO, 'b', 1,'2');
+			$b->addProduct('30', WPSG_BRUTTO, 'c', 1,'3');
+			
 			$ar = $b->getCalculationArray();
 		
 			$this->assertTrue($this->compareArray($ar, [
 				'sum' => [
-					'product_netto' => 1260.5,
-					'tax' => 239.49,
-					'brutto' => 1499.99,
+					'product_netto' => 123.71004476557,
+					'product_brutto' => 136,
+					'netto' => 123.71004476557,
+					'brutto' => 136,
+				],
+				'tax' => [
+					'c_1' => [
+						'sum' => 5.7478991596639
+					] 
+					
+				]
+			]));
+		
+		}
+	
+		public function test3() {
+			
+			$b = new \wpsg\wpsg_calculation();
+			
+			$b->addCountry(1, 0, 0, 7, 19, 0);
+			
+			$b->addProduct('6', WPSG_BRUTTO, 'c', 1,'1');
+			$b->addProduct('100', WPSG_BRUTTO, 'b', 1,'2');
+			$b->addProduct('30', WPSG_BRUTTO, 'c', 1,'3');
+			$b->addVoucher('10',WPSG_BRUTTO,'0',1);
+			
+			$ar = $b->getCalculationArray();
+			 
+			$this->assertTrue($this->compareArray($ar, [
+				'sum' => [
+					'product_netto' => 123.71004476557,
+					'product_brutto' => 136, 
+					'netto' => 114.613717944572,
+					'brutto' => 126,
+				],
+				'tax' => [
+					'c_1' => [
+						'sum' => 5.325259516					
+					],
+					'b_1' => [
+						'sum' => 6.06102254					
+					]
 				]
 			]));
 			
 		}
-    	
-		public function test1() {
-			
-			$b = new \wpsg\wpsg_calculation();
-			
-			$b->setCountry(\wpsg_country::getInstance(1));
-			
-			$b->addProduct('1', 0, '100', '1','c');
-			$b->addProduct('1', 1, '100', '1','b');
-			$b->setShipping('1', '100', '0');
-			$b->setPayment('1', '100', 'c_1');
-			
-			$ar = $b->getCalculationArray();
-			 
-			$this->assertTrue($this->compareArray($ar, array (
-				'land' =>
-					array (
-						'id' => '1',
-						'name' => 'Deutschland',
-						'kuerzel' => 'DE',
-						'vz' => '1',
-						'mwst' => '0',
-						'mwst_a' => '0.0000',
-						'mwst_b' => '7.0000',
-						'mwst_c' => '19.0000',
-						'mwst_d' => '0.0000',
-					),
-				'products' =>
-					array (
-						0 =>
-							array (
-								'product_key' => '1',
-								'product_id' => '1',
-								'product_index' => 0,
-								'netto' => '100',
-								'amount' => '1',
-								'tax_key' => 'c_1',
-								'order_product_id' => false,
-								'brutto' => 119.0,
-								'sum_tax' => 19.0,
-							),
-						1 =>
-							array (
-								'product_key' => '1',
-								'product_id' => '1',
-								'product_index' => 1,
-								'netto' => '100',
-								'amount' => '1',
-								'tax_key' => 'b_1',
-								'order_product_id' => false,
-								'brutto' => 107.0,
-								'sum_tax' => 7.0,
-							),
-					),
-				'discount' =>
-					array (
-					),
-				'sum' =>
-					array (
-						'product_netto' => 200, // Netto Preis der Produkte mit Gutschein
-						'product_brutto' => 226.0, // Brutto Preis der Produkte mit Gutschein
-						'prediscount_netto' => 400, // Netto vor der Anwendung der Rabatte
-						'prediscount_brutto' => 460.0, // Brutto vor der Anwendung der Rabatte
-						'netto' => 400,	// Netto Summe
-						'brutto' => 460.0,	// Brutto Summe
-						'tax' => 60.0,	// Steur Summe
-						'discount_netto' => 0,	// Angewendeter Rabatt Netto
-						'discount_brutto' => 0,	// Angewendeter Rabatt Brutto
-						'prevoucher_netto' => 200,	 // Prduktpreis vor Gutschein Netto
-						'prevoucher_brutto' => 226.0,	// Produktpreis vor Gutschein Brutto
-						'voucher_netto' => 0,	// Gutschein Netto
-						'voucher_brutto' => 0,	// Gutschein Brutto
-					),
-				'tax' =>
-					array (
-						'c_1' =>
-							array (
-								'key' => 'c_1',
-								'netto' => 266.66666666666663,
-								'brutto' => 195.66666666666663,
-								'tax_value' => '19.0000',
-								'sum_tax' => 47.99999999999998,
-								'part' => 0.6666666666666666,
-							),
-						'b_1' =>
-							array (
-								'key' => 'b_1',
-								'netto' => 133.33333333333331,
-								'brutto' => 38.33333333333332,
-								'tax_value' => '7.0000',
-								'sum_tax' => 11.99999999999999,
-								'part' => 0.3333333333333333,
-							),
-						0 =>
-							array (
-								'key' => '0',
-								'netto' => 100,
-								'brutto' => 114.99999999999997,
-								'tax_value' => 0,
-								'sum_tax' => 14.999999999999972,
-								'part' => 0,
-							),
-					),
-				'shipping' =>
-					array (
-						'key' => '1',
-						'netto' => '100',
-						'brutto' => 114.99999999999997,
-						'tax_key' => '0',
-						'sum_tax' => 14.999999999999972,
-					),
-				'payment' =>
-					array (
-						'key' => '1',
-						'netto' => '100',
-						'brutto' => 119.0,
-						'tax_key' => 'c_1',
-						'sum_tax' => 19.0,
-					),
-				'voucher' => NULL,
-			)));
-			
-		}
-		
+	
+		 
+	 	
 		private function compareArray($a, $b_check, $key = '') {
 			
 			if (is_array($b_check)) {
 				
+				$bReturn = true;
+				
 				foreach ($b_check as $k => $v) {
 										
-					$bReturn = false;
-					
 					$b = $this->compareArray($a[$k], $b_check[$k], $key.'/'.$k);
 					if (!$b) $bReturn = false;
@@ -169,5 +114,5 @@
 				}
 				
-				return true;
+				return $bReturn;
 				
 			} else {
Index: /views/order/product_table.phtml
===================================================================
--- /views/order/product_table.phtml	(revision 7196)
+++ /views/order/product_table.phtml	(revision 7197)
@@ -5,8 +5,8 @@
      */
     
-    $arCalculation = $this->view['oCalculation']->getCalculationArray($this->getBackendTaxView()); 
-    $arTax = $this->view['oCalculation']->getTaxLabelArray();
-    $arTaxShort = $this->view['oCalculation']->getTaxLabelArray(true);
- 
+    $arCalculation = $this->view['oCalculation']->getCalculationArray(true);
+	$arTax = $this->view['oCalculation']->getTaxLabelArray();
+	$arTaxShort = $this->view['oCalculation']->getTaxLabelArray(true);
+	     
     $this->view['colspan'] = 3;
     if ($this->get_option('wpsg_showMwstAlways') == '1' || sizeof($arCalculation['tax']) > 1) $this->view['colspan'] ++;
@@ -14,66 +14,170 @@
     $this->view['arCalculation'] = $arCalculation;
     
+    if ($this->getBackendTaxView() === WPSG_NETTO) $display = 'netto';
+    else $display = 'brutto';
+    
 ?>
 
 <style>
 
-    .wpsg_row_small td { font-size:0.8em; }
+	.wpsg_row_small td { font-size:0.8em; }
 	#wpsg-bs .wpsg_row_small  .wpsg-glyphlink-td > span { margin-top:0px; }
-    
+
 </style>
 
+
 <table class="wpsg_produkte table">
-    <tr class="wpsg_kopf">
-        <th class="wpsg_cell_name"><?php echo __('Produktname', 'wpsg'); ?></th>
-        <th class="wpsg_cell_preis"><?php echo __('Einzelpreis', 'wpsg'); ?></th>
-        <?php if (sizeof($arCalculation['tax']) > 1 || $this->get_option('wpsg_showMwstAlways') == '1') { ?>
-            <th class="wpsg_cell_mwst"><?php echo __("MwSt.", "wpsg"); ?></th>
-        <?php } ?>
-        <th class="wpsg_cell_menge"><?php echo __("Anzahl", "wpsg"); ?></th>
-        <th class="wpsg_cell_gesamtpreis"><?php echo __("Gesamtpreis", "wpsg"); ?></th>
-    </tr>
-    <tr><td colspan="<?php echo $this->view['colspan'] + 1; ?>" style="line-height:2px; height:2px; background-color:#999999; padding:0px;"></td></tr>
-    <?php $i = 0; foreach ($arCalculation['products'] as $p) { $i ++; $product_price = $p['price']; ?>        
-        <tr class="wpsg_<?php echo (($i % 2 == 0)?'odd':'even'); ?>">
-            <td class="wpsg_cell_name">
-                <a href="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Produkt&action=edit&edit_id=<?php echo $p['product_id']; ?>" title="<?php echo __('Zum Produkt', 'wpsg'); ?>">
-                    <?php echo wpsg_hspc($this->getProductName($p['product_id'])); ?>
-                </a>
-                <a href="#" class="wpsg-glyphlink-td" title="<?php echo __('Produkt bearbeiten', 'wpsg'); ?>" onclick="return WPSG_BE_Product.editProduct(<?php echo $p['order_product_id']; ?>);"><span class="glyphicon glyphicon-pencil"></span></a>
-                <a href="#" class="wpsg-glyphlink-td" title="<?php echo __('Produkt lÃ¶schen', 'wpsg'); ?>" onclick="return WPSG_BE_Product.remvoeProduct(<?php echo $p['order_product_id']; ?>);"><span class="glyphicon glyphicon-trash"></span></a>
-            </td>
-            <td class="wpsg_cell_preis"><?php echo wpsg_ff($product_price); ?> <?php echo $this->get_option('wpsg_currency'); ?></td>
-            <?php if (sizeof($arCalculation['tax']) > 1 || $this->get_option('wpsg_showMwstAlways') == '1') { ?>
-                <td class="wpsg_cell_mwst"><?php echo $arTaxShort[$p['tax_key']]; ?></td>
-            <?php } ?>
-            <td class="wpsg_cell_menge"><?php echo wpsg_hspc($p['amount']); ?></td>
-            <td class="wpsg_cell_gesamtpreis"><?php echo wpsg_ff($p['amount'] * $product_price); ?> <?php echo $this->get_option('wpsg_currency'); ?></td>
-        </tr>
-        <?php /* if (wpsg_isSizedArray($p['order_allowedshipping'])) { ?>
-            <tr class="wpsg_<?php echo (($i % 2 == 0)?'odd':'even'); ?>">
-                <td class="wpsg_cell_name">
-                    <?php echo __('MÃ¶gliche Versandarten', 'wpsg'); ?>:
-                </td>
-                <td class="wpsg_cell_gesamtpreis" colspan="<?php echo ((sizeof($this->view['basket']['mwst']) > 1 || $this->get_option('wpsg_showMwstAlways') == '1')?4:3); ?>">
-                    <?php $j = 0; foreach ($p['order_allowedshipping'] as $shipping) { $j ++; ?>
-                        <?php echo $this->getShippingName($shipping); ?><?php if ($j < sizeof($p['order_allowedshipping'])) { ?>, <?php } ?>
-                    <?php } ?>
-                </td>
-            </tr>
-        <?php } */ ?>
-        <?php $this->callMods('order_view_row', array(&$p, $i)); ?>
-        <tr><td colspan="<?php echo $this->view['colspan'] + 1; ?>" style="line-height:2px; height:2px; background-color:#999999; padding:0px;"></td></tr>
-    <?php } ?>
-	
-	<?php /* Gutscheine */ ?>
-	<?php if (wpsg_isSizedArray($arCalculation['voucher'])) { ?>
-
-		<?php foreach ($arCalculation['voucher'] as $v) { ?>
-
-			<tr class="wpsg_row_discount wpsg_row_small">
-				<td colspan="" class="wpsg_cell_mwst_label">
+	<thead>
+		<tr class="wpsg_kopf">
+			<th class="wpsg_cell_name"><?php echo __('Produktname', 'wpsg'); ?></th>
+			<th class="wpsg_cell_preis"><?php echo __('Einzelpreis', 'wpsg'); ?></th>
+			<?php if (sizeof($arCalculation['tax']) > 1 || $this->get_option('wpsg_showMwstAlways') == '1') { ?>
+				<th class="wpsg_cell_mwst"><?php echo __("MwSt.", "wpsg"); ?></th>
+			<?php } ?>
+			<th class="wpsg_cell_menge"><?php echo __("Anzahl", "wpsg"); ?></th>
+			<th class="wpsg_cell_gesamtpreis"><?php echo __("Gesamtpreis", "wpsg"); ?></th>
+		</tr>
+	</thead>
+	<tbody>
+
+		<tr><td colspan="<?php echo $this->view['colspan'] + 1; ?>" style="line-height:2px; height:2px; background-color:#999999; padding:0px;"></td></tr>
+		<?php $i = 0; foreach ($arCalculation['product'] as $p) { $i ++; $product_price = $p[$display]; ?>
+			<tr class="wpsg_<?php echo (($i % 2 == 0)?'odd':'even'); ?>">
+				<td class="wpsg_cell_name">
+					<a href="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Produkt&action=edit&edit_id=<?php echo $p['product_id']; ?>" title="<?php echo __('Zum Produkt', 'wpsg'); ?>">
+						<?php echo wpsg_hspc($this->getProductName($p['product_id'])); ?>
+					</a>
+					<a href="#" class="wpsg-glyphlink-td" title="<?php echo __('Produkt bearbeiten', 'wpsg'); ?>" onclick="return WPSG_BE_Product.editProduct(<?php echo $p['order_product_id']; ?>);"><span class="glyphicon glyphicon-pencil"></span></a>
+					<a href="#" class="wpsg-glyphlink-td" title="<?php echo __('Produkt lÃ¶schen', 'wpsg'); ?>" onclick="return WPSG_BE_Product.remvoeProduct(<?php echo $p['order_product_id']; ?>);"><span class="glyphicon glyphicon-trash"></span></a>
+				</td>
+				<td class="wpsg_cell_preis"><?php echo wpsg_ff($product_price); ?> <?php echo $this->get_option('wpsg_currency'); ?></td>
+				<?php if (sizeof($arCalculation['tax']) > 1 || $this->get_option('wpsg_showMwstAlways') == '1') { ?>
+					<td class="wpsg_cell_mwst"><?php echo $arTaxShort[$p['tax_key']]; ?></td>
+				<?php } ?>
+				<td class="wpsg_cell_menge"><?php echo wpsg_hspc($p['amount']); ?></td>
+				<td class="wpsg_cell_gesamtpreis"><?php echo wpsg_ff($p['amount'] * $product_price); ?> <?php echo $this->get_option('wpsg_currency'); ?></td>
+			</tr>
+			<?php $this->callMods('order_view_row', array(&$p, $i)); ?>
+			<tr><td colspan="<?php echo $this->view['colspan'] + 1; ?>" style="line-height:2px; height:2px; background-color:#999999; padding:0px;"></td></tr>
+		<?php } ?>
+		
+		<?php // Gutscheine  ?>
+		<?php if (wpsg_isSizedArray($arCalculation['voucher'])) { ?>
+			
+			<?php foreach ($arCalculation['voucher'] as $v) { ?>
+
+				<tr class="wpsg_row_discount wpsg_row_small">
+					<td colspan="" class="wpsg_cell_mwst_label">
+
+						<div>
+							<?php echo __('Gutschein', 'wpsg'); ?>
+							
+							<?php if ($this->getBackendTaxView() === WPSG_BRUTTO) { ?>
+								<?php echo __('(inkl. MwSt.)', 'wpsg'); ?>
+							<?php } else { ?>
+								<?php echo __('(zzgl. MwSt.)', 'wpsg'); ?>
+							<?php } ?>
+
+							<a href="#" class="wpsg-glyphlink-td" title="<?php echo __('Gutschein bearbeiten', 'wpsg'); ?>" onclick="return WPSG_BE_Voucher.editVoucher();"><span class="glyphicon glyphicon-pencil"></span></a>
+							<a href="#" class="wpsg-glyphlink-td" title="<?php echo __('Gutschein lÃ¶schen', 'wpsg'); ?>" onclick="return WPSG_BE_Voucher.removeVoucher();"><span class="glyphicon glyphicon-trash"></span></a>
+						</div>
+						<div>
+							Code: <?php echo $v['code']; ?>
+						</div>
+
+					</td>
+					<td class="wpsg_cell_preis">
+						
+						<?php if (strpos($v['set'], '%') === false) { ?>
+							<?php echo wpsg_ff($arCalculation['sum']['voucher_'.$display], $this->get_option('wpsg_currency')); ?>
+						<?php } else { ?>
+							<?php echo wpsg_ff($v['set'], '%'); ?>
+						<?php } ?>
+						
+					</td>
+					<?php if (sizeof($arCalculation['tax']) > 1 || $this->get_option('wpsg_showMwstAlways') == '1') { ?>
+						<td class="wpsg_cell_mwst"><?php echo $arTaxShort[$v['tax_key']]; ?></td>
+					<?php } ?>
+					<td>1</td>
+					<td class="wpsg_cell_mwst_value wpsg_cell_gesamtpreis">
+						<?php echo wpsg_ff($arCalculation['sum']['voucher_'.$display]); ?> <?php echo $this->get_option('wpsg_currency'); ?>
+					</td>
+				</tr>
+			
+			<?php } ?>
+			<tr><td colspan="<?php echo $this->view['colspan'] + 1; ?>" style="line-height:2px; height:2px; background-color:#999999; padding:0px;"></td></tr>
+		
+		<?php } ?>
+
+		<tr class="wpsg_row_summe">
+			<td colspan="<?php echo $this->view['colspan']; ?>" class="wpsg_cell_summe_label">
+				
+				<?php if ($this->get_option('wpsg_kleinunternehmer') == '1') { ?>
 					
-					<div>
-						<?php echo __('Gutschein', 'wpsg'); ?>
+					<?php echo wpsg_translate(__('Summe (zzgl. #1#)', 'wpsg'), '<a href="'.$this->getURL(wpsg_ShopController::URL_VERSANDKOSTEN).'" target="_blank">'.__('Versandkosten', 'wpsg').'</a>'); ?>
+				
+				<?php } else { ?>
+					
+					<?php if ($this->get_option('wpsg_preisangaben') == WPSG_NETTO) { ?>
+						<?php echo wpsg_translate(__('Summe (zzgl. #1#, zzgl. MwSt.)', 'wpsg'), '<a href="'.$this->getURL(wpsg_ShopController::URL_VERSANDKOSTEN).'" target="_blank">'.__('Versandkosten', 'wpsg').'</a>'); ?>
+					<?php } else { ?>
+						<?php echo wpsg_translate(__('Summe (zzgl. #1#, inkl. MwSt.)', 'wpsg'), '<a href="'.$this->getURL(wpsg_ShopController::URL_VERSANDKOSTEN).'" target="_blank">'.__('Versandkosten', 'wpsg').'</a>'); ?>
+					<?php } ?>
+				
+				<?php } ?>
+
+			</td>
+			<td class="wpsg_cell_summe_value wpsg_cell_gesamtpreis">
+				
+				<?php echo wpsg_ff($arCalculation['sum']['productsum_'.$display]); ?> <?php echo $this->get_option('wpsg_currency'); ?>
+
+			</td>
+		</tr>
+		
+		<?php // Versandkosten  ?>
+		<?php $price_shipping = $arCalculation['sum']['shipping_'.$display]; ?>
+		<?php if ($price_shipping != 0 || $this->get_option('wpsg_hideemptyshipping') != '1') { ?>
+			<tr class="wpsg_row_shipping">
+				<td class="wpsg_cell_shipping_label" colspan="2">
+					<?php echo __('Versandkosten', 'wpsg'); ?>
+					<?php echo __('  ('.$this->arShipping[$arCalculation['shipping'][0]['shipping_key']]['name'].')', 'wpsg'); ?>
+					<a href="#" class="wpsg-glyphlink-td" title="<?php echo __('Versandart Ã€ndern', 'wpsg'); ?>"  onclick="return WPSG_BE_Pay_Ship.changeShippingPayment();"><span class="glyphicon glyphicon-pencil"></span></a>
+				</td>
+				<?php if (sizeof($arCalculation['tax']) > 1 || $this->get_option('wpsg_showMwstAlways') == '1') { ?>
+				<td><?php echo $arTaxShort[$arCalculation['shipping'][0]['tax_key']]; ?></td>
+				<?php } ?>
+				<td class="wpsg_cell_shipping_value wpsg_cell_gesamtpreis" colspan="2">
+					<span id="wpsg_cell_shipping_value"><?php echo wpsg_ff($price_shipping); ?> </span>
+					<?php echo $this->get_option('wpsg_currency'); ?>
+				</td>
+			</tr>
+		<?php } ?>
+		
+		<?php // Zahlungskosten  ?>
+		<?php $price_payment = $arCalculation['sum']['payment_'.$display]; ?>
+		<?php if ($price_payment != 0 || $this->get_option('wpsg_hideemptypayment') != '1') { ?>
+			<tr class="wpsg_row_payment">
+				<td colspan="2" class="wpsg_cell_payment_label">
+					<?php echo __('Zahlungsart', 'wpsg'); ?>
+					<?php echo __('  ('.$this->arPayment[$arCalculation['payment'][0]['payment_key']]['name'].')', 'wpsg'); ?>
+					<a href="#" class="wpsg-glyphlink-td" title="<?php echo __('Zahlungsart Ã€ndern', 'wpsg'); ?>" onclick="return WPSG_BE_Pay_Ship.changeShippingPayment();"><span class="glyphicon glyphicon-pencil"></span></a>
+				</td>
+				<?php if (sizeof($arCalculation['tax']) > 1 || $this->get_option('wpsg_showMwstAlways') == '1') { ?>
+					<td><?php echo $arTaxShort[$arCalculation['payment'][0]['tax_key']]; ?></td>
+				<?php } ?>
+				<td class="wpsg_cell_payment_value wpsg_cell_gesamtpreis" colspan="2">
+					<span id="wpsg_cell_payment_value"><?php echo wpsg_ff($price_payment); ?> </span>
+					<?php echo $this->get_option('wpsg_currency'); ?>
+				</td>
+			</tr>
+		<?php } ?>
+		
+		<?php // Rabatte  ?>
+		<?php if (wpsg_isSizedArray($arCalculation['discount'])) { ?>			
+			<?php foreach ($arCalculation['discount'] as $d) { ?>
+				<tr class="wpsg_row_discount wpsg_row_small">
+					<td colspan="" class="wpsg_cell_mwst_label">
+						
+						<?php echo __('Rabatt', 'wpsg'); ?>
 						
 						<?php if ($this->getBackendTaxView() === WPSG_BRUTTO) { ?>
@@ -82,172 +186,94 @@
 							<?php echo __('(zzgl. MwSt.)', 'wpsg'); ?>
 						<?php } ?>
+
+						<a href="#" class="wpsg-glyphlink-td" title="<?php echo __('Rabatt bearbeiten', 'wpsg'); ?>" onclick="return WPSG_BE_Discount.editDiscount();"><span class="glyphicon glyphicon-pencil"></span></a>
+						<a href="#" class="wpsg-glyphlink-td" title="<?php echo __('Rabatt lÃ¶schen', 'wpsg'); ?>" onclick="return WPSG_BE_Discount.removeDiscount();"><span class="glyphicon glyphicon-trash"></span></a>
+
+					</td>
+					<td class="wpsg_cell_preis">
+						
+						<?php if (strpos($v['set'], '%') === false) { ?>
+							<?php echo wpsg_ff($arCalculation['sum']['voucher_'.$display], $this->get_option('wpsg_currency')); ?>
+						<?php } else { ?>
+							<?php echo wpsg_ff($v['set'], '%'); ?>
+						<?php } ?>
+						
+					</td>
+					<?php if (sizeof($arCalculation['tax']) > 1 || $this->get_option('wpsg_showMwstAlways') == '1') { ?>
+						<td class="wpsg_cell_mwst"><?php echo $arTaxShort[$d['tax_key']]; ?></td>
+					<?php } ?>
+					<td></td>
+					<td class="wpsg_cell_mwst_value wpsg_cell_gesamtpreis">
+						<?php echo wpsg_ff($arCalculation['sum']['discount_'.$display]); ?> <?php echo $this->get_option('wpsg_currency'); ?>
+					</td>
+				</tr>
+			<?php } ?>
+		<?php } ?>
+		
+		<?php if ($this->getBackendTaxView() === WPSG_NETTO) { ?>
+			
+			<tr class="wpsg_row_gesamt">
+				<td colspan="<?php echo $this->view['colspan']; ?>" class="wpsg_cell_summe_label">
+					<?php echo __('Summe', 'wpsg'); ?>
+					<?php echo __('(zzgl. MwSt.)', 'wpsg'); ?>
+				</td>
+				<td class="wpsg_cell_gesamt_value wpsg_cell_gesamtpreis">
+					<?php echo wpsg_ff($arCalculation['sum'][$display]); ?> <?php echo $this->get_option('wpsg_currency'); ?>
+				</td>
+			</tr>
+			<?php foreach ($arCalculation['tax'] as $tax) { if ($tax['sum'] > 0 && $tax['key'] != '0') { ?>
+				<tr class="wpsg_row_mwst wpsg_row_small">
+					<td colspan="<?php echo $this->view['colspan']; ?>" class="wpsg_cell_mwst_label">
+						<?php echo wpsg_translate(__('zuzÃŒglich MwSt. (#1#)', 'wpsg'), $arTax[$tax['key']]); ?>
+					</td>
+					<td class="wpsg_cell_mwst_value wpsg_cell_gesamtpreis">
+						<?php echo wpsg_ff($tax['sum']); ?> <?php echo $this->get_option('wpsg_currency'); ?>
+					</td>
+				</tr>
+			<?php } } ?>
+			<tr class="wpsg_row_gesamt">
+				<td colspan="<?php echo $this->view['colspan']; ?>" class="wpsg_cell_summe_label">
+					<strong><?php echo __('Gesamtsumme', 'wpsg'); ?></strong>
+					<?php echo __('(inkl. MwSt.)', 'wpsg'); ?>
+				</td>
+				<td class="wpsg_cell_gesamt_value wpsg_cell_gesamtpreis">
+					<strong><?php echo wpsg_ff($arCalculation['sum']['brutto']); ?> <?php echo $this->get_option('wpsg_currency'); ?></strong>
+				</td>
+			</tr>
+			
+		<?php } else { ?>
+
+			<tr class="wpsg_row_gesamt">
+				<td colspan="<?php echo $this->view['colspan']; ?>" class="wpsg_cell_summe_label">
+					<strong><?php echo __('Gesamtsumme', 'wpsg'); ?></strong>
+					<?php if ($this->getBackendTaxView() === WPSG_BRUTTO) { ?>
+						<?php echo __('(inkl. MwSt.)', 'wpsg'); ?>
+					<?php } else { ?>
+						<?php echo __('(zzgl. MwSt.)', 'wpsg'); ?>
+					<?php } ?>
+				</td>
+				<td class="wpsg_cell_gesamt_value wpsg_cell_gesamtpreis">
+					<strong><?php echo wpsg_ff($arCalculation['sum']['brutto']); ?> <?php echo $this->get_option('wpsg_currency'); ?></strong>
+				</td>
+			</tr>			
+			<?php foreach ($arCalculation['tax'] as $tax) { if ($tax['sum'] > 0 && $tax['key'] != '0') { ?>
+				<tr class="wpsg_row_mwst wpsg_row_small">
+					<td colspan="<?php echo $this->view['colspan']; ?>" class="wpsg_cell_mwst_label">
+						<?php if ($this->get_option('wpsg_kleinunternehmer') == '1') { ?>
+							<?php echo $this->get_option('wpsg_kleinunternehmer_text'); ?>
+						<?php } else { ?>
+							<?php echo wpsg_translate(__('darin enthaltene MwSt. (#1#)', 'wpsg'), $arTax[$tax['key']]); ?>
+						<?php } ?>
+					</td>
+					<td class="wpsg_cell_mwst_value wpsg_cell_gesamtpreis">
+						<?php echo wpsg_ff($tax['sum']); ?> <?php echo $this->get_option('wpsg_currency'); ?>
+					</td>
+				</tr>
+			<?php } } ?>
+			
+		<?php } ?>
 	
-						<a href="#" class="wpsg-glyphlink-td" title="<?php echo __('Gutschein bearbeiten', 'wpsg'); ?>" onclick="return WPSG_BE_Voucher.editVoucher();"><span class="glyphicon glyphicon-pencil"></span></a>
-						<a href="#" class="wpsg-glyphlink-td" title="<?php echo __('Gutschein lÃ¶schen', 'wpsg'); ?>" onclick="return WPSG_BE_Voucher.removeVoucher();"><span class="glyphicon glyphicon-trash"></span></a>
-					</div>
-					<div>
-						Code: <?php echo $v['code']; ?>
-					</div>
-
-				</td>
-				<td class="wpsg_cell_preis">
-					<?php echo wpsg_ff($v['set'], $this->get_option('wpsg_currency'), true); ?>
-				</td>
-				<?php if (sizeof($arCalculation['tax']) > 1 || $this->get_option('wpsg_showMwstAlways') == '1') { ?>
-					<td class="wpsg_cell_mwst"><?php echo $arTaxShort[$v['tax_key']]; ?></td>
-				<?php } ?>				
-				<td>1</td>
-				<td class="wpsg_cell_mwst_value wpsg_cell_gesamtpreis">
-					<?php echo wpsg_ff($arCalculation['sum']['voucher_display']); ?> <?php echo $this->get_option('wpsg_currency'); ?>
-				</td>
-			</tr>
-			
-		<?php } ?>		
-		<tr><td colspan="<?php echo $this->view['colspan'] + 1; ?>" style="line-height:2px; height:2px; background-color:#999999; padding:0px;"></td></tr>
-		
-	<?php } ?>
+	</tbody>
+</table>
 	
-    <tr class="wpsg_row_summe">
-        <td colspan="<?php echo $this->view['colspan']; ?>" class="wpsg_cell_summe_label">
-            
-            <?php if ($this->get_option('wpsg_kleinunternehmer') == '1') { ?>
-                
-                <?php echo wpsg_translate(__('Summe (zzgl. #1#)', 'wpsg'), '<a href="'.$this->getURL(wpsg_ShopController::URL_VERSANDKOSTEN).'" target="_blank">'.__('Versandkosten', 'wpsg').'</a>'); ?>
-           
-            <?php } else { ?>
-                
-                <?php if ($this->get_option('wpsg_preisangaben') == WPSG_NETTO) { ?>
-                    <?php echo wpsg_translate(__('Summe (zzgl. #1#, zzgl. MwSt.)', 'wpsg'), '<a href="'.$this->getURL(wpsg_ShopController::URL_VERSANDKOSTEN).'" target="_blank">'.__('Versandkosten', 'wpsg').'</a>'); ?>
-                <?php } else { ?>
-                    <?php echo wpsg_translate(__('Summe (zzgl. #1#, inkl. MwSt.)', 'wpsg'), '<a href="'.$this->getURL(wpsg_ShopController::URL_VERSANDKOSTEN).'" target="_blank">'.__('Versandkosten', 'wpsg').'</a>'); ?>
-                <?php } ?>
-                
-            <?php } ?>
-            
-        </td>
-        <td class="wpsg_cell_summe_value wpsg_cell_gesamtpreis">
-            
-            <?php echo wpsg_ff($arCalculation['sum']['product']); ?> <?php echo $this->get_option('wpsg_currency'); ?>
-            
-        </td>
-    </tr>
-    
-    <?php /* Versandkosten */ ?>
-    <?php $price_shipping = $arCalculation['shipping']['price']; ?>
-    <?php if ($price_shipping != 0 || $this->get_option('wpsg_hideemptyshipping') != '1') { ?>
-        <tr class="wpsg_row_shipping">
-            <td colspan="<?php echo $this->view['colspan']; ?>" class="wpsg_cell_shipping_label">
-                <?php echo __('Versandkosten', 'wpsg'); ?> 
-                <?php echo __('  ('.$this->arShipping[$arCalculation['shipping']['key']]['name'].')', 'wpsg'); ?>
-                <a href="#" class="wpsg-glyphlink-td" title="<?php echo __('Versandart Ã€ndern', 'wpsg'); ?>"  onclick="return WPSG_BE_Pay_Ship.changeShippingPayment();"><span class="glyphicon glyphicon-pencil"></span></a>
-            </td>
-            <td class="wpsg_cell_shipping_value wpsg_cell_gesamtpreis">
-                <span id="wpsg_cell_shipping_value"><?php echo wpsg_ff($price_shipping); ?> </span>
-                <?php echo $this->get_option('wpsg_currency'); ?>
-            </td>
-        </tr>
-    <?php } ?>
-
-    <?php /* Zahlungskosten */ ?>
-    <?php $price_payment = $arCalculation['payment']['price']; ?>
-    <?php if ($price_payment != 0 || $this->get_option('wpsg_hideemptypayment') != '1') { ?>
-        <tr class="wpsg_row_payment">
-            <td colspan="<?php echo $this->view['colspan']; ?>" class="wpsg_cell_payment_label">
-                <?php echo __('Zahlungsart', 'wpsg'); ?>
-                <?php echo __('  ('.$this->arPayment[$arCalculation['payment']['key']]['name'].')', 'wpsg'); ?>
-                <a href="#" class="wpsg-glyphlink-td" title="<?php echo __('Zahlungsart Ã€ndern', 'wpsg'); ?>" onclick="return WPSG_BE_Pay_Ship.changeShippingPayment();"><span class="glyphicon glyphicon-pencil"></span></a>
-            </td>
-            <td class="wpsg_cell_payment_value wpsg_cell_gesamtpreis" >
-                <span id="wpsg_cell_payment_value"><?php echo wpsg_ff($price_payment); ?> </span>
-                <?php echo $this->get_option('wpsg_currency'); ?>
-            </td>
-        </tr>
-    <?php } ?>
-    
-    <?php if ($this->getBackendTaxView() === WPSG_NETTO && $this->get_option('wpsg_kleinunternehmer') != '1') { ?>
-        <?php foreach ($arCalculation['tax'] as $tax) { if ($tax['sum_tax'] > 0) { ?>
-            <tr class="wpsg_row_mwst">
-                <td colspan="<?php echo $this->view['colspan']; ?>" class="wpsg_cell_mwst_label">
-                    <?php echo wpsg_translate(__('zuzÃŒglich MwSt. (#1#)', 'wpsg'), $arTax[$tax['key']]); ?>
-                </td>
-                <td class="wpsg_cell_mwst_value wpsg_cell_gesamtpreis">
-                    <?php echo wpsg_ff($tax['sum_tax']); ?> <?php echo $this->get_option('wpsg_currency'); ?>
-                </td>
-            </tr>
-        <?php } } ?>
-    <?php } ?>
-    
-    <?php /* Rabatte */ ?>
-    <?php if ($arCalculation['sum']['prediscount_netto'] !== $arCalculation['sum']['netto']) { ?>
-        <tr class="wpsg_row_discount">
-            <td colspan="<?php echo $this->view['colspan']; ?>" class="wpsg_cell_mwst_label">
-                <?php echo __('Gesamtpreis', 'wpsg'); ?>
-                <?php if ($this->getBackendTaxView() === WPSG_BRUTTO) { ?>
-                    <?php echo __('(abzgl. Rabatt, inkl. MwSt.)', 'wpsg'); ?>
-                <?php } else { ?>
-                    <?php echo __('(abzgl. Rabatt, zzgl. MwSt.)', 'wpsg'); ?>
-                <?php } ?>
-            </td>
-            <td class="wpsg_cell_mwst_value wpsg_cell_gesamtpreis">
-                <?php echo wpsg_ff($arCalculation['sum']['prediscount_display']); ?> <?php echo $this->get_option('wpsg_currency'); ?>     
-            </td>
-        </tr>
-        <?php foreach ($arCalculation['discount'] as $d) { ?>
-        <tr class="wpsg_row_discount wpsg_row_small">
-            <td colspan="" class="wpsg_cell_mwst_label">
-               <?php echo __('Rabatt', 'wpsg'); ?>
-               <?php if ($this->getBackendTaxView() === WPSG_BRUTTO) { ?>
-               	<?php echo __('(inkl. MwSt.)', 'wpsg'); ?>
-               <?php } else { ?>
-                  <?php echo __('(zzgl. MwSt.)', 'wpsg'); ?>
-					<?php } ?>
-
-					<a href="#" class="wpsg-glyphlink-td" title="<?php echo __('Rabatt bearbeiten', 'wpsg'); ?>" onclick="return WPSG_BE_Discount.editDiscount();"><span class="glyphicon glyphicon-pencil"></span></a>
-					<a href="#" class="wpsg-glyphlink-td" title="<?php echo __('Rabatt lÃ¶schen', 'wpsg'); ?>" onclick="return WPSG_BE_Discount.removeDiscount();"><span class="glyphicon glyphicon-trash"></span></a>
-					
-            </td>
-            <td class="wpsg_cell_preis">
-                <?php echo wpsg_ff($d['set'], $this->get_option('wpsg_currency'), true); ?>
-            </td>
-            <?php if (sizeof($arCalculation['tax']) > 1 || $this->get_option('wpsg_showMwstAlways') == '1') { ?>
-                <td class="wpsg_cell_mwst"><?php echo $arTaxShort[$d['tax_key']]; ?></td>
-            <?php } ?>
-            <td></td>
-            <td class="wpsg_cell_mwst_value wpsg_cell_gesamtpreis">
-                <?php echo wpsg_ff($arCalculation['sum']['discount_display']); ?> <?php echo $this->get_option('wpsg_currency'); ?>
-            </td>
-        </tr>
-        <?php } ?>
-    <?php } ?>
-    
-    <tr class="wpsg_row_gesamt">
-        <td colspan="<?php echo $this->view['colspan']; ?>" class="wpsg_cell_gesamt_label">
-            <strong><?php echo __('Gesamtpreis', 'wpsg'); ?></strong> 
-            <?php if ($this->getBackendTaxView() === WPSG_BRUTTO) { ?>
-                <?php echo __('(inkl. MwSt.)', 'wpsg'); ?>
-            <?php } else { ?>
-                <?php echo __('(zzgl. MwSt.)', 'wpsg'); ?>
-            <?php } ?>
-        </td>
-        <td class="wpsg_cell_gesamt_value wpsg_cell_gesamtpreis">
-            <strong><?php echo wpsg_ff($arCalculation['sum']['display']); ?> <?php echo $this->get_option('wpsg_currency'); ?></strong>
-        </td>
-    </tr>
-    
-    <?php if ($this->get_option('wpsg_kleinunternehmer') == '1' || $this->getBackendTaxView() != WPSG_NETTO) { ?>
-        <?php foreach ($arCalculation['tax'] as $tax) { if ($tax['sum_tax'] > 0 && $tax['key'] != '0') { ?>
-            <tr class="wpsg_row_mwst wpsg_row_small">
-                <td colspan="<?php echo $this->view['colspan']; ?>" class="wpsg_cell_mwst_label">
-                    <?php if ($this->get_option('wpsg_kleinunternehmer') == '1') { ?>
-                        <?php echo $this->get_option('wpsg_kleinunternehmer_text'); ?>
-                    <?php } else { ?>
-                        <?php echo wpsg_translate(__('darin enthaltene MwSt. (#1#)', 'wpsg'), $arTax[$tax['key']]); ?>
-                    <?php } ?>
-                </td>
-                <td class="wpsg_cell_mwst_value wpsg_cell_gesamtpreis">
-                    <?php echo wpsg_ff($tax['sum_tax']); ?> <?php echo $this->get_option('wpsg_currency'); ?>
-                </td>
-            </tr>
-        <?php } } ?>
-    <?php } ?>
-</table>
+<?php wpsg_debug($arCalculation); ?>
Index: /views/produkttemplates/standard_redirect.phtml
===================================================================
--- /views/produkttemplates/standard_redirect.phtml	(revision 7197)
+++ /views/produkttemplates/standard_redirect.phtml	(revision 7197)
@@ -0,0 +1,382 @@
+<?php
+	
+	/*
+	 * Template fÃŒr das Produkt im Frontend
+	 */
+	
+	//Ausgabe der verfÃŒgbaren Variablen
+	//wpsg_debug($this->view['data']);
+	
+	// Damit keine ZubehÃ¶rprodukte ausgegeben werden
+	//$this->noReleatedProducts = true;
+
+?>
+
+<div class="wpsg_produkt_wrapper">
+	
+	<input type="hidden" name="wpsg_post_id" value="<?php echo get_the_ID(); ?>" />
+	<input type="hidden" name="titleDisplayed" value="<?php echo $this->titleDisplayed; ?>" />
+	
+	<div class="wpsg_produkt wpsg_product_name">
+		
+		<?php if (!$this->titleDisplayed) { ?>
+			<h1 itemprop="name" class="wpsg_producttitle"><?php echo $this->getProductName($this->view['data']['id']); ?></h1>
+			<h2 itemprop="detailname" class="wpsg_productdetailtitle"><?php echo $this->view['data']['detailname']; ?></h2>
+		<?php } ?>
+		
+		<?php $this->callMods('product_top_afterheadline', array(&$this->view['data']['id'], $this->getTemplateIndex())); ?>
+	
+	</div>
+	
+	<?php $this->callMods('product_top', array(&$this->view['data']['id'], $this->getTemplateIndex())); ?>
+	
+	<div itemscope itemtype="http://schema.org/Product" class="wpsg_produkt wpsg_produkt_<?php echo $this->view['data']['id']; ?>">
+		
+		<?php /* Block fÃŒr die Produktbilder START */ ?>
+		<?php
+			
+			/* Das ist das primÃ€re Anzeigebild des Produktes (AttachmentID) */
+			$arAttachmentID = $this->imagehandler->getAttachmentID($this->view['data']['product_key']);
+			
+			/* Array mit allen AttachmentIDs der Produktbilder */
+			$arAttachmentIDsAll = $this->imagehandler->getAttachmentIDs($this->view['data']['product_id']);
+		
+		?>
+		
+		<?php if (wpsg_isSizedArray($arAttachmentIDsAll)) { ?>
+			<div class="wpsg_productimages">
+				
+				<div class="wpsg_produkt_produktbilder">
+					
+					<?php if (sizeof($arAttachmentIDsAll) > 0) { for ($i = 0; $i < sizeof($arAttachmentIDsAll); $i ++) { ?>
+						
+						<?php /* URL fÃŒr die Lightbox */ ?>
+						<?php $att = wp_get_attachment_image_src($arAttachmentIDsAll[$i], array(800, 600), false); ?>
+						
+						<a <?php if ($arAttachmentIDsAll[$i] != $arAttachmentID) echo 'style="display:none;"'; ?> rel="gallery-wpsg-<?php echo $this->getTemplateIndex(); ?>" title="<?php echo $this->getProductName($this->view['data']['id']); ?>" href="<?php echo $att[0]; ?>" class="thickbox">
+							
+							<?php echo wp_get_attachment_image($arAttachmentIDsAll[$i], array(300, 300), false, array()); ?>
+						
+						</a>
+					
+					<?php } } ?>
+				
+				</div>
+			
+			</div>
+		<?php } ?>
+		<?php /* Block fÃŒr die Produktbilder ENDE */ ?>
+		
+		<?php if ($this->get_option('wpsg_showArticelnumber') == '1') { ?>
+			<div class="wpsg_artikelnummer">
+				<?php echo __('Artikelnummer', 'wpsg'); ?>: <span class="wpsg_anr"><?php echo wpsg_hspc($this->view['data']['anr']); ?></span><br />
+				<?php if (wpsg_isSizedInt($this->get_option('wpsg_mod_produktartikel_ean'))) {?>
+					<?php echo __('EAN','wpsg');?>:<span class="wpsg_ean"><?php echo wpsg_hspc($this->view['data']['ean']); ?></span><br />
+				<?php } ?>
+				<?php if (wpsg_isSizedInt($this->get_option('wpsg_mod_produktartikel_gtin'))) {?>
+					<?php echo __('GTIN','wpsg');?>:<span class="wpsg_gtin"><?php echo wpsg_hspc($this->view['data']['gtin']); ?></span><br />
+				<?php }?></div>
+		<?php } ?>
+		
+		<?php /* Abfrage Preisanzeige nur fÃŒr eingeloggte User aktiv und User eingeloggt START*/ ?>
+		<?php if ($this->view['oProduct']->canDisplayPrice()) { ?>
+			
+			<div itemprop="offers" itemscope itemtype="http://schema.org/Offer" class="wpsg_produkt_preis">
+				
+				<meta itemprop="priceCurrency" content="<?php echo $this->get_option('wpsg_currency'); ?>" />
+				
+				<?php echo __('StÃŒckpreis:', 'wpsg'); ?>
+				
+				<?php $oldPrice = $this->view['oProduct']->getOldPrice();  ?>
+				<?php if ($oldPrice !== false && $oldPrice != $this->view['oProduct']->getPrice()) { ?>
+					<span class="wpsg_mod_productview_price wpsg_mod_productview_current"><?php echo wpsg_ff($this->view['oProduct']->getPrice(), $this->get_option('wpsg_currency')); ?></span>
+					<span class="wpsg_mod_productview_oldprice"><?php echo wpsg_ff($oldPrice, $this->get_option('wpsg_currency')); ?></span>
+				<?php } else { ?>
+					<span class="wpsg_mod_productview_price"><?php echo wpsg_ff($this->view['oProduct']->getPrice(), $this->get_option('wpsg_currency')); ?></span>
+				<?php } ?>
+			
+			</div>
+			
+			<?php if ($this->get_option('wpsg_kleinunternehmer')) { /* Kleinunternehmerregelung aktiviert START */ ?>
+				
+				<div class="wpsg_produkt_preishinweis">
+					<?php echo wpsg_translate(__('#2# zzgl. #1#', 'wpsg'), '<a href="'.$this->getURL(wpsg_ShopController::URL_VERSANDKOSTEN).'">'.__('Versandkosten', 'wpsg').'</a>', '<a href="#kkhint" title="'.wpsg_hspc($this->get_option('wpsg_kleinunternehmer_text')).'">Endpreis</a>'); ?>
+				</div>
+			
+			<?php } else { /* Kleinunternehmerregelung aktiviert ENDE */ ?>
+				
+				<div class="wpsg_produkt_preishinweis">
+					<?php if ($this->getFrontendTaxview() == WPSG_NETTO) { /* Frontend = NETTO Preise */ ?>
+						<?php if ($this->hasMod('wpsg_mod_freeshipping') && $this->get_option('wpsg_mod_freeshipping_aktiv') == '1') { /* Versandkostenfrei aktiv */?>
+							<?php echo wpsg_translate(__('(zzgl. #1#% MwSt. und versandkostenfrei)', 'wpsg'), wpsg_ff($this->view['data']['mwst_value'])); ?>
+						<?php } else { ?>
+							<?php echo wpsg_translate(__('(zzgl. #1#% MwSt. und zzgl. #2#)', 'wpsg'), wpsg_ff($this->view['data']['mwst_value']), '<a href="'.$this->getURL(wpsg_ShopController::URL_VERSANDKOSTEN).'">'.__('Versandkosten', 'wpsg').'</a>'); ?>
+						<?php }?>
+					<?php } else { /* Frontend = BRUTTO Preise */ ?>
+						<?php if ($this->hasMod('wpsg_mod_freeshipping') && $this->get_option('wpsg_mod_freeshipping_aktiv') == '1') { /* Versandkostenfrei aktiv */ ?>
+							<?php echo wpsg_translate(__('(inkl. #1#% MwSt. und versandkostenfrei)', 'wpsg'), wpsg_ff($this->view['data']['mwst_value'])); ?>
+						<?php } else { ?>
+							<?php echo wpsg_translate(__('(inkl. #1#% MwSt. und zzgl. #2#)', 'wpsg'), wpsg_ff($this->view['data']['mwst_value']), '<a href="'.$this->getURL(wpsg_ShopController::URL_VERSANDKOSTEN).'">'.__('Versandkosten', 'wpsg').'</a>'); ?>
+						<?php }?>
+					<?php } ?>
+				</div>
+			
+			<?php } ?>
+		
+		<?php } else {?>
+			
+			<?php echo wpsg_translate(__('Die Produktpreise werden nur eingeloggten Benutzern angezeigt. Loggen Sie sich <a href="'.$this->getURL(wpsg_ShopController::URL_PROFIL).'">hier</a> bitte ein, um zu bestellen.')); ?>
+		
+		<?php }?>
+		<?php /* Abfrage Preisanzeige nur fÃŒr eingeloggte User aktiv und User eingeloggt ENDE */ ?>
+		
+		<div itemprop="description" class="wpsg_produkt_shortdescription">
+			
+			<span><?php echo $this->view['data']['shortdesc']; ?></span>
+		
+		</div>
+		
+		<div class="wpsg_clear"></div>
+		
+		<?php /* Lagerbestand START*/?>
+		<?php if ($this->hasMod('wpsg_mod_stock') && $this->get_option('wpsg_mod_stock_showProduct') == '1') { ?>
+			
+			<div class="wpsg_mod_produktindex_stock">
+				
+				<?php if (($this->view['data']['stock']) > '0') {?>
+					
+					<label><?php echo __('Lagerbestand', 'wpsg'); ?></label>
+					<?php echo wpsg_translate(__('#1# Artikel auf Lager','wpsg'), $this->view['data']['stock']);  ?>
+				
+				<?php } else { ?>
+					
+					<label><?php echo wpsg_translate(__('', 'wpsg')); ?></label>
+				
+				<?php } ?>
+			
+			</div>
+		<?php } ?>
+		<?php /* Lagerbestand ENDE*/?>
+		
+		<?php /* FÃŒllmengenanzeige START */ ?>
+		<?php if ($this->hasMod('wpsg_mod_fuellmenge')) { ?>
+			
+			<div class="wpsg_produkt_fuellmenge">
+				
+				<?php if (($this->view['data']['fmenge']) > '0') { ?>
+					
+					<span class="label label_fuellmenge"><?php echo wpsg_translate(__('FÃŒllmenge:', 'wpsg')); ?></span>
+					
+					<?php echo wpsg_translate(__('#1# (#2# / #3#)', 'wpsg'),
+						'<span class="wpsg_fmenge">'.wpsg_ff($this->view['data']['fmenge'], '', true).'</span> '.$this->view['data']['feinheit'],
+						'<span class="fmenge_preis">'.wpsg_ff($this->view['data']['fmenge_preis'], $this->get_option('wpsg_currency')).'</span> ',
+						wpsg_ff($this->get_option('wpsg_mod_fuellmenge_bezug'), $this->view['data']['feinheit'])
+					); ?>
+				
+				<?php } else { ?>
+					
+					<label><?php echo wpsg_translate(__('', 'wpsg')); ?></label>
+				
+				<?php } ?>
+			
+			</div>
+		
+		<?php } ?>
+		<?php /* FÃŒllmengenanzeige ENDE */ ?>
+		
+		<?php /* Gewichtsanzeige START */ ?>
+		<?php if ($this->hasMod('wpsg_mod_weight') && $this->get_option('wpsg_mod_weight_showProduct') === '1') { ?>
+			<div class="wpsg_mod_weight_produkt">
+				
+				<?php if (($this->view['data']['weight']) > '0') { ?>
+					<span class="label label_weight"><?php echo wpsg_translate(__('Gewicht:', 'wpsg')); ?></span>
+					<?php echo wpsg_translate(__('#1# #2#', 'wpsg'), '<span class="wpsg_weight" id="weight_'.$this->view['data']['id'].'">'.wpsg_ff($this->view['data']['weight']).'</span>', $this->get_option('wpsg_mod_weight_unit')); ?>
+				<?php } else { ?>
+					<label><?php wpsg_translate(__('', 'wpsg'))?></label>
+				<?php } ?>
+			</div>
+		<?php } ?>
+		<?php /* Gewichtsanzeige ENDE */ ?>
+		
+		<?php /* Lieferzeit Anzeige START */ ?>
+		<?php if ($this->hasMod('wpsg_mod_deliverytime') && $this->get_option('wpsg_mod_deliverytime_show_product') == '1') { ?>
+			
+			<?php /* Produkt nur im Store, nicht im Onlineshop vorhanden */ ?>
+			<?php if ($this->callMod('wpsg_mod_deliverytime', 'isStoreProduct', array($this->view['data']['product_key']))) { ?>
+				
+				<div class="wpsg_product_only_store"><?php echo __($this->callMod('wpsg_mod_deliverytime', 'displayStoreText', array($this->view['data']['product_key']))); ?></div>
+				
+				<?php $stl = 0; $stl = $this->callMod('wpsg_mod_deliverytime', 'displayStoreLink', array($this->view['data']['product_key'])) ?>
+				<?php if (wpsg_isSizedInt($stl)) { ?>
+					
+					&nbsp;<a href="<?php echo get_permalink($stl); ?>"><?php echo __('So erreichen Sie uns.'); ?></a>
+				
+				<?php } ?>
+			
+			<?php } else { ?>
+				
+				<?php $strDelayNote = $this->callMod('wpsg_mod_deliverytime', 'displayDelayTime', array($this->view['data']['product_key'])); ?>
+				<?php if (wpsg_isSizedString($strDelayNote)) { ?>
+					
+					<div class="wpsg_mod_deliverytime_offline">
+						
+						<div class="wpsg_mod_deliverytime_delay"><?php echo wpsg_hspc($strDelayNote); ?></div>
+					
+					</div>
+				
+				<?php } else { ?>
+					
+					<div class="wpsg_mod_deliverytime">
+						<span class="label label_deliverytime"><?php echo wpsg_translate(__('Lieferzeit:', 'wpsg')); ?></span>
+						<?php echo $this->callMod('wpsg_mod_deliverytime', 'displayDeliveryTime', array($this->view['data']['product_key'])); ?>
+					</div>
+				
+				<?php } ?>
+			
+			<?php } ?>
+		
+		<?php } ?>
+		<?php /* Lieferzeit Anzeige ENDE */ ?>
+		
+		<?php /* Produktkurzbeschreibung START */ ?>
+		<div class="wpsg_product_informationarea">
+			
+			<?php if (strlen(trim($this->view['data']['beschreibung'])) > 0) { ?>
+				<div class="wpsg_product_information_short">
+					<div class="wpsg_produkt_additional_information">
+						<div itemprop="description" class="wpsg_produkt_shortdescription">
+							<span><?php echo $this->view['data']['beschreibung']; ?></span>
+						</div>
+					</div>
+				</div>
+			<?php } ?>
+		
+		</div>
+		<?php /* Produktkurzbeschreibung ENDE */ ?>
+		
+		<?php /* Varianten START */ ?>
+		<div class="wpsg_produkt_varianten">
+			<?php echo $this->callMod('wpsg_mod_productvariants', 'renderTemplate', array($this->view['data']['product_key'])); ?>
+		</div>
+		<?php /* Varianten ENDE */ ?>
+		
+		<?php $this->callMods('product_bottom', array(&$this->view['data']['id'], $this->getTemplateIndex())); ?>
+		
+		<div class="wpsg_product_buttonarea">
+			<div class="wpsg_product_buttons_add_basket">
+				<?php if ($this->view['oProduct']->canOrder()) { ?>
+					<div class="wpsg_produkt_add_basket_wrapper">
+						
+						<label class="wpsg_amount_label" for="wpsg_menge_<?php echo $this->getTemplateIndex(); ?>"><?php echo __('Anzahl', 'wpsg'); ?></label>
+						
+						<input type="text" value="<?php echo ((wpsg_isSizedInt($this->view['data']['menge']))?$this->view['data']['menge']:'1'); ?>" name="wpsg[menge]" class="wpsg_menge" id="wpsg_menge_<?php echo $this->getTemplateIndex(); ?>" <?php echo (($this->view['data']['basket_multiple'] == 4)?' readonly="readonly" ':''); ?> />
+						
+						<?php /* Urlaubsmodus aktiv */ ?>
+						<?php if ($this->hasMod('wpsg_mod_deliverytime') && ($this->get_option('wpsg_mod_deliverytime_holiday') == '1')) { ?>
+							
+							<?php if ($this->callMod('wpsg_mod_deliverytime', 'holiday', array($this->view['data']['product_key']))) { ?>
+								
+								<div class="wpsg_product_deliverytime_holiday" style="height:50px; padding:10px; width:50%; float:right; border:1px solid #ff0000;">
+									
+									<?php echo __($this->callMod('wpsg_mod_deliverytime', 'displayHolidaytext', array($this->view['data']['product_key']))); ?>
+								
+								</div>
+							
+							<?php } ?>
+						
+						<?php } else {?>
+							
+							<input class="wpsg_button wpsg_add_basket wpsg_add_basket_<?php echo $this->getTemplateIndex(); ?>" type="submit" value="<?php echo __('In den Warenkorb', 'wpsg'); ?>" name="wpsg[submit]" />
+						
+						<?php } ?>
+						 
+						<script type="text/javascript">
+
+							jQuery(document).ready(function() {
+
+								jQuery('.wpsg_add_basket_<?php echo $this->getTemplateIndex(); ?>').bind('click', function() {
+
+									wpsg_blockProductTemplate(<?php echo $this->getTemplateIndex(); ?>);
+
+									jQuery.ajax( {
+										url: '<?php echo $this->getURL(wpsg_ShopController::URL_BASKET); ?>',
+										data:
+											{
+												'wpsg_form_data': jQuery('#wpsg_produktform_<?php echo $this->getTemplateIndex(); ?>').serialize(),
+												'wpsg[ajax]': '1',
+												'wpsg[submit]': '1'
+											},
+										success: function(data)
+										{
+
+											location.href = "http://heko.home";
+
+										}
+									} );
+
+									return false;
+
+								} );
+
+							} );
+						
+						</script>
+					
+					</div>
+				<?php } ?>
+			</div>
+		</div>
+		
+		<div class="wpsg_clear"></div>
+		
+		<?php if ($this->hasMod('wpsg_mod_request') && $this->callMod('wpsg_mod_request', 'isRequestProduct', array($this->view['data']['id']))) { ?>
+			<label class="wpsg_amount_label" for="wpsg_menge_<?php echo $this->getTemplateIndex(); ?>"><?php echo __('Anzahl', 'wpsg'); ?></label>
+			<input type="text" value="<?php echo ((wpsg_isSizedInt($this->view['data']['menge']))?$this->view['data']['menge']:'1'); ?>" name="wpsg[menge]" class="wpsg_menge" id="wpsg_menge_<?php echo $this->getTemplateIndex(); ?>" <?php echo (($this->view['data']['basket_multiple'] == 4)?' readonly="readonly" ':''); ?> />
+			
+			<input class="wpsg_button wpsg_add_requestlist" id="wpsg_add_requestlist_<?php echo $this->getTemplateIndex(); ?>" type="submit" value="<?php echo __('Auf die Anfrageliste', 'wpsg'); ?>" name="wpsg[submit_request]" />
+		<?php } ?>
+		
+		<?php /* Produktlangbeschreibung START */ ?>
+		<div class="wpsg_product_informationarea">
+			
+			<?php if (strlen(trim($this->view['data']['longdescription'])) > 0) { ?>
+				<div class="wpsg_product_information_large">
+					<div class="wpsg_produkt_additional_information">
+						<div itemprop="description" class="wpsg_produkt_longdescription">
+							<span><?php echo $this->view['data']['longdescription']; ?></span>
+						</div>
+					</div>
+				</div>
+			<?php } ?>
+		
+		</div>
+		<?php /* Produktlangbeschreibung ENDE */ ?>
+		
+		<?php /* zusÃ€tzliche Informationen START */ ?>
+		<div class="wpsg_product_informationarea">
+			
+			<?php if (strlen(trim($this->view['data']['moreinfos'])) > 0) { ?>
+				<div class="wpsg_product_information_large">
+					<div class="wpsg_produkt_additional_information">
+						<div itemprop="description" class="wpsg_produkt_moreinfos">
+							<span><?php echo $this->view['data']['moreinfos']; ?></span>
+						</div>
+					</div>
+				</div>
+			<?php } ?>
+		
+		</div>
+		<?php /* zusÃ€tzliche Informationen ENDE */ ?>
+		
+		<div class="wpsg_clear"></div>
+		
+		<?php /* Social Media Integration */ ?>
+		<div class="wpsg_product_social_media">
+			<?php if (is_plugin_active('plugin-directory/shariff.php')) {?>
+				<?php echo do_shortcode('[shariff]')?>
+			<?php } ?>
+		</div>
+	
+	</div>
+
+</div>
