Index: /controller/wpsg_OrderController.class.php
===================================================================
--- /controller/wpsg_OrderController.class.php	(revision 7172)
+++ /controller/wpsg_OrderController.class.php	(revision 7173)
@@ -15,8 +15,21 @@
 			parent::dispatch();
 
-			if (wpsg_isSizedString($_REQUEST['subaction'], 'productData'))
-			{
+			if (wpsg_isSizedString($_REQUEST['subaction'], 'productData')) {
+
 				$this->productDataAction();
-			}
+				
+			} else if (wpsg_isSizedString($_REQUEST['subaction'], 'add')) {
+			    
+			    $this->addAction();
+			    
+            } else if (wpsg_isSizedString($_REQUEST['subaction'], 'autocomplete')) {
+			    
+			    $this->autocompleteAction();
+			    
+            } else if (wpsg_isSizedString($_REQUEST['action'], 'updateOrder')) {
+			    
+			    $this->updateOrderAction();
+			    
+            }
 			if (wpsg_isSizedString($_REQUEST['subaction'], 'shippingData'))
 			{
@@ -74,4 +87,155 @@
 		} // public function dispatch()
 
+        public function updateOrderAction() {
+
+		    $oDefaultCountry = $this->shop->getDefaultCountry();
+		    
+		    $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->setPayment(
+                $_REQUEST['payment_key'],
+                $payment_netto,
+                $this->shop->arPayment[$_REQUEST['payment_key']]['mwst_key']
+            );
+
+            $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)
+            ]);
+            
+        }
+        
+        public function autocompleteAction() {
+
+            $arReturn = [];
+		    
+		    $arCustomer = wpsg_customer::find(Array('s' => $_REQUEST['term']));		    
+		    		    
+		    foreach ($arCustomer as $oCustomer) {
+		        
+		        $arReturn[] = Array(
+		            'id' => 'ID:'.$oCustomer->id.' / '.$oCustomer->getLabel().' ('.$oCustomer->email.')',
+                    'value' => 'ID:'.$oCustomer->id.' / '.$oCustomer->getLabel().' ('.$oCustomer->email.')'  
+                );
+		        
+            }
+		    
+            wpsg_header::JSONData($arReturn);
+            
+		    exit;
+		    
+        } // public function autocompleteAction()
+        
+        public function addAction() {
+
+            check_admin_referer('order-index-add');
+		    
+            $customer_id = false;
+            
+            if (!wpsg_isSizedString($_REQUEST['search_customer'])) $this->addBackendError(__('Bitte einen Kunden definieren.', 'wpsg'));
+            else {
+                
+                // ID:3 / Max Mustermann (buyer@maennchen1.de)
+                preg_match_all('/^ID:(\d+?)/i', $_REQUEST['search_customer'], $m);
+                
+                if (wpsg_isSizedInt($m[1][0])) {
+                    
+                    $customer_id = $m[1][0];
+                    
+                } else {
+
+                    $customer_id = $this->db->fetchOne("SELECT `id` FROM `".WPSG_TBL_KU."` WHERE `email` = '".wpsg_q($_REQUEST['search_customer'])."' ");
+                                 
+                    if (!wpsg_isSizedInt($customer_id)) {
+                    
+                        $customer_id = $this->db->ImportQuery(WPSG_TBL_KU, Array(
+                            'email' => wpsg_q($_REQUEST['search_customer'])
+                        ));
+                        
+                        $customer_nr = $this->shop->buildKNR($customer_id);
+                                                
+                        $adress_id = $this->db->ImportQuery(WPSG_TBL_ADRESS, [
+                            'cdate' => 'NOW()',
+                            'land' => wpsg_q($this->shop->getDefaultCountry()->id)
+                        ]);
+
+                        $this->db->UpdateQuery(WPSG_TBL_KU, [
+                            'knr' => wpsg_q($customer_nr),
+                            'adress_id' => wpsg_q($adress_id)
+                        ], " `id` = '".wpsg_q($customer_id)."' ");
+                        
+                    }
+                    
+                } 
+                                
+            }
+                        
+            if (!wpsg_isSizedInt($customer_id)) $this->addBackendError(__('Es konnte kein Kunde gefunden werden.', 'wpsg'));
+            
+            if ($this->hasBackendError()) {
+                     
+                $this->redirect(WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Order&search_customer='.$_REQUEST['search_customer']);
+                
+            } else {
+
+                $oCustomer = wpsg_customer::getInstance($customer_id);
+                
+                $order_id = $this->db->ImportQuery(WPSG_TBL_ORDER, Array(
+                    'type_payment' => wpsg_q($_REQUEST['add_payment']),
+                    'type_shipping' => wpsg_q($_REQUEST['add_shipping']),
+                    'price_frontend' => $this->shop->getFrontendTaxview(),
+                    'cdate' => 'NOW()',
+                    'adress_id' => wpsg_q($oCustomer->adress_id),
+                    'k_id' => wpsg_q($customer_id)                    
+                ));
+                                                 
+                $onr = $this->shop->buildONR($order_id, $customer_id,$oCustomer->getNr());
+                
+                $this->db->UpdateQuery(WPSG_TBL_ORDER, Array(
+                    'onr' => wpsg_q($onr) 
+                ), " `id` = '".wpsg_q($order_id)."' ");
+                
+                $this->db->ImportQuery(WPSG_TBL_OL, Array(
+                    'o_id' => wpsg_q($order_id),
+                    'cdate' => 'NOW()',
+                    'title' => __('Bestellung im Backend angelegt.', 'wpsg'),
+                    'mailtext' => ''
+                ));
+                
+                $this->addBackendMessage(__('Die neue Bestellung wurde vorbereitet.', 'wpsg'));
+                
+                $this->redirect(WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Order&action=view&edit_id='.$order_id);
+                                
+            }
+            
+            exit;
+		    
+        } // public function addAction()
+        
 		/**
 		 * Wird aufgerufen wenn die Produkte bearbeitet werden
@@ -977,5 +1141,132 @@
 		public function viewAction()
 		{
-
+		    
+		    if (wpsg_isSizedString($_REQUEST['subaction'], 'removeProduct')) {
+
+                $oCalculation = new \wpsg\wpsg_calculation();
+                $oCalculation->fromDB($_REQUEST['edit_id']);
+
+                $oCalculation->removeProduct($_REQUEST['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)
+                ]);
+
+            } else if (wpsg_isSizedString($_REQUEST['subaction'], 'editDiscount')) {
+
+		        $this->shop->view['oCalculation'] = new \wpsg\wpsg_calculation();
+                $this->shop->view['oCalculation']->fromDb($_REQUEST['edit_id']);
+		        
+                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, $_REQUEST['be_discount_tax'], $_REQUEST['be_discount_amount']);
+
+                    $this->shop->view['oCalculation']->toDB($_REQUEST['edit_id']);
+
+                    wpsg_header::JSONData([
+                        'product_table' => $this->shop->render(WPSG_PATH_VIEW.'order/product_table.phtml', false)
+                    ]);
+                    
+                }
+                
+                $this->shop->render(WPSG_PATH_VIEW.'/order/backendEdit/addDiscount.phtml');
+
+                exit;
+		        
+            } else if (wpsg_isSizedString($_REQUEST['subaction'], 'addProduct')) {
+
+		        if (wpsg_isSizedString($_REQUEST['do'], 'search')) {
+
+                    $arReturn = [];
+
+                    $arProduct = wpsg_product::find(Array('s' => $_REQUEST['term']));
+
+                    /** @var wpsg_product $oProduct */
+                    foreach ($arProduct as $oProduct) {
+
+                        $arReturn[] = Array(
+                            'id' => $oProduct->id,
+                            'value' => $oProduct->getProductName()
+                        );
+
+                    }
+
+                    wpsg_header::JSONData($arReturn);
+
+                    exit;
+                                    
+                } else if (wpsg_isSizedString($_REQUEST['do'], 'product')) {
+
+		            if (wpsg_isSizedInt($_REQUEST['product_id'])) {
+
+                        $this->shop->view['oProduct'] = wpsg_product::getInstance($_REQUEST['product_id']);
+		                
+                    }
+		            
+		            if (wpsg_isSizedInt($_REQUEST['order_product_id'])) {
+		                
+		                $this->shop->view['oOrderProduct'] = wpsg_order_product::getInstance($_REQUEST['order_product_id']);
+
+                        if (!wpsg_isSizedInt($_REQUEST['product_id'])) $this->shop->view['oProduct'] = $this->shop->view['oOrderProduct']->getProduct();
+		                
+                    } else {
+		             
+		                $this->shop->view['oOrderProduct'] = false;
+		                
+                    }
+		            
+                    $this->shop->render(WPSG_PATH_VIEW.'/order/backendEdit/addProduct_product_selected.phtml');
+
+                    exit;
+		            
+                } else if (wpsg_isSizedString($_REQUEST['do'], 'submit')) {
+
+                    $oCalculation = new \wpsg\wpsg_calculation();
+                    $oCalculation->fromDB($_REQUEST['edit_id']);
+
+                    $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)
+                    ]);
+		            
+                }
+		        
+                $this->shop->render(WPSG_PATH_VIEW.'/order/backendEdit/addProduct.phtml');
+
+                exit;
+		        
+            }
+		   
 			$this->shop->view['data'] = $this->db->fetchRow("
 				SELECT
@@ -998,17 +1289,25 @@
 			$this->shop->view['oOrder'] = wpsg_order::getInstance($_REQUEST['edit_id']);
 
-			$custom_data = @unserialize($this->shop->view['data']['custom_data']);
-
 			$basket = new wpsg_basket();
 			$basket->initFromDB($this->shop->view['data']['id'], true);
 			$this->shop->view['basket'] = $basket->toArray(true);
 
-			$this->shop->view['colspan'] = 3;
-			if ($this->shop->get_option('wpsg_showMwstAlways') == '1' || sizeof($this->shop->view['basket']['mwst']) > 1) $this->shop->view['colspan'] ++;
-
 			$this->shop->view['arPayment'] = $this->shop->arPayment;
 			$this->shop->view['arShipping'] = $this->shop->arShipping;
 
-			$this->shop->view['country'] = $this->db->fetchRow("
+            if (wpsg_isSizedString($_REQUEST['subaction'], 'editPayShipping')) {
+
+                $this->shop->render(WPSG_PATH_VIEW.'/order/backendEdit/editPayShipping.phtml');
+
+                exit;
+
+            }
+            
+            $oCalculation = new \wpsg\wpsg_calculation();
+            $oCalculation->fromDB($this->shop->view['data']['id']);
+
+            $this->shop->view['oCalculation'] = $oCalculation;
+
+            $this->shop->view['country'] = $this->db->fetchRow("
 				SELECT
 					C.`id`, C.`name`, C.`kuerzel`,
@@ -1050,4 +1349,7 @@
 							`id` = '".wpsg_q($this->shop->view['data']['adress_id'])."'
 					");
+			
+            if (!is_array($arAdr)) $arAdr = [];
+            
 			$this->shop->view['data'] = array_merge($this->shop->view['data'], $arAdr);
 
@@ -1056,5 +1358,5 @@
 				$this->shop->callMod('wpsg_mod_orderupload', 'order_view_sidebar', array(&$_REQUEST['edit_id']));
 			}
-
+            
 			$this->shop->view['arSubAction'] = array(
 				'general' => array(
@@ -1101,5 +1403,5 @@
 			else
 			{
-
+                
 				$this->shop->render(WPSG_PATH_VIEW.'/order/view.phtml');
 
Index: /controller/wpsg_ShopController.class.php
===================================================================
--- /controller/wpsg_ShopController.class.php	(revision 7172)
+++ /controller/wpsg_ShopController.class.php	(revision 7173)
@@ -777,5 +777,4 @@
                     // Generierung der CSS Dateien
                     $arFiles = [
-                        'css/frontend.css',
                         'css/style.scss'
                     ];
@@ -814,4 +813,10 @@
                             } catch (\Exception $e) {
 
+                                echo $e->getMessage();
+                                echo "\r\n\r\n";
+                                echo $e->getTraceAsString ();
+
+                                exit;
+                                
                             }
 
@@ -865,4 +870,5 @@
 
 				wp_enqueue_script('jquery-ui-core');
+                wp_enqueue_script('jquery-ui-autocomplete');
 				wp_enqueue_script('jquery-ui-dialog');
 				wp_enqueue_script('jquery-ui-sortable');
@@ -907,5 +913,5 @@
 				if ($this->get_option('wpsg_load_bootstrap_glyphfont_css') == '1') wp_enqueue_style('wpsg-bscss', $GLOBALS['wpsg_sc']->getRessourceURL('js/bootstrap-3.3.6-dist/css/bootstrap-glyphfont.css'));
 
-				//if ($this->get_option('wpsg_load_css') != '1') wp_enqueue_style('wpsg-frontendstyle', $this->getRessourceURL('css/frontend.css'));
+				if ($this->get_option('wpsg_load_css') != '1') wp_enqueue_style('wpsg-frontendstyle', $this->getRessourceURL('css/frontend.css'));
                 if ($this->get_option('wpsg_load_css') != '1') wp_enqueue_style('wpsg-frontendstyle', '/?wpsg_scss');
 				
@@ -1806,4 +1812,5 @@
 		 * Gibt das Standardland als wpsg_country Objekt zurÃŒck
 		 * @param $id bool Wenn true dann wird nur die ID zurÃŒckgegeben fÃŒr schnelle Vergleiche
+         * @return wpsg_country
 		 */
 		public function getDefaultCountry($id = false)
Index: /controller/wpsg_SystemController.class.php
===================================================================
--- /controller/wpsg_SystemController.class.php	(revision 7172)
+++ /controller/wpsg_SystemController.class.php	(revision 7173)
@@ -332,5 +332,5 @@
 		public function hasFrontendError() { return wpsg_isSizedArray($_SESSION['wpsg']['frontendError']); }
 		
-		public function hasBackendError() { return wpsg_isSizedArray($_SESSION['wpsg']['backendError']); }
+		public function hasBackendError() { $arE = $_SESSION['wpsg']['backendError']; unset($arE['wpsg_systemcheck']); return wpsg_isSizedArray($arE); }
 		
 		/**
Index: /lib/filter_functions.inc.php
===================================================================
--- /lib/filter_functions.inc.php	(revision 7172)
+++ /lib/filter_functions.inc.php	(revision 7173)
@@ -414,5 +414,5 @@
         {
     
-            wpsg_debug('wpsgApiReturn: '.$func.":".$api_return);
+            //wpsg_debug('wpsgApiReturn: '.$func.":".$api_return);
             return false;
     
Index: /lib/functions.inc.php
===================================================================
--- /lib/functions.inc.php	(revision 7172)
+++ /lib/functions.inc.php	(revision 7173)
@@ -346,5 +346,5 @@
 	}
 
-	function wpsg_tax_groups($noRata = false)
+	function wpsg_tax_groups($noRata = false, $noSuffix = false)
 	{
 		
@@ -358,5 +358,6 @@
 		);
 		
-		if ($noRata === true) unset($arTaxGroups[0]);
+		if ($noRata === true) unset($arTaxGroups[0]);		
+		if ($noSuffix === true) return $arTaxGroups;
 		
 		foreach ($arTaxGroups as $tax_key => &$tax_label)
Index: /lib/install.php
===================================================================
--- /lib/install.php	(revision 7172)
+++ /lib/install.php	(revision 7173)
@@ -116,4 +116,6 @@
    		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,
@@ -128,4 +130,6 @@
    		price_rabatt_netto DOUBLE(10,4) NOT NULL,
    		price_rabatt_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,
Index: /lib/wpsg_basket.class.php
===================================================================
--- /lib/wpsg_basket.class.php	(revision 7172)
+++ /lib/wpsg_basket.class.php	(revision 7173)
@@ -333,4 +333,22 @@
 		}
 
+        /**
+         * Wandelt die Daten des Basket in die neue Klasse zur Berechnung
+         * @return wpsg\wpsg_calculation
+         */
+		public function toCalculation() {
+		    
+		    $b = new \wpsg\wpsg_calculation();
+		    
+		    foreach ($this->arProdukte as $p) {
+		        
+		        $b->addProduct($p['productkey'], $p['product_index'], $p['preis_netto'], $p['menge'], $p['op_mwst_key'], $p['order_product_id']);
+		          
+            }
+            
+            return $b;
+		    
+        }
+		
 		/**
 		 * Initiiert den Basket aus der Datenbank
@@ -819,4 +837,6 @@
 					'useragent' 		=> wpsg_q($_SERVER['HTTP_USER_AGENT']),
 					'comment' 			=> wpsg_q(wpsg_getStr($this->arCheckout['comment'])),
+					'shipping_tax_key' => wpsg_q($this->shop->arShipping[$this->arCheckout['shipping']]['mwst']),
+					'payment_tax_key' => wpsg_q($this->shop->arPayment[$this->arCheckout['payment']]['mwst']),
 					'price_gesamt' 		=> wpsg_tf(round($arBasket['sum']['preis_gesamt_brutto'], 2)),
 					'price_gesamt_netto' 		=> wpsg_tf(round($arBasket['sum']['preis_gesamt_netto'], 2)),
Index: /lib/wpsg_calculation.class.php
===================================================================
--- /lib/wpsg_calculation.class.php	(revision 7173)
+++ /lib/wpsg_calculation.class.php	(revision 7173)
@@ -0,0 +1,646 @@
+<?php
+
+    namespace wpsg;
+
+    /**
+     * Neue Klasse zur Berechnung des Warenkorbes
+     * Soll die alte basket Klasse ersetzen
+     * 
+     */
+    class wpsg_calculation {
+
+        /**
+         * @var wpsg_db
+         */
+        private $db = null;
+
+        /**
+         * @var \wpsg_ShopController
+         */
+        private $shop = null;
+
+        /**
+         * @var null 
+         */
+        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;
+        
+        public function __construct() {
+            
+            $this->db = &$GLOBALS['wpsg_db'];
+            $this->shop = &$GLOBALS['wpsg_sc'];
+            
+            $this->oCountry = $this->shop->getDefaultCountry();
+            
+        }        
+        
+        /** 
+         * Setzt das Standardland fÃŒr die Steuerberechnung wenn im $tax_key kein Land definiert ist 
+         */
+        public function setCountry($oCountry) {
+            
+            $this->oCountry = $oCountry;
+            
+        }
+        
+        public function removeDiscount() {
+            
+            $this->arDiscount = null;
+            
+        }
+        
+        public function addDiscount($discount_value, $discount_tax_key, $discount_set) {
+            
+            $this->arDiscount = [
+                [
+                    'set' => $discount_set,
+                    'value' => $discount_value,
+                    'tax_key' => $this->normalizeTaxKey($discount_tax_key)
+                ]
+            ];
+                        
+        }
+        
+        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]);
+                
+            }
+            
+        }
+        
+        /**
+         * Setzt die Versandkosten
+         */
+        public function setShipping($key, $netto, $tax_key) {
+
+            $tax_key = $this->normalizeTaxKey($tax_key);
+            
+            $this->shipping = [
+                'key' => $key,
+                'netto' => $netto,
+                'brutto' => 0,
+                'tax_key' => $tax_key
+            ];
+                         
+        }
+
+        /**
+         * 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.'));
+
+            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
+                ];
+
+                $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']);
+
+                }
+
+                $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);
+            
+            }
+                
+            return $this->arCalculation;
+
+        }
+
+        /**
+         * Speichert die Berechnung in eine Bestellung
+         * 
+         * @param bool $id
+         */
+        public function toDB($id = false, $db_data = []) {
+           
+            $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'];
+                    
+                }
+                    
+            }
+                        
+            if (wpsg_isSizedInt($id)) {
+                
+                $this->db->UpdateQuery(WPSG_TBL_ORDER, $db_data, " `id` = '".wpsg_q($id)."' ");
+                
+            }  else {
+                
+                $id = $this->db->ImportQuery(WPSG_TBL_ORDER, $db_data);
+                
+                // TODO: Land zuweisen und speichern
+                
+            }
+
+            $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']),
+                    '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);
+                    
+                }
+                
+            }
+            
+            if (wpsg_isSizedArray($arOrderProductID)) {
+                
+                $this->db->Query("DELETE FROM `".WPSG_TBL_ORDERPRODUCT."` WHERE `o_id` = '".wpsg_q($id)."' AND `id` NOT IN (".wpsg_q(implode(',', $arOrderProductID)).") ");
+                
+            }
+                
+            return $id;
+            
+        } // public function toDB($id = false)
+
+        public function fromDB($id) {
+            
+            $db_order = $this->db->fetchRow("SELECT O.*, A.`land` FROM `".WPSG_TBL_ORDER."` AS O LEFT JOIN `".WPSG_TBL_ADRESS."` AS A ON (O.`adress_id` = A.`id`) WHERE O.`id` = '".wpsg_q($id)."' ");
+            $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']);
+            
+            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']);
+                
+            }
+            
+            // Rabatte
+            if (wpsg_tf($db_order['price_rabatt_netto']) > 0) {
+                
+                $this->addDiscount($db_order['price_rabatt_netto'], $db_order['discount_tax_key'], $db_order['discount_set']);
+                
+            }
+            
+            
+        } // 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() {
+            
+            $max_index = 0;
+            
+            foreach ($this->arProducts as $p) {
+                
+                $max_index = max($max_index, $p['product_index']);
+                
+            }
+            
+            return max($max_index, sizeof($this->arProducts) - 1);
+            
+        }
+        
+        /* 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];            
+            
+            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 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) {
+                    
+                    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;
+                    
+                }
+                                
+            }
+                 
+            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']['product_brutto'] += $this->arCalculation['products'][$k]['brutto'] * $this->arCalculation['products'][$k]['amount'];
+                
+            }
+
+            // 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
+            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);
+                
+            }
+            
+        }
+
+        /**
+         * Im Array sollen die Tax SchlÃŒssel immer mit Land gespeichert sein
+         */
+        private function normalizeTaxKey($tax_key) {
+
+            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 (!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,
+                    'netto' => $price_netto,
+                    'brutto' => 0,
+                    'tax_value' => $tax_value,
+                    'sum_tax' => 0
+                ];
+                
+            } else {
+                
+                $this->arCalculation['tax'][$tax_key]['netto'] += $price_netto;
+                
+            }
+            
+        }
+
+    }
+         
+         
Index: /lib/wpsg_exceptionhandler.class.php
===================================================================
--- /lib/wpsg_exceptionhandler.class.php	(revision 7172)
+++ /lib/wpsg_exceptionhandler.class.php	(revision 7173)
@@ -55,5 +55,5 @@
             $backtrace = ob_get_contents();
             ob_end_clean();
-            
+         
             $strLogText .= str_pad('', 120, '-')."\r\n";
 
Index: /model/wpsg_order_product.class.php
===================================================================
--- /model/wpsg_order_product.class.php	(revision 7172)
+++ /model/wpsg_order_product.class.php	(revision 7173)
@@ -108,4 +108,18 @@
 
         }
+        
+        public function getPrice($tax_view = WPSG_NETTO) {
+		    
+		    if ($tax_view === WPSG_BRUTTO) {
+		        
+		        return $this->price_brutto;
+		        
+            } else {
+		        
+		        return $this->price_netto;
+		        
+            }
+		    
+        }
 
 		public function getProductKey()
Index: /mods/wpsg_mod_abo.class.php
===================================================================
--- /mods/wpsg_mod_abo.class.php	(revision 7172)
+++ /mods/wpsg_mod_abo.class.php	(revision 7173)
@@ -880,5 +880,5 @@
 			{
 
-				$product_data = $this->shop->cache->loadProduct($this->shop->getProduktID($p['id']));
+				$product_data = $this->shop->cache->loadProduct($p['product_id']);
 
 				if ($product_data['wpsg_mod_abo_activ'] == '1')
Index: /mods/wpsg_mod_downloadprodukte.class.php
===================================================================
--- /mods/wpsg_mod_downloadprodukte.class.php	(revision 7172)
+++ /mods/wpsg_mod_downloadprodukte.class.php	(revision 7173)
@@ -98,5 +98,5 @@
 		{
 
-			$arFiles = $this->getProdFiles($this->shop->getProduktId($p['productkey']));
+			$arFiles = $this->getProdFiles($this->shop->getProduktId($p['product_key']));
 			
 			if (wpsg_isSizedArray($arFiles))
Index: /mods/wpsg_mod_productvariants.class.php
===================================================================
--- /mods/wpsg_mod_productvariants.class.php	(revision 7172)
+++ /mods/wpsg_mod_productvariants.class.php	(revision 7173)
@@ -458,7 +458,7 @@
         {
 
-            if (!preg_match('/pv_(.*)/', $p['id'])) return;
-
-            $this->shop->view['variante'] = $this->getVariantenInfoArray($p['id']);
+            if (!preg_match('/pv_(.*)/', $p['product_key'])) return;
+
+            $this->shop->view['variante'] = $this->getVariantenInfoArray($p['product_key']);
             $this->shop->view['i'] = $i;
 
Index: /mods/wpsg_mod_versandarten.class.php
===================================================================
--- /mods/wpsg_mod_versandarten.class.php	(revision 7172)
+++ /mods/wpsg_mod_versandarten.class.php	(revision 7173)
@@ -367,5 +367,5 @@
 					
 				}
-				
+				 
 				if ($arBasket['noMwSt'] == '1') $shipping_brutto = $shipping_netto;
 								 
Index: /system/tests/wpsg_calculationTestTest.php
===================================================================
--- /system/tests/wpsg_calculationTestTest.php	(revision 7173)
+++ /system/tests/wpsg_calculationTestTest.php	(revision 7173)
@@ -0,0 +1,85 @@
+<?php
+
+    /**
+     * User: Daschmi (daschmi@daschmi.de)
+     * Date: 26.09.2018
+     * Time: 13:29
+     */
+           
+    class wpsg_calculationTestTest extends \PHPUnit_Framework_TestCase {
+
+        /**
+         * @beforeClass
+         */
+        public function setupSomeFixtures()
+        {
+
+            session_start();
+
+            error_reporting(E_ERROR);
+            ini_set("display_errors", "1");
+
+            require_once(dirname(__FILE__).'/../../../../../wp-load.php');
+            require_once(dirname(__FILE__).'/../../wpshopgermany.php');
+            
+        }
+        
+        /** 
+         * @runInSeparateProcess
+         */
+        public function testBasket1Test() {
+
+            
+            
+            $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->assertEquals(
+                400,
+                $ar['sum']['sum_netto']                
+            );
+
+            $this->assertEquals(
+                460,
+                $ar['sum']['sum_brutto']                
+            );
+            
+        }
+
+        /**  
+         * @runInSeparateProcess
+         */
+        public function testBasket2Test() {
+ 
+            $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->assertEquals(
+                400,
+                $ar['sum']['sum_netto']
+            );
+
+            $this->assertEquals(
+                460,
+                $ar['sum']['sum_brutto']
+            );
+
+        }
+
+    }
Index: /views/css/style.scss
===================================================================
--- /views/css/style.scss	(revision 7172)
+++ /views/css/style.scss	(revision 7173)
@@ -1,1 +1,0 @@
-body 
Index: /views/mods/mod_deliverynote/order_view_row.phtml
===================================================================
--- /views/mods/mod_deliverynote/order_view_row.phtml	(revision 7172)
+++ /views/mods/mod_deliverynote/order_view_row.phtml	(revision 7173)
@@ -7,8 +7,8 @@
 ?>
 <tr class="wpsg_<?php echo (($this->view['wpsg_mod_deliverynote']['i'] == 0)?'odd':'even'); ?>">	
-	<td align="left" colspan="<?php echo ((sizeof($this->view['basket']['mwst']) > 1 || $this->get_option('wpsg_showMwstAlways') == '1')?'5':'4'); ?>">
-		<label>		
-			<input checked="checked" type="checkbox" class="wpsg_mod_deliverynote_product" name="wpsg_mod_deliverynote_products[]" value="<?php echo $this->view['wpsg_mod_deliverynote']['product']['product_index']; ?>" />
-			&nbsp;<?php echo __('Auf Lieferschein', 'wpsg'); ?>
+	<td align="left" colspan="<?php echo ((sizeof($this->view['arCalculation']['tax']) > 1 || $this->get_option('wpsg_showMwstAlways') == '1')?'5':'4'); ?>">
+		<label style="font-weight:normal; display:flex; flex-direction:row; margin-bottom:0px;">		
+			<input checked="checked" type="checkbox" class="wpsg_mod_deliverynote_product" name="wpsg_mod_deliverynote_products[]" value="<?php echo $this->view['wpsg_mod_deliverynote']['product']['product_index']; ?>" style="margin:0px; margin-right:5px;" />
+            <span>&nbsp;<?php echo __('Auf Lieferschein', 'wpsg'); ?></span>
 		</label>
 	</td>
Index: /views/mods/mod_deliverynote/settings_edit.phtml
===================================================================
--- /views/mods/mod_deliverynote/settings_edit.phtml	(revision 7172)
+++ /views/mods/mod_deliverynote/settings_edit.phtml	(revision 7173)
@@ -143,5 +143,5 @@
 
 			<div class="info">
-				<p style="line-height:none;">
+				<p>
 					<?php echo __('Die Angaben fÃŒr X (Abstand von Links) und Y (Abstand von Oben) werden in mm eingetragen.', 'wpsg'); ?><br />
 					<?php echo __('Die Farbe wird im Hexadezimalformat angegeben (#FFFFFF fÃŒr weiÃ, #000000 fÃŒr schwarz).', 'wpsg'); ?>
@@ -163,5 +163,5 @@
 
 			<div class="info">
-				<p style="line-height:none;">
+				<p>
 					<?php echo __('Hier kÃ¶nnen Sie Texte vordefinieren, die sie unter den Lieferschein setzen kÃ¶nnen.', 'wpsg'); ?>
 				</p>
@@ -229,5 +229,5 @@
 	{
 
-		let url = "<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_deliverynote&do=orderAjax&noheader=1&wpsg_deliverynote_preview=1";
+		var url = "<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_deliverynote&do=orderAjax&noheader=1&wpsg_deliverynote_preview=1";
 
 		window.open(url, '_blank');
Index: /views/mods/mod_downloadprodukte/order_view_row.phtml
===================================================================
--- /views/mods/mod_downloadprodukte/order_view_row.phtml	(revision 7172)
+++ /views/mods/mod_downloadprodukte/order_view_row.phtml	(revision 7173)
@@ -8,7 +8,7 @@
 <tr class="wpsg_<?php echo ((wpsg_getInt($this->view['i']) == 0)?'odd':'even'); ?>">
 	<td ><?php echo __('Downloads', 'wpsg'); ?>:</td>
-	<td align="right" colspan="<?php echo ((sizeof($this->view['basket']['mwst']) > 1 || $this->get_option('wpsg_showMwstAlways') == '1')?'4':'3'); ?>">	
+	<td align="right" colspan="<?php echo ((sizeof($this->view['arCalculation']['tax']) > 1 || $this->get_option('wpsg_showMwstAlways') == '1')?'4':'3'); ?>">	
 		 <?php foreach ($this->view['wpsg_mod_downloadprodukte']['arFiles'] as $file) { ?>
-		 <a target="_new" href="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Produkt&action=ajax&mod=wpsg_mod_downloadprodukte&noheader=1&cmd=download_file&file=<?php echo rawurlencode(basename($file[1])); ?>&edit_id=<?php echo $this->getProduktId($this->view['wpsg_mod_downloadprodukte']['product']['productkey']); ?>"><?php echo basename($file[1]); ?></a>
+		 <a target="_new" href="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Produkt&action=ajax&mod=wpsg_mod_downloadprodukte&noheader=1&cmd=download_file&file=<?php echo rawurlencode(basename($file[1])); ?>&edit_id=<?php echo $this->getProduktId($this->view['wpsg_mod_downloadprodukte']['product']['product_key']); ?>"><?php echo basename($file[1]); ?></a>
 		 <?php } ?>
 	</td>
Index: /views/mods/mod_productvariants/order_view_row.phtml
===================================================================
--- /views/mods/mod_productvariants/order_view_row.phtml	(revision 7172)
+++ /views/mods/mod_productvariants/order_view_row.phtml	(revision 7173)
@@ -13,5 +13,5 @@
         <?php echo __('Variante', 'wpsg'); ?>:
     </td>
-    <td class="wpsg_cell_gesamtpreis" colspan="<?php echo ((sizeof($this->view['basket']['mwst']) > 1 || $this->get_option('wpsg_showMwstAlways') == '1')?4:3); ?>">
+    <td class="wpsg_cell_gesamtpreis" colspan="<?php echo ((sizeof($this->view['arCalculation']['tax']) > 1 || $this->get_option('wpsg_showMwstAlways') == '1')?4:3); ?>">
         <?php echo $this->view['variante']['key']; ?>
     </td>
Index: /views/order/add.phtml
===================================================================
--- /views/order/add.phtml	(revision 7173)
+++ /views/order/add.phtml	(revision 7173)
@@ -0,0 +1,9 @@
+<?php
+
+    /**
+     * Template fÃŒr das Anlegen einer Bestellung
+     */
+    
+    
+     
+     
Index: /views/order/backendEdit/addDiscount.phtml
===================================================================
--- /views/order/backendEdit/addDiscount.phtml	(revision 7173)
+++ /views/order/backendEdit/addDiscount.phtml	(revision 7173)
@@ -0,0 +1,33 @@
+<?php
+    
+    /**
+     * Template fÃŒr das Bearbeiten eines Rabattes im Backend
+     */
+  
+    namespace wpsg;
+    
+    /** @var wpsg_calculation $oCalculation */
+    $oCalculation = $this->view['oCalculation'];
+    
+    $arTax = $oCalculation->getTaxLabelArray();
+    
+    if ($this->getBackendTaxView() === WPSG_NETTO) $strBN = 'NETTO';
+    else $strBN = 'BRUTTO';
+    
+    $arCalculation = $oCalculation->getCalculationArray();
+    
+?>
+
+<form id="wpsg_be_discount_form">
+
+    <?php echo wpsg_drawForm_Input('be_discount_amount', wpsg_translate(__('Rabattwert in #1# (#2#) oder % ', 'wpsg'), $this->get_option('wpsg_currency'), $strBN), @$arCalculation['discount'][0]['set']); ?>
+    <?php echo wpsg_drawForm_Select('be_discount_tax', __('Steuersatz', 'wpsg'), $arTax, @$arCalculation['discount'][0]['tax_key']); ?>
+
+</form>
+
+<script>
+    
+    jQuery('#wpsg_be_discount_form').on('submit', function() { return false; } );
+    jQuery('#be_discount_amount').focus();
+    
+</script>
Index: /views/order/backendEdit/addProduct.phtml
===================================================================
--- /views/order/backendEdit/addProduct.phtml	(revision 7173)
+++ /views/order/backendEdit/addProduct.phtml	(revision 7173)
@@ -0,0 +1,79 @@
+<?php
+        
+    /**
+     * Template fÃŒr das hinzufÃŒgen von Produkten zur Bestellung
+     */
+         
+?>
+
+<style>
+    
+    #product_search { width:100%; }
+    
+</style>
+
+<form id="wpsg_product_add_form">
+    
+    <div class="autocomplete_wrap">
+        <input type="text" id="product_search" name="product_serch" value="" placeholder="<?php echo __('Produktsuche', 'wpsg'); ?>" />
+    </div>
+    
+    <hr />
+    
+    <div id="wpsg_product_add_target">
+        
+    </div>
+    
+</form>
+
+<script>
+    
+    function wpsg_loadProduct(product_id, order_product_id) {
+
+        jQuery('#wpsg_product_add_target').html('<img src="<?php echo WPSG_URL; ?>views/gfx/ajax-loader.gif" alt="<?php echo __('Bitte warten ...', 'wpsg'); ?>" />');
+        
+        jQuery.ajax( {
+            url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Order&action=view&subaction=addProduct&do=product&noheader=1&edit_id=<?php $_REQUEST['edit_id']; ?>',
+            data: {
+                product_id: product_id,
+                order_product_id: order_product_id
+            },
+            success: function(data) {
+
+                jQuery('#wpsg_product_add_target').html(data);
+
+            }
+        } );
+        
+    } // function wpsg_loadProduct(product_id, order_product_id)
+    
+    jQuery(document).ready(function() {
+
+        jQuery('#wpsg_product_add_form').on('submit', function() { return false; } );
+        
+        jQuery('#product_search').autocomplete( {
+            source: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Order&action=view&subaction=addProduct&do=search&noheader=1&edit_id=<?php echo $_REQUEST['edit_id']; ?>',
+            minLength: 2,
+            appendTo: ".autocomplete_wrap",
+            select: function(event, ui) {
+
+                wpsg_loadProduct(ui.item.id, <?php echo ((wpsg_isSizedInt($_REQUEST['order_product_id']))?$_REQUEST['order_product_id']:0); ?>);
+
+                return false;
+
+            }
+        } );
+        
+        <?php if (wpsg_isSizedInt($_REQUEST['order_product_id'])) { ?>
+        
+            wpsg_loadProduct(0, <?php echo $_REQUEST['order_product_id']; ?>);
+        
+        <?php } else { ?>
+            
+            jQuery('#product_search').focus();
+            
+        <?php } ?>
+        
+    } );
+    
+</script>
Index: /views/order/backendEdit/addProduct_product_selected.phtml
===================================================================
--- /views/order/backendEdit/addProduct_product_selected.phtml	(revision 7173)
+++ /views/order/backendEdit/addProduct_product_selected.phtml	(revision 7173)
@@ -0,0 +1,72 @@
+<?php
+    
+    /**
+     * Template fÃŒr das hinzufÃŒgen eines Produktes wenn das Produkt ausgewÃ€hlt wurde
+     */
+             
+    /** @var wpsg_product $oProduct */
+    $oProduct = $this->view['oProduct'];
+
+    /** @var wpsg_order_product $oOrderProduct */
+    $oOrderProduct = $this->view['oOrderProduct'];
+        
+?>
+
+<style>
+    
+    .wpsg_product_add { position:relative; min-height:150px; }
+    .wpsg_product_add .image { position:absolute; left:0px; top:10px; }
+    
+</style>
+
+<strong><?php echo $oProduct->getProductName(); ?></strong>
+
+<div class="wpsg_product_add">
+
+    <input type="hidden" name="product_id" value="<?php echo $oProduct->id; ?>" />
+    
+    <?php if ($oOrderProduct !== false) { ?>
+    <input type="hidden" name="order_product_id" value="<?php echo $oOrderProduct->id; ?>" />
+    <?php } ?>
+    
+    <?php
+
+        $attachment_id = $GLOBALS['wpsg_sc']->imagehandler->getAttachmentID($oProduct->id);
+        
+    ?>
+    
+    <?php if (wpsg_isSizedInt($attachment_id)) { ?>
+    <div class="image"><?php echo wp_get_attachment_image($attachment_id, [100, 100]); ?></div>
+    <?php } ?>
+    
+    <?php echo wpsg_drawForm_Input('add_price', __('Produktpreis', 'wpsg').' '.(($this->getBackendTaxView() === WPSG_BRUTTO)?'(BRUTTO)':'(NETTO'), (($oOrderProduct !== false)?$oOrderProduct->getPrice($this->getBackendTaxView()):$oProduct->getPrice($this->getBackendTaxView()))); ?>
+    <?php echo wpsg_drawForm_Input('add_amount', __('Menge', 'wpsg'), (($oOrderProduct !== false)?$oOrderProduct->getCount():'1')); ?>
+    
+    <?php if ($this->callMod('wpsg_mod_productvariants', 'isVariantsProduct', [$oProduct->id])) { $arVariants = $this->callMod('wpsg_mod_productvariants', 'getVariants', [$oProduct->id, true, true, true]); ?> 
+        
+        <?php if (wpsg_isSizedArray($arVariants)) { ?>
+                
+            <br />
+            
+            <?php foreach ($arVariants as $var_id => $var_data) { 
+                
+                    $arVariSelect = [];
+                    foreach ($var_data['arVariation'] as $vari_id => $vari_data) $arVariSelect[$vari_id] = $vari_data['name'];
+                
+                ?>
+            
+                <?php echo wpsg_drawForm_Select('wpsg_vp['.$var_id.']', $var_data['name'], $arVariSelect,''); ?>
+                
+            <?php } ?>
+        
+        <?php } ?>
+        
+    <?php } ?> 
+    
+    <script>
+
+        jQuery('#wpsg_product_dialog .btn-primary').prop('disabled', false);
+        
+    </script>
+
+</div>
Index: /views/order/backendEdit/editPayShipping.phtml
===================================================================
--- /views/order/backendEdit/editPayShipping.phtml	(revision 7173)
+++ /views/order/backendEdit/editPayShipping.phtml	(revision 7173)
@@ -0,0 +1,108 @@
+<?php
+
+    /**
+     * Template fÃŒr das Bearbeiten der Versand- und Zahlungsart im Backend
+     */
+
+    $arShippingSelect = [];
+    foreach ($this->arShipping as $shipping_id => $shipping_data) {
+        
+        $arShippingSelect[$shipping_id] = $shipping_data['name'];
+        
+        if (wpsg_isSizedDouble($shipping_data['price'])) {
+
+            $arShippingSelect[$shipping_id] .= ' ('.wpsg_ff($shipping_data['price'],$this->get_option('wpsg_currency')).')';
+            
+        }
+        
+    }
+
+    $arPaymentSelect = [];
+    foreach ($this->arPayment as $payment_id => $payment_data) {
+
+        $arPaymentSelect[$payment_id] = $payment_data['name'];
+    
+        if (wpsg_isSizedDouble($payment_data['preis'])) {
+
+            $arPaymentSelect[$payment_id] .= ' ('.wpsg_ff($payment_data['preis'],$this->get_option('wpsg_currency')).')';
+    
+        }
+    
+    }
+    
+    if ($this->getBackendTaxview() === WPSG_BRUTTO) {
+        
+        $price_shipping = wpsg_ff($this->view['data']['price_shipping_brutto'], $this->get_option('wpsg_currency'));
+        $price_payment = wpsg_ff($this->view['data']['price_payment_brutto'], $this->get_option('wpsg_currency'));
+        
+        $price_suffix = ' ('.__('Brutto', 'wpsg').')';
+        
+    } else {
+
+        $price_shipping = wpsg_ff($this->view['data']['price_shipping_brutto'], $this->get_option('wpsg_currency'));
+        $price_payment = wpsg_ff($this->view['data']['price_payment_brutto'], $this->get_option('wpsg_currency'));
+
+        $price_suffix = ' ('.__('Netto', 'wpsg').')';
+        
+    }
+        
+?>
+
+<div id="editPayShipping">
+    
+    <?php echo wpsg_drawForm_Select('edit_shipping_type', __('Versandart', 'wpsg'), $arShippingSelect,$this->view['data']['type_shipping']); ?>
+    <?php echo wpsg_drawForm_Input('edit_shipping_price', __('Kosten', 'wpsg').$price_suffix, $price_shipping);  ?> 
+    
+    <br />
+
+    <?php echo wpsg_drawForm_Select('edit_payment_type', __('Zahlungsart', 'wpsg'), $arPaymentSelect,$this->view['data']['type_payment']); ?>
+    <?php echo wpsg_drawForm_Input('edit_payment_price', __('Kosten', 'wpsg').$price_suffix, $price_payment);  ?>
+
+</div>
+
+<script>
+
+   var arShipping = <?php echo json_encode($this->arShipping); ?>;
+   var arPayment = <?php echo json_encode($this->arPayment); ?>;
+       
+   jQuery('#edit_shipping_type').on('change', function() {
+ 
+       for (var i in arShipping) {
+           
+           if (i == jQuery(this).val()) {
+               
+                var price = parseFloat(jQuery('#edit_shipping_price').val().replace('EUR', '').replace(',', '.'));
+                                
+                if (isNaN(price) || price <= 0) {
+                 
+                    jQuery('#edit_shipping_price').val(wpsg_number_format(arShipping[i].price, 2, ',') + ' <?php echo $this->get_option('wpsg_currency'); ?>');
+                    
+                }
+                
+           }
+           
+       }
+       
+   } ).change();
+
+   jQuery('#edit_payment_type').on('change', function() {
+
+       for (var i in arPayment) {
+
+           if (i == jQuery(this).val()) {
+
+               var price = parseFloat(jQuery('#edit_payment_price').val().replace('EUR', '').replace(',', '.'));
+
+               if (isNaN(price) || price <= 0) {
+
+                   jQuery('#edit_payment_price').val(wpsg_number_format(arPayment[i].preis, 2, ',') + ' <?php echo $this->get_option('wpsg_currency'); ?>');
+
+               }
+
+           }
+
+       }
+
+   } ).change();
+   
+</script>
Index: /views/order/index.phtml
===================================================================
--- /views/order/index.phtml	(revision 7172)
+++ /views/order/index.phtml	(revision 7173)
@@ -24,4 +24,5 @@
                     <li role="presentation" class="wpsg-order-tab-a wpsg-order-tab-mods" id="wpsg-order-tab-<?php echo $k; ?>"><a href="#" onclick="return false;"><span class="<?php echo $tab['tab_icon']; ?>"></span><?php echo $tab['tab_title']; ?></a></li>
                     <?php } ?>
+                    <li role="presentation" class="wpsg-order-tab-a wpsg-order-tab-mods" id="wpsg-order-tab-add"><a href="#" onclick="return false;"><span class="glyphicon glyphicon-plus"></span><?php echo __("Neue Bestellung", "wpsg"); ?></a></li>
 				</ul>
 				<ul class="nav navbar-nav navbar-right">
@@ -102,4 +103,68 @@
         <?php } ?>
         <?php } ?>
+        
+        <div class="wpsg-order-tab-add-content wpsg-order-tab-add" style="display:none;">
+
+            <div class="container-fluid form-horizontal">
+                <div class="row">
+                    <div class="col-lg-4">
+                        
+                        <form method="POST" id="add_form" action="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Order&subaction=add&noheader=1">
+    
+                            <?php echo wp_nonce_field('order-index-add'); ?>
+                            
+                            <br />
+                            
+                            <?php echo wpsg_drawForm_Input('search_customer',__('Kunde (E-Mail oder Kundennummer', 'wpsg'), @$_REQUEST['search_customer']); ?>
+                            
+                            <br />
+                            
+                            <?php $arShippingSelect = []; foreach ($this->arShipping as $shipping_id => $shipping) $arShippingSelect[$shipping_id] = $shipping['name']; ?>
+                            <?php echo wpsg_drawForm_Select('add_shipping', __('Versandart', 'wpsg'), $arShippingSelect, @$_REQUEST['add_shipping']); ?>
+
+                            <?php $arPaymentSelect = []; foreach ($this->arPayment as $payment_id => $payment) $arPaymentSelect[$payment_id] = $payment['name']; ?>
+                            <?php echo wpsg_drawForm_Select('add_payment', __('Zahlungsart', 'wpsg'), $arPaymentSelect, @$_REQUEST['add_payment']); ?>
+                            
+                            <br /><?php echo wpsg_drawForm_SubmitButton(__('Bestellung anlegen')); ?><br />
+                            
+                            <script>
+                                
+                                jQuery(document).ready(function() {
+                                
+                                    jQuery('#search_customer').autocomplete( {
+                                        source: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Order&subaction=autocomplete&noheader=1',
+                                        minLength: 2,
+                                        select: function(event, ui) {
+                                            
+                                            jQuery('#search_customer').val(ui.item.id);
+                                            
+                                            return false;
+                                            
+                                        }
+                                    } );
+                                
+                                    jQuery('#add_form').on('submit', function() {
+                                        
+                                        if (jQuery.trim(jQuery('#search_customer').val()) === '') {                                            
+                                            
+                                            alert('<?php echo __('Bitte einen Kunden angeben.', 'wpsg'); ?>');
+                                            
+                                            return false;
+                                            
+                                        }
+                                        
+                                    } );
+                                    
+                                } );
+                                
+                            </script>
+                            
+                        </form>
+                        
+                    </div>
+                </div>
+            </div>
+            
+        </div>
     
     </nav>
@@ -360,13 +425,15 @@
 
                 jQuery(this).removeClass('active');
-                jQuery('.' + jQuery(this).attr("id")).slideUp(250);
-
+                jQuery('.' + jQuery(this).attr("id")).slideUp(250); 
+                
             }
             else
             {
-
+                
                 jQuery(this).addClass('active');
                 jQuery('.' + jQuery(this).attr("id")).slideDown(250);
 
+                if (jQuery(this).attr("id") === 'wpsg-order-tab-add') jQuery('#search_customer').focus(); 
+                    
             }
 
Index: /views/order/product_table.phtml
===================================================================
--- /views/order/product_table.phtml	(revision 7173)
+++ /views/order/product_table.phtml	(revision 7173)
@@ -0,0 +1,252 @@
+<?php
+
+/*
+    $oC = new \wpsg\wpsg_calculation();
+    $oC->setCountry(\wpsg_country::getInstance(1));
+    
+    $oC->addProduct('1', 0, '100', '1','c');
+    //$oC->addProduct('1', 1, '100', '1','b');
+    $oC->setShipping('1', '0', '0');
+    $oC->setPayment('1', '0', 'c_1');
+        
+    $oC->addDiscount('10%','c_1');
+    
+    $ar = $oC->getCalculationArray();
+wpsg_debug($ar);*/
+
+    /**
+     * Template fÃŒr die Produkttabelle im Backend der Bestellverwaltung
+     */
+    
+    $arCalculation = $this->view['oCalculation']->getCalculationArray($this->getBackendTaxView()); 
+    $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'] ++;
+    
+    $this->view['arCalculation'] = $arCalculation;
+    
+?>
+
+<style>
+
+    .wpsg_row_small td { font-size:0.8em; }
+    
+</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 /* $gs_id = 0;
+    if ((isset($this->view['basket']['gs'])) && ($this->view['basket']['gs']['value'] > 0)) { ?>
+        <tr class="wpsg_<?php echo (($i % 2 == 0)?'odd':'even'); ?> wpsg_gutschein">
+            <?php
+            $gs_id = 0;
+            if (array_key_exists('gs_id', $_REQUEST))
+            {
+                $gs_id = wpsg_getInt($_REQUEST['gs_id']);
+            }
+            else
+            {
+                $gs_id = wpsg_getInt($this->view['data']['gs_id']);
+            }
+            $o_id = $_REQUEST['edit_id'];
+            $link1 = '<span id="gsname_'.$gs_id.'" class="editable editable-click" data-original-title="" title="">'.$this->view['basket']['gs']['code'].'</span>';
+            $val = '-'.wpsg_ff($this->view['basket']['sum']['gs']);
+            $link2 = '<span id="gsvalue_'.$gs_id.'" class="editable editable-click" data-original-title="" title="">'.$val.'</span>';
+
+            ?>
+            <td class="wpsg_cell_name"><?php echo __('Gutschein', 'wpsg'); ?> <?php echo ($this->view['basket']['gs']['code'] != '')? '('.$link1.')':'' ?>
+                <a href="#" class="wpsg-glyphlink-td" title="<?php echo __('Gutschein lÃ¶schen', 'wpsg'); ?>" onclick="return wpsg_removeVoucher(<?php echo $gs_id; ?>, <?php echo $o_id; ?>);"><span class="glyphicon glyphicon-trash"></span></a>
+            </td>
+            <td class="wpsg_cell_preis"><?php echo $link2.' '.$this->get_option('wpsg_currency'); ?></td>
+            <?php if (sizeof($this->view['basket']['mwst']) > 1 || $this->get_option('wpsg_showMwstAlways') == '1') { ?>
+                <td class="wpsg_cell_mwst"><?php echo __('anteilig', 'wpsg'); ?></td>
+            <?php } ?>
+            <td class="wpsg_cell_menge">1</td>
+            <td class="wpsg_cell_gesamtpreis"><?php echo '-'.wpsg_ff($this->view['basket']['sum']['gs'], $this->get_option('wpsg_currency')); ?></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') { ?>
+                
+                <?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 } ?>
+            </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/order/view.phtml
===================================================================
--- /views/order/view.phtml	(revision 7172)
+++ /views/order/view.phtml	(revision 7173)
@@ -51,16 +51,13 @@
         </div>
 
-		<?php if(true) {?>
-        <a href="" id="LinkProduktNeu" onclick="return WPSG_BE_Product.addProduct(<?php echo $_REQUEST['edit_id']; ?>, 0);"><span class="glyphicon glyphicon-plus"></span>
-	 	<?php echo __("Neues Produkt", "wpsg"); ?>
-	 	</a><br />
-	 	<?php } ?>
-
-        <br />
+        <a href="" id="LinkProduktNeu" onclick="return WPSG_BE_Product.addProduct();"><span class="glyphicon glyphicon-plus"></span>
+    	 	<?php echo __("Neues Produkt", "wpsg"); ?>
+	 	</a><div class="wpsg_clear"></div>
+	 
         <?php if ($this->hasMod('wpsg_mod_gutschein')) { ?>
         	<?php if (((array_key_exists('gs', $this->view['basket'])) && ($this->view['basket']['gs']['value'] == 0))) { ?>
 		        <a href="" id="LinkGutscheinNeu" onclick="return wpsg_addVoucher(<?php echo $_REQUEST['edit_id']; ?>);"><span class="glyphicon glyphicon-plus"></span>
-			 	<?php echo __("Neuer Gutschein", "wpsg"); ?>
-			 	</a><br />
+			 	    <?php echo __("Gutschein bearbeiten", "wpsg"); ?>
+			 	</a><div class="wpsg_clear"></div>
             <?php } ?>
         <?php } ?>
@@ -68,12 +65,10 @@
 		<div class="wpsg_clear"></div>
         <?php if ($this->hasMod('wpsg_mod_discount')) { ?>
-        	<?php //if (((array_key_exists('preis_rabatt', $this->view['basket']['sum'])) && ($this->view['basket']['sum']['preis_rabatt'] == 0))) { ?>
-		        <a href="" id="LinkRabattNeu" onclick="return wpsg_addDiscount(<?php echo $_REQUEST['edit_id']; ?>);"><span class="glyphicon glyphicon-plus"></span>
-			 	<?php echo __("Neuer Rabatt", "wpsg"); ?>
-			 	</a><br />
-            <?php //} ?>
+        	<a href="" id="LinkRabattNeu" onclick="return WPSG_BE_Discount.editDiscount(<?php echo $_REQUEST['edit_id']; ?>);"><span class="glyphicon glyphicon-plus"></span>
+			 	<?php echo __("Rabatt bearbeiten", "wpsg"); ?>
+			</a><div class="wpsg_clear"></div>
         <?php } ?>
 
-		<div class="wpsg_clear"></div>
+		
         <a href="" id="LinkSendMail" onclick="return wpsg_sendMail(<?php echo $_REQUEST['edit_id']; ?>);"><span class="glyphicon glyphicon-envelope"></span>
 	 	<?php echo __("BestellbestÃ€tigung", "wpsg"); ?><br /><?php echo __("erneut versenden", "wpsg"); ?>
@@ -130,6 +125,8 @@
 			url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Order&subaction=discountData&do=add&edit_id=' + oid + '&noheader=1',
 			success: function(data) {
+			    
 				jQuery('#wpsg_produkte_table').replaceWith(data);
 				jQuery('#LinkRabattNeu').hide();
+				
 			}
 		} );
Index: /views/order/view_orderdata.phtml
===================================================================
--- /views/order/view_orderdata.phtml	(revision 7172)
+++ /views/order/view_orderdata.phtml	(revision 7173)
@@ -6,196 +6,11 @@
      * Time: 13:45
      */
-
+         
 ?>
 <div id="wpsg_produkte_table">
 <?php echo wpsg_drawForm_AdminboxStart(__('Bestelldaten', 'wpsg')); ?>
-    <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($this->view['basket']['mwst']) > 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>
-        <?php $i = 0; foreach ($this->view['basket']['produkte'] as $produkt_key => $p) { $i ++; ?>
-        <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 $this->getProduktID($p['id']); ?>" title="<?php echo __('Zum Produkt', 'wpsg'); ?>">
-                    <?php echo wpsg_hspc($this->getProductName($this->getProduktID($p['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']; ?>, <?php echo $p['product_id']; ?>, <?php echo $_REQUEST['edit_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.removeProduct(<?php echo $p['order_product_id']; ?>, <?php echo $_REQUEST['edit_id']; ?>);"><span class="glyphicon glyphicon-trash"></span></a>
-            </td>
-            <td class="wpsg_cell_preis"><?php echo wpsg_ff($p['preis']); ?> <?php echo $this->get_option('wpsg_currency'); ?></td>
-            <?php if (sizeof($this->view['basket']['mwst']) > 1 || $this->get_option('wpsg_showMwstAlways') == '1') { ?>
-            <td class="wpsg_cell_mwst"><?php echo wpsg_ff($p['mwst_value']); ?> %</td>
-            <?php } ?>
-            <td class="wpsg_cell_menge"><?php echo wpsg_hspc($p['menge']); ?></td>
-            <td class="wpsg_cell_gesamtpreis"><?php echo wpsg_ff($p['menge'] * $p['preis']); ?> <?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)); ?>
-        <?php } ?>
-        <?php $gs_id = 0;
-        if ((isset($this->view['basket']['gs'])) && ($this->view['basket']['gs']['value'] > 0)) { ?>
-        <tr class="wpsg_<?php echo (($i % 2 == 0)?'odd':'even'); ?> wpsg_gutschein">
-        	<?php
-        		$gs_id = 0;
-        		if (array_key_exists('gs_id', $_REQUEST))
-        		{
-        			$gs_id = wpsg_getInt($_REQUEST['gs_id']);
-        		}
-        		else
-        		{
-        			$gs_id = wpsg_getInt($this->view['data']['gs_id']);
-        		}
-        		$o_id = $_REQUEST['edit_id'];
-        		$link1 = '<span id="gsname_'.$gs_id.'" class="editable editable-click" data-original-title="" title="">'.$this->view['basket']['gs']['code'].'</span>';
-        		$val = '-'.wpsg_ff($this->view['basket']['sum']['gs']);
-        		$link2 = '<span id="gsvalue_'.$gs_id.'" class="editable editable-click" data-original-title="" title="">'.$val.'</span>';
-
-        	?>
-            <td class="wpsg_cell_name"><?php echo __('Gutschein', 'wpsg'); ?> <?php echo ($this->view['basket']['gs']['code'] != '')? '('.$link1.')':'' ?>
-            	<a href="#" class="wpsg-glyphlink-td" title="<?php echo __('Gutschein lÃ¶schen', 'wpsg'); ?>" onclick="return wpsg_removeVoucher(<?php echo $gs_id; ?>, <?php echo $o_id; ?>);"><span class="glyphicon glyphicon-trash"></span></a>
-            </td>
-            <td class="wpsg_cell_preis"><?php echo $link2.' '.$this->get_option('wpsg_currency'); ?></td>
-            <?php if (sizeof($this->view['basket']['mwst']) > 1 || $this->get_option('wpsg_showMwstAlways') == '1') { ?>
-            <td class="wpsg_cell_mwst"><?php echo __('anteilig', 'wpsg'); ?></td>
-            <?php } ?>
-            <td class="wpsg_cell_menge">1</td>
-            <td class="wpsg_cell_gesamtpreis"><?php echo '-'.wpsg_ff($this->view['basket']['sum']['gs'], $this->get_option('wpsg_currency')); ?></td>
-        </tr>
-        <?php } ?>
-        <?php $prval = 0;
-        if (isset($this->view['basket']['sum']['preis_rabatt']) && $this->view['basket']['sum']['preis_rabatt'] > 0) {
-        	$o_id = $_REQUEST['edit_id'];
-        	$prval = '-'.wpsg_ff($this->view['basket']['sum']['preis_rabatt']);
-        	$link2 = '<span id="discountvalue_'.$o_id.'" class="editable editable-click" data-original-title="" title="">'.$prval.'</span>';
-        ?>
-        <tr class="wpsg_<?php echo (($i % 2 == 0)?'odd':'even'); ?> wpsg_row_rabatt">
-            <td colspan="<?php echo $this->view['colspan']; ?>" class="wpsg_cell_rabatt_label">
-                <?php echo __('AbzÃŒglich Rabatt', 'wpsg'); ?>
-                <a href="#" class="wpsg-glyphlink-td" title="<?php echo __('Rabatt lÃ¶schen', 'wpsg'); ?>" onclick="return wpsg_removeDiscount(<?php echo $o_id; ?>);"><span class="glyphicon glyphicon-trash"></span></a>
-            </td>
-            <td class="wpsg_cell_rabatt_value wpsg_cell_gesamtpreis">
-                <?php echo $link2.' '.$this->get_option('wpsg_currency'); ?>
-            </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') { ?>
-                    <?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->getFrontendTaxview() == WPSG_NETTO)
-                    //if ($this->view['basket']['price_frontend'] == WPSG_NETTO)
-                    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($this->view['basket']['sum']['preis']); ?> <?php echo $this->get_option('wpsg_currency'); ?>
-            </td>
-        </tr>
-        <?php if ($this->view['basket']['sum']['preis_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">
-                <a href="<?php echo $this->getURL(wpsg_ShopController::URL_VERSANDKOSTEN); ?>" target="_blank"><?php echo __('Versandkosten', 'wpsg'); ?></a>
-                <?php
-                //$order = $this->view['oOrder'];
-                $o_id = $_REQUEST['edit_id'];
-                $oOrder = wpsg_order::getInstance($o_id);
-                $sid = $oOrder->getShippingID();
-                echo __('  ('.$this->arShipping[$sid]['name'].')', 'wpsg');
-                ?>
-                <a href="#" class="wpsg-glyphlink-td" title="<?php echo __('Versandart Ã€ndern', 'wpsg'); ?>"
-                   onclick="return WPSG_BE_Pay_Ship.changeShipping('<?php echo $sid; ?>', <?php echo $o_id; ?>);"><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($this->view['basket']['sum']['preis_shipping']); ?> </span>
-                <?php echo $this->get_option('wpsg_currency'); ?>
-            </td>
-        </tr>
-        <?php } ?>
-        <?php if ($this->view['basket']['sum']['preis_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');
-                //$order = $this->view['oOrder'];
-                $oOrder = wpsg_order::getInstance($_REQUEST['edit_id']);
-                $pid = $oOrder->getPaymentID();
-                echo __('  ('.$this->arPayment[$pid]['name'].')', 'wpsg');
-                ?>
-                <!-- <a href="#" class="wpsg-glyphlink-td" title="<?php echo __('Zahlungsart lÃ¶schen', 'wpsg'); ?>" onclick="return WPSG_BE_Pay_Ship.deletePayment('"<?php echo $pid; ?>"'", <?php echo $o_id; ?>);"><span class="glyphicon glyphicon-trash"></span></a> -->
-                <a href="#" class="wpsg-glyphlink-td" title="<?php echo __('Zahlungsart Ã€ndern', 'wpsg'); ?>"
-                   onclick="return WPSG_BE_Pay_Ship.changePayment('<?php echo $pid; ?>', <?php echo $o_id; ?>);"><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($this->view['basket']['sum']['preis_payment']); ?> </span>
-                <?php echo $this->get_option('wpsg_currency'); ?>
-            </td>
-        </tr>
-        <?php } ?>
-        <?php if ($this->get_option('wpsg_preisangaben') == '1' && $this->get_option('wpsg_kleinunternehmer') != '1') { ?>
-        <?php foreach ($this->view['basket']['mwst'] as $mwst_id => $mwst) { ?>
-        <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'), $mwst['name']); ?>
-            </td>
-            <td class="wpsg_cell_mwst_value wpsg_cell_gesamtpreis">
-                <?php echo wpsg_ff($mwst['sum']); ?> <?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">
-                <?php echo __('Gesamtpreis', 'wpsg'); ?>
-            </td>
-            <td class="wpsg_cell_gesamt_value wpsg_cell_gesamtpreis">
-                <strong><?php echo wpsg_ff($this->view['basket']['sum']['preis_gesamt']); ?> <?php echo $this->get_option('wpsg_currency'); ?></strong>
-            </td>
-        </tr>
-        <?php if ($this->get_option('wpsg_kleinunternehmer') == '1' || $this->get_option('wpsg_preisangaben') != WPSG_NETTO) { ?>
-        <?php foreach ($this->view['basket']['mwst'] as $mwst_id => $mwst) { ?>
-        <tr class="wpsg_row_mwst">
-            <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
-                    //if ($this->view['basket']['price_frontend'] == WPSG_NETTO) {
-                    if ($this->get_option('wpsg_preisangaben') == WPSG_NETTO) {
-                    	echo wpsg_translate(__('zuzÃŒglich MwSt. (#1#)', 'wpsg'), $mwst['name']);
-                    } else {
-                    	echo wpsg_translate(__('darin enthaltene MwSt. (#1#)', 'wpsg'), $mwst['name']); ?>
-                    <?php } ?>
-                <?php } ?>
-            </td>
-            <td class="wpsg_cell_mwst_value wpsg_cell_gesamtpreis">
-                <?php echo wpsg_ff($mwst['sum']); ?> <?php echo $this->get_option('wpsg_currency'); ?>
-            </td>
-        </tr>
-        <?php } ?>
-        <?php } ?>
-    </table>
-
+    <div id="wpsg_product_table_wrap">
+        <?php $this->render(WPSG_PATH_VIEW.'order/product_table.phtml'); ?>
+    </div>
 
 <script type="text/javascript">/* <![CDATA[ */
@@ -330,12 +145,12 @@
 	
     jQuery(document).ready(function() {
-		gs_id = <?php echo $gs_id; ?>;
-		prval = <?php echo $prval; ?>;
-
-		wpsg_view_orderdata_show();
+		 
+
+		//wpsg_view_orderdata_show();
 
     } );
 
     function wpsg_view_orderdata_show() {
+                
         jQuery('#LinkGutscheinNeu').show();
         jQuery('#LinkRabattNeu').show();
@@ -343,6 +158,6 @@
         jQuery('#LinkSendMail').show();
 
-		if (gs_id > 0) { jQuery('#LinkGutscheinNeu').hide(); }
-		if (prval != 0) { jQuery('#LinkRabattNeu').hide(); }
+		//if (gs_id > 0) { jQuery('#LinkGutscheinNeu').hide(); }
+		//if (prval != 0) { jQuery('#LinkRabattNeu').hide(); }
     }
 
@@ -366,515 +181,201 @@
 
     var WPSG_BE_Pay_Ship = {
-
-        	paymentinfos: 0,
-        	shippinginfos: 0,
-        	pidold: 0,
-        	sidold: 0,
-        	preisold: 0.0,
-        	oid: 0,
-
-    		changePayment: function (id, oid) {
-				var
-					i,
-					n;
-    			//jQuery('#wpsg_payment_dialog .modal-body').html('<img src="<?php echo WPSG_URL; ?>views/gfx/ajax-loader.gif" alt="<?php echo __('Bitte warten ...', 'wpsg'); ?>" />');
-
-    			jQuery('#wpsg_payment_dialog').modal( { } );
-
-    			this.paymentinfos = <?php  echo json_encode($this->arPayment, JSON_FORCE_OBJECT); ?>;
-    			this.oid = oid;
-    			this.pidold = id;
-
-    	 		jQuery('#zahlungsartid').empty();
-    			jQuery.each(this.paymentinfos, function(i,n) {
-    	    		console.log('element: ', n.name);
-    	    		if (id == n.id) {
-    	    			jQuery('#zahlungsartid').append("<option value=" + n.id + ' "selected"="selected">' + n.name + "</option>");
-    	    		} else {
-    	    			jQuery('#zahlungsartid').append("<option value=" + n.id + ">" + n.name + "</option>");
-    	    		}
-    	    	});
-    			jQuery('#zahlungsartid').val(id);
-
-    			//this.preis = this.paymentinfos[id].preis;
-    			//this.preis = jQuery('#wpsg_cell_payment_value').val();
-    			this.preis = jQuery('#wpsg_cell_payment_value').html();
-    			this.preisold = this.preis;
-    			if (this.preis == false) { this.preis = '0,00'; }
-    			jQuery('#zahlungsartvalue').val(this.preis);
-
-    			return false;
-
-    		}, // function changePayment(id, oid)
-
-    		/**
-    		 * LÃ¶schen der Zahlungsdaten im Backend
-    		 */
-    		deletePayment: function(id, oid) {
-    			var
-    				pid,
-    				url1;
-
-    			pid = jQuery('#zahlungsartid').val();
-    			pval = jQuery('#zahlungsartvalue').val();
-    			//alert('delete : ' + pid + ' / ' + pval);
-
-    			url1 = 'wp-admin/admin.php?page=wpsg-Order&subaction=paymentData&do=delete&edit_id=' + this.oid + '&p_id=' + pid + '&noheader=1';
-    			jQuery.ajax( {
-    				url: '<?php echo WPSG_URL_WP; ?>' + url1,
-    				success: function(data) {
-    					//jQuery('#wpsg_payment_dialog').modal('hide');
-    					//jQuery('#wpsg_payment_dialog').hide();
-    					//jQuery('#wpsg_payment_dialog').modal( { } ).modal('hide');
-    					jQuery('#wpsg_produkte_table').replaceWith(data);
-    					wpsg_be_act_orderdata();
-    			    }
-    			} );
-
-    			return false;
-
-    		}, // function deletePayment()
-
-    		/**
-    		 * Ãndern der Zahlungsdaten im Backend
-    		 */
-    		dialogPaymentOK: function() {
-    			var
-    				pid,
-    				pval,
-    				url1;
-
-    			pid = jQuery('#zahlungsartid').val();
-    			pval = jQuery('#zahlungsartvalue').val();
-    			//alert('OK neu: ' + this.pidold + ' / ' + pid + ' / ' + pval);
-    			if ((this.pidold == pid) && (this.preisold == pval)) {
-    				jQuery('#wpsg_payment_dialog').modal('hide');
-					//jQuery('#wpsg_payment_dialog').modal('close');
-    				return false;
-    			}
-    			//alert('OK neu: ' + pid + ' / ' + pval);
-
-    			url1 = 'wp-admin/admin.php?page=wpsg-Order&subaction=paymentData&do=change&edit_id=' + this.oid + '&p_id=' + pid + '&p_value=' + pval + '&noheader=1';
-    			jQuery.ajax( {
-    				url: '<?php echo WPSG_URL_WP; ?>' + url1,
-    				data: {
-    					price_frontend: '<?php echo $this->view['basket']['price_frontend']; ?>',
-    					mwst: '<?php reset($this->view['basket']['mwst']); echo key($this->view['basket']['mwst']); ?>',
-    					noMwSt: '<?php echo $this->view['basket']['noMwSt']; ?>' },
-    				success: function(data) {
-    					//jQuery('#wpsg_payment_dialog').modal('hide');
-    					//jQuery('#wpsg_payment_dialog').hide();
-    					//jQuery('#wpsg_payment_dialog').modal( { } ).modal('hide');
-    					jQuery('#wpsg_produkte_table').replaceWith(data);
-    					wpsg_be_act_orderdata();
-    			    }
-    			} );
-
-    			return false;
-
-    		}, // function dialogPaymentOK()
-
-    		/**
-    		 * Ãndern der Zahlungsdaten im Backend
-    		 */
-    		dialogPaymentChange: function() {
-    			var
-    				pid,
-    				pval;
-    			pid = jQuery('#zahlungsartid').val();
-    			pval = this.paymentinfos[pid].preis;
-    			jQuery('#zahlungsartvalue').val(pval);
-
-
-    		},	// dialogPaymentChange()
-
-
-    		changeShipping: function (id, oid) {
-				var
-					i,
-					n;
-    			//jQuery('#wpsg_shipping_dialog .modal-body').html('<img src="<?php echo WPSG_URL; ?>views/gfx/ajax-loader.gif" alt="<?php echo __('Bitte warten ...', 'wpsg'); ?>" />');
-
-    			jQuery('#wpsg_shipping_dialog').modal( { } );
-
-    			this.shippinginfos = <?php  echo json_encode($this->arShipping, JSON_FORCE_OBJECT); ?>;
-    			this.oid = oid;
-    			this.sidold = id;
-
-    	 		jQuery('#versandartid').empty();
-    			jQuery.each(this.shippinginfos, function(i,n) {
-    	    		console.log('element: ', n.name);
-    	    		if (id == n.id) {
-    	    			jQuery('#versandartid').append("<option value=" + n.id + ' "selected"="selected">' + n.name + "</option>");
-    	    		} else {
-    	    			jQuery('#versandartid').append("<option value=" + n.id + ">" + n.name + "</option>");
-    	    		}
-    	    	});
-    			jQuery('#versandartid').val(id);
-
-    			this.preis = jQuery('#wpsg_cell_shipping_value').html();
-    			this.preisold = this.preis;
-    			if (this.preis == false) { this.preis = '0,00'; }
-    			jQuery('#versandartvalue').val(this.preis);
-
-    			return false;
-
-    		}, // function changeShipping(id, oid)
-
-    		/**
-    		 * LÃ¶schen der Versanddaten im Backend
-    		 */
-    		deleteShipping: function(id, oid) {
-    			var
-    				sid,
-    				url1;
-
-    			sid = jQuery('#versandartid').val();
-    			sval = jQuery('#versandartvalue').val();
-    			//alert('delete : ' + sid + ' / ' + sval);
-
-    			url1 = 'wp-admin/admin.php?page=wpsg-Order&subaction=shippingData&do=delete&edit_id=' + this.oid + '&s_id=' + sid + '&noheader=1';
-    			jQuery.ajax( {
-    				url: '<?php echo WPSG_URL_WP; ?>' + url1,
-    				success: function(data) {
-    					//jQuery('#wpsg_payment_dialog').modal('hide');
-    					//jQuery('#wpsg_payment_dialog').hide();
-    					//jQuery('#wpsg_payment_dialog').modal( { } ).modal('hide');
-    					jQuery('#wpsg_produkte_table').replaceWith(data);
-    		    		wpsg_be_act_orderdata();
-    			    }
-    			} );
-
-    			return false;
-
-    		}, // function deleteShipping()
-
-    		/**
-    		 * Ãndern der Versanddaten im Backend
-    		 */
-    		dialogShippingOK: function() {
-    			var
-    				sid,
-    				sval,
-    				url1;
-
-    			sid = jQuery('#versandartid').val();
-    			sval = jQuery('#versandartvalue').val();
-    			//alert('OK neu: ' + this.sidold + ' / ' + sid + ' / ' + sval);
-    			if ((this.sidold == sid) && (this.preisold == sval)) {
-    				jQuery('#wpsg_shipping_dialog').modal('hide');
-					//jQuery('#wpsg_shipping_dialog').modal('close');
-    				return false;
-    			}
-    			//alert('OK neu: ' + sid + ' / ' + sval);
-
-    			url1 = 'wp-admin/admin.php?page=wpsg-Order&subaction=shippingData&do=change&edit_id=' + this.oid + '&s_id=' + sid + '&s_value=' + sval + '&noheader=1';
-    			jQuery.ajax( {
-    				url: '<?php echo WPSG_URL_WP; ?>' + url1,
-    				data: {
-    					price_frontend: '<?php echo $this->view['basket']['price_frontend']; ?>',
-    					mwst: '<?php reset($this->view['basket']['mwst']); echo key($this->view['basket']['mwst']); ?>',
-    					noMwSt: '<?php echo $this->view['basket']['noMwSt']; ?>' },
-    				success: function(data) {
-        				//alert(data);
-    					jQuery('#wpsg_produkte_table').replaceWith(data);
-    					wpsg_be_act_orderdata();
-    			    }
-    			} );
-
-    			return false;
-
-    		}, // function dialogShippingOK()
-
-    		/**
-    		 * Ãndern der Versanddaten im Backend
-    		 */
-    		dialogShippingChange: function() {
-    			var
-    				sid,
-    				sval;
-    			sid = jQuery('#versandartid').val();
-    			sval = this.shippinginfos[pid].preis;
-    			jQuery('#versandartvalue').val(sval);
-
-
-    		},	// dialogShippingChange()
-
-		changePayment2: function (id, oid) {
-
-			alert('TEST OK neu2');
-
-		} // function changePayment2(id, oid)
-
+    		 
+        changeShippingPayment: function (id, oid) {
+
+            jQuery('#wpsg_shipping_dialog .modal-body').html('<img src="<?php echo WPSG_URL; ?>views/gfx/ajax-loader.gif" alt="<?php echo __('Bitte warten ...', 'wpsg'); ?>" />');
+            jQuery('#wpsg_shipping_dialog').modal( { } ).modal('show');
+                            
+            jQuery.ajax( {
+                url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Order&action=view&subaction=editPayShipping&edit_id=<?php echo $_REQUEST['edit_id']; ?>&noheader=1',
+                success: function(data) {
+
+                    jQuery('#wpsg_shipping_dialog .modal-body').html(data);
+
+                }
+            } );
+
+            return false;
+             
+        }, // function changeShipping(id, oid)
+
+        /**
+         * Ãndern der Versanddaten im Backend
+         */
+        updateShippingPayment: function() {
+            
+            var data = {
+                submit: '1',
+                shipping_key: jQuery('#edit_shipping_type').val(),
+                shipping_price: jQuery('#edit_shipping_price').val(),
+                payment_key: jQuery('#edit_payment_type').val(),
+                payment_price: jQuery('#edit_payment_price').val()
+            };
+            
+            jQuery('#wpsg_shipping_dialog').modal('hide');
+            
+            jQuery('#wpsg_product_table_wrap').html('<img src="<?php echo WPSG_URL; ?>views/gfx/ajax-loader.gif" alt="<?php echo __('Bitte warten ...', 'wpsg'); ?>" />');
+            
+            jQuery.ajax( {
+                url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Order&action=updateOrder&subaction=editPayShipping&edit_id=<?php echo $_REQUEST['edit_id']; ?>&noheader=1',
+                data: data,
+                success: function(data) {
+                    
+                    jQuery('#wpsg_product_table_wrap').html(data.product_table);
+                    
+                }
+            } );
+            
+            return false; 
+
+        } // function dialogShippingOK()
+  
     };	// WPSG_BE_Pay_Ship
-    //WPSG_BE_Pay_Ship.changePayment2(1, 2);
-
 
     var WPSG_BE_Product = {
 
-        	pidold: 0,
-        	preisold: 0.0,
-        	o_id: 0,
-        	p_id: 0,
-        	op_id: 0,
-        	modus: 0,
-
-			productinfos : <?php  echo json_encode($this->view['basket']['produkte'], JSON_FORCE_OBJECT); ?>,
-			mwstinfos : <?php  echo json_encode(wpsg_tax_groups(true), JSON_FORCE_OBJECT); ?>,
-			allproductinfos : <?php echo json_encode($this->db->fetchAssoc("SELECT * FROM `".wpsg_q(WPSG_TBL_PRODUCTS)."` WHERE `deleted` != '1' ORDER BY `name`"), JSON_FORCE_OBJECT); ?>,
-			mwst1 : <?php  echo json_encode($this->view['basket']['mwst'], JSON_FORCE_OBJECT); ?>,
-        	noMwSt: '<?php echo $this->view['basket']['noMwSt']; ?>',
-        	mwst2: '<?php reset($this->view['basket']['mwst']); echo key($this->view['basket']['mwst']); ?>',
-
-    	/**
-    	 * Wird aufgerufen wenn ein Produkt gelÃ¶scht werden soll
-    	 */
-    	removeProduct: function (op_id, o_id)
-    	{
-
-    		if (!confirm('<?php echo __("Sind Sie sich sicher, dass Sie dieses Produkt lÃ¶schen mÃ¶chten?", "wpsg"); ?>')) return false;
-
-    		jQuery('#wpsg_produkte_table').html('<img src="<?php echo WPSG_URL; ?>views/gfx/ajax-loader.gif" alt="<?php echo __('Bitte warten ...', 'wpsg'); ?>" />');
-
-    		jQuery.ajax( {
-    			url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Order&subaction=productData&do=remove&edit_id=' + o_id + '&op_id=' + op_id + '&noheader=1',
-    			success: function (data) {
-    				jQuery('#wpsg_produkte_table').replaceWith(data);
-    	    		wpsg_be_act_orderdata();
-    			}
-    		} );
-
-    		return false;
-    	},	// function removeProduct
-
-    	/**
-    	 * Wird aufgerufen wenn ein Produkt hinzugefÃŒgt werden soll
-    	 */
-    	addProduct: function (o_id, p_id) {
-    		//jQuery('#wpsg_produkte_table').html('<img src="<?php echo WPSG_URL; ?>views/gfx/ajax-loader.gif" alt="<?php echo __('Bitte warten ...', 'wpsg'); ?>" />');
-    		this.op_id = 0;
-			this.p_id = p_id;
-			this.o_id = o_id;
-
-    		//alert('TEST');
-    		jQuery('#wpsg_product_dialog').modal( { } );
-
-    		this.modus = 1;		// neues Produkt
-    		jQuery('#wpsg_product_data').hide();
-
-    		jQuery('#productid').empty();
-			jQuery.each(this.allproductinfos, function (i,n) {
-				jQuery('#productid').append("<option value=" + n.id + ">" + n.name + "</option>");
-			});
-			jQuery('#productid').val(p_id);
-
-
-    		return false;
-    	},	// function addProduct
-
-		/**
-		 * Bearbeiten der Produkt-Daten
-		 */
-		editProduct: function (op_id, p_id, o_id)
-		{
-			var
-				i,
-				id,
-				menge,
-				key,
-				mid,
-				n;
-
-			this.modus = 0;		// bearbeiten
-			this.op_id = op_id;
-			this.p_id = p_id;
-			this.o_id = o_id;
-			//jQuery('#wpsg_produkte_table').html('<img src="<?php echo WPSG_URL; ?>views/gfx/ajax-loader.gif" alt="<?php echo __('Bitte warten ...', 'wpsg'); ?>" />');
-
-			jQuery('#wpsg_product_dialog').modal( { } );
-    		jQuery('#wpsg_product_data').show();
-
-			this.pidold = p_id;
-
-			jQuery('#productid').empty();
-			jQuery.each(this.allproductinfos, function (i,n) {
-				console.log('element: ', n.name);
-				if (p_id == n.id) {
-					jQuery('#productid').append("<option value=" + n.id + ' "selected"="selected">' + n.name + "</option>");
-					mid = n.mwst_key;
-				} else {
-					jQuery('#productid').append("<option value=" + n.id + ">" + n.name + "</option>");
-				}
-			});
-			jQuery('#productid').val(p_id);
-
-			jQuery('#productmwst').empty();
-			for (key in this.mwstinfos) {
-				if (p_id == key) {
-					jQuery('#productmwst').append("<option value=" + key + ' "selected"="selected">' + this.mwstinfos[key] + "</option>");
-				} else {
-					jQuery('#productmwst').append("<option value=" + key + ">" + this.mwstinfos[key] + "</option>");
-				}
-			}
-			jQuery('#productmwst').val(mid);
-
-			id = this.findIndex(op_id);
-			this.preis = this.productinfos[id].preis;
-
-			this.preisold = this.preis;
-			if (this.preis == false) { this.preis = '0,00'; }
-			jQuery('#productvalue').val(this.preis);
-			menge = this.productinfos[id].menge;
-			jQuery('#productmenge').val(menge);
-
-			return false;
-
-		}, // function editProduct()
-
-    	/**
-		 * Ãndern der Produktdaten im Backend
-		 */
-		dialogProductOK: function () {
-			var
-				pid,
-				pval,
-				pme,
-				pmwst,
-				url1;
-
-			pid = jQuery('#productid').val();
-			pval = jQuery('#productvalue').val();
-			pme = jQuery('#productmenge').val();
-			pmwst = jQuery('#productmwst').val();
-			//alert('OK neu: ' + this.pidold + ' / ' + pid + ' / ' + pval);
-			//if ((this.pidold == pid) && (this.preisold == pval)) {
-			if ((pid == null)) {
-				jQuery('#wpsg_product_dialog').modal('hide');
-				return false;
-			}
-			//alert('OK neu: ' + pid + ' / ' + pval);
-
-			if (this.modus == 0) {
-				url1 = 'wp-admin/admin.php?page=wpsg-Order&subaction=productData&do=change&edit_id=' + this.o_id + '&op_id=' + this.op_id + '&p_id=' + pid + '&noheader=1';
-				jQuery.ajax( {
-					url: '<?php echo WPSG_URL_WP; ?>' + url1,
-					data: {
-						p_val: pval,
-						p_me: pme,
-						pidold: this.pidold,
-						mwst: this.mwst1,
-						noMwSt: this.noMwSt,
-						p_mwst: pmwst},
-					success: function(data) {
-						//jQuery('#wpsg_payment_dialog').modal('hide');
-						//jQuery('#wpsg_payment_dialog').hide();
-						//jQuery('#wpsg_payment_dialog').modal( { } ).modal('hide');
-						jQuery('#wpsg_produkte_table').replaceWith(data);
-			    		wpsg_be_act_orderdata();
-				    }
-				} );
-			} else {
-				// Neues Produkt hinzufÃŒgen
-	    		jQuery.ajax( {
-	    			url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Order&subaction=productData&do=add&edit_id=' + this.o_id + '&p_id=' + pid + '&noheader=1',
-					data: {
-						p_val: pval,
-						p_me: pme,
-						pidold: this.pidold,
-						mwst: this.mwst1,
-						noMwSt: this.noMwSt,
-						p_mwst: pmwst},
-	    			success: function(data) {
-	    				jQuery('#wpsg_produkte_table').replaceWith(data);
-	    	    		wpsg_be_act_orderdata();
-	    				//jQuery('#LinkRabattNeu').hide();
-	    			}
-	    		} );
-			}
-			return false;
-
-		}, // function dialogProduktOK()
-
-		/**
-		 * Ãndern des Produktes im Backend
-		 */
-		dialogProductChange: function() {
-			var
-				pid,
-				id,
-				aid,
-				mid,
-				pval;
-			pid = jQuery('#productid').val();
-			aid = this.findAllIndex(pid);
-			if (aid !== false) {
-				pval = this.allproductinfos[aid].name;
-				id = this.findIndex(this.op_id);
-				pval = this.allproductinfos[aid].preis;
-				jQuery('#productvalue').val(pval);
-				jQuery('#productmenge').val(1);
-				pval = this.allproductinfos[aid].mwst_key;
-				jQuery('#productmwst').val(pval);
-
-				jQuery('#productmwst').empty();
-				for (key in this.mwstinfos) {
-					if (pval == key) {
-						jQuery('#productmwst').append("<option value=" + key + ' "selected"="selected">' + this.mwstinfos[key] + "</option>");
-					} else {
-						jQuery('#productmwst').append("<option value=" + key + ">" + this.mwstinfos[key] + "</option>");
-					}
-				}
-				jQuery('#productmwst').val(pval);
-
-				jQuery('#wpsg_product_data').show();
-			}
-
-		},	// dialogProductChange()
-
-		/**
-		 * Suchen des Indexes in allproductinfos an Hand der id
-		 */
-		findAllIndex: function(id) {
-			var
-				pid,
-				pval;
-			for (key in this.allproductinfos) {
-				if (id == this.allproductinfos[key].id) {
-					return key;
-				}
-			}
-			return false;
-
-		},	// findAllIndex()
-
-		/**
-		 * Suchen des Indexes in productinfos an Hand der order_product_id
-		 */
-		findIndex: function(id) {
-			var
-				pid,
-				pval;
-			for (key in this.productinfos) {
-				if (id == this.productinfos[key].order_product_id) {
-					return key;
-				}
-			}
-			return false;
-
-		},	// findIndex()
-
-		changeProduct2: function (id, oid) {
-
-			alert('TEST OK neu2');
-
-		} // function changeProduct2(id, oid)
-
-    };	// WPSG_BE_Product
-    //WPSG_BE_Product.changeProduct2(1, 2);
-
+        addProduct: function() {
+    
+            jQuery('#wpsg_product_dialog .modal-body').html('<img src="<?php echo WPSG_URL; ?>views/gfx/ajax-loader.gif" alt="<?php echo __('Bitte warten ...', 'wpsg'); ?>" />');
+            jQuery('#wpsg_product_dialog').modal( { } ).modal('show');
+            jQuery('#wpsg_product_dialog .btn-primary').prop('disabled', true);
+            
+            jQuery.ajax( {
+                url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Order&action=view&subaction=addProduct&edit_id=<?php echo $_REQUEST['edit_id']; ?>&noheader=1',
+                success: function(data) {
+    
+                    jQuery('#wpsg_product_dialog .modal-body').html(data);
+    
+                }
+            } );
+    
+            return false;
+            
+        },
+        
+        remvoeProduct: function(order_product_id) {
+
+            jQuery('#wpsg_product_table_wrap').html('<img src="<?php echo WPSG_URL; ?>views/gfx/ajax-loader.gif" alt="<?php echo __('Bitte warten ...', 'wpsg'); ?>" />');
+            
+            jQuery.ajax( {
+                url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Order&action=view&subaction=removeProduct&noheader=1&edit_id=<?php echo $_REQUEST['edit_id']; ?>',
+                data: { 
+                    order_product_id: order_product_id
+                },
+                success: function(data) {
+
+                    jQuery('#wpsg_product_table_wrap').html(data.product_table);
+
+                }
+            } );
+            
+            return false;
+            
+        },
+        
+        editProduct: function(order_product_id) {
+
+            jQuery('#wpsg_product_dialog .modal-body').html('<img src="<?php echo WPSG_URL; ?>views/gfx/ajax-loader.gif" alt="<?php echo __('Bitte warten ...', 'wpsg'); ?>" />');
+            jQuery('#wpsg_product_dialog').modal( { } ).modal('show');
+            jQuery('#wpsg_product_dialog .btn-primary').prop('disabled', true);
+
+            jQuery.ajax( {
+                url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Order&action=view&subaction=addProduct&edit_id=<?php echo $_REQUEST['edit_id']; ?>&noheader=1',
+                data: {
+                    order_product_id: order_product_id  
+                },
+                success: function(data) {
+
+                    jQuery('#wpsg_product_dialog .modal-body').html(data);
+
+                }
+            } );
+
+            return false;
+            
+        },
+
+        saveProduct: function() {
+ 
+            jQuery('#wpsg_product_dialog').modal('hide');
+            jQuery('#wpsg_product_table_wrap').html('<img src="<?php echo WPSG_URL; ?>views/gfx/ajax-loader.gif" alt="<?php echo __('Bitte warten ...', 'wpsg'); ?>" />');
+
+            jQuery.ajax( {
+                url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Order&action=view&subaction=addProduct&do=submit&edit_id=<?php echo $_REQUEST['edit_id']; ?>&noheader=1',
+                data: jQuery('#wpsg_product_add_form').serialize(),
+                success: function(data) {
+
+                    jQuery('#wpsg_product_table_wrap').html(data.product_table);
+
+                }
+            } );
+
+            return false;
+
+        }
+        
+    }
+    
+    var WPSG_BE_Discount = {
+        
+        editDiscount: function() {
+
+            jQuery('#wpsg_discount_dialog .modal-body').html('<img src="<?php echo WPSG_URL; ?>views/gfx/ajax-loader.gif" alt="<?php echo __('Bitte warten ...', 'wpsg'); ?>" />');
+            jQuery('#wpsg_discount_dialog').modal( { } ).modal('show'); 
+
+            jQuery.ajax( {
+                url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Order&action=view&subaction=editDiscount&edit_id=<?php echo $_REQUEST['edit_id']; ?>&noheader=1',                 
+                success: function(data) {
+
+                    jQuery('#wpsg_discount_dialog .modal-body').html(data);
+
+                }
+            } );
+
+            return false;
+            
+        },
+        
+        saveDiscount: function() {
+
+            jQuery('#wpsg_discount_dialog').modal('hide');
+            jQuery('#wpsg_product_table_wrap').html('<img src="<?php echo WPSG_URL; ?>views/gfx/ajax-loader.gif" alt="<?php echo __('Bitte warten ...', 'wpsg'); ?>" />');
+
+            jQuery.ajax( {
+                url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Order&action=view&subaction=editDiscount&do=submit&edit_id=<?php echo $_REQUEST['edit_id']; ?>&noheader=1',
+                data: jQuery('#wpsg_be_discount_form').serialize(),
+                success: function(data) {
+
+                    jQuery('#wpsg_product_table_wrap').html(data.product_table);
+
+                }
+            } );
+
+            return false;
+            
+        }
+        
+    }
+    
 	/* ]]> */</script>
 
 </div>
 
+<!-- Modaldialog fÃŒr Rabatt -->
+<div class="modal fade" id="wpsg_discount_dialog" tabindex="-1" role="dialog">
+    <div class="modal-dialog" role="document">
+        <div class="modal-content">
+            <div class="modal-header">
+                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
+                <h4 class="modal-title" id="myModalLabel"><?php echo __('Rabatt hinzufÃŒgen/bearbeiten', 'wpsg'); ?></h4>
+            </div>
+            <div class="modal-body"></div>
+            <div class="modal-footer">
+                <button type="button" class="btn btn-default" data-dismiss="modal">Abbrechen</button>
+                <button type="button" class="btn btn-primary" data-dismiss="modal" onclick="return WPSG_BE_Discount.saveDiscount();">OK</button>
+            </div>
+        </div>
+    </div>
+</div>
 
 <!-- Modaldialog fÃŒr Produkte -->
@@ -884,54 +385,10 @@
       <div class="modal-header">
         <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
-        <h4 class="modal-title" id="myModalLabel"><?php echo __('Produkt', 'wpsg'); ?></h4>
+        <h4 class="modal-title" id="myModalLabel"><?php echo __('Produkt hinzufÃŒgen/bearbeiten', 'wpsg'); ?></h4>
       </div>
-      <div class="modal-body">
-      	<br />
-      	<?php
-      	$i = 0;
-      	// $this
-      	?>
-        <div class="row">
-          <div class="col-md-3 col-sm-6 control_label"><label for="productid" ><?php echo _("Produkt"); ?></label></div>
-          <div class="col-md-3">
-			<select name="productid" id="productid" onchange="return WPSG_BE_Product.dialogProductChange();" class="form-control input-sm" size="1" class="select">
-				<option value=0>"[unbekannt]"</option>
-			</select>
-		  </div>
-        </div>
-        <div class="clearfix wpsg_clear"></div>
-        <div class="clearfix wpsg_clear"></div>
-
-		<div id="wpsg_product_data">
-	        <div class="row">
-	          <div class="col-md-3 col-sm-6 control_label"><label for="productvalue"><?php echo _("Preis"); ?></label></div>
-	          <div class="col-md-3">
-				<input type="text" name="productvalue" id="productvalue" class="form-control input-sm" size="1" class="select">
-			  </div>
-	        </div>
-	        <div class="clearfix wpsg_clear"></div>
-	        <div class="row">
-	          <div class="col-md-3 col-sm-6 control_label"><label for="productmenge"><?php echo _("Menge"); ?></label></div>
-	          <div class="col-md-3">
-				<input type="text" name="productmenge" id="productmenge" class="form-control input-sm" size="1" class="select">
-			  </div>
-	        </div>
-	        <div class="clearfix wpsg_clear"></div>
-	        <div class="row">
-	          <div class="col-md-3 col-sm-6 control_label"><label for="productid" ><?php echo _("MwSt:"); ?></label></div>
-	          <div class="col-md-3">
-				<select name="productmwst" id="productmwst" class="form-control input-sm" size="1" class="select">
-					<option value=0>"[unbekannt]"</option>
-				</select>
-			  </div>
-	        </div>
-	        <div class="clearfix wpsg_clear"></div>
-
-        </div>
-
-      </div>
+      <div class="modal-body"></div>
       <div class="modal-footer">
         <button type="button" class="btn btn-default" data-dismiss="modal">Abbrechen</button>
-        <button type="button" class="btn btn-primary" data-dismiss="modal" onclick="return WPSG_BE_Product.dialogProductOK();">OK</button>
+        <button type="button" class="btn btn-primary" data-dismiss="modal" onclick="return WPSG_BE_Product.saveProduct();">OK</button>
       </div>
     </div>
@@ -939,6 +396,5 @@
 </div>
 
-
-<!-- Modaldialog fÃŒr Versandart -->
+<!-- Modaldialog fÃŒr Versandart / Zahlungsart -->
 <div class="modal fade" id="wpsg_shipping_dialog" tabindex="-1" role="dialog">
   <div class="modal-dialog" role="document">
@@ -948,29 +404,8 @@
         <h4 class="modal-title" id="myModalLabel"><?php echo __('Versandart', 'wpsg'); ?></h4>
       </div>
-      <div class="modal-body">
-      	<br />
-        <div class="row">
-          <div class="col-md-3 col-sm-6 control_label"><label for="versandartid" ><?php echo _("Versandart"); ?></label></div>
-          <div class="col-md-3">
-			<select name="versandartid" id="versandartid" onchange="return WPSG_BE_Pay_Ship.dialogShippingChange();" class="form-control input-sm" size="1" class="select">
-				<option value=0>"[unbekannt]"</option>
-			</select>
-		  </div>
-        </div>
-        <div class="clearfix wpsg_clear"></div>
-        <div class="clearfix wpsg_clear"></div>
-        <br />
-        <div class="row">
-          <div class="col-md-3 col-sm-6 control_label"><label for="versandartvalue"><?php echo _("GebÃŒhr/Kosten"); ?></label></div>
-          <div class="col-md-3">
-			<input type="text" name="versandartvalue" id="versandartvalue" class="form-control input-sm" size="1" class="select">
-		  </div>
-        </div>
-        <div class="clearfix wpsg_clear"></div>
-
-      </div>
+      <div class="modal-body"></div>
       <div class="modal-footer">
         <button type="button" class="btn btn-default" data-dismiss="modal">Abbrechen</button>
-        <button type="button" class="btn btn-primary" data-dismiss="modal" onclick="return WPSG_BE_Pay_Ship.dialogShippingOK();">OK</button>
+        <button type="button" class="btn btn-primary" data-dismiss="modal" onclick="return WPSG_BE_Pay_Ship.updateShippingPayment();">OK</button>
       </div>
     </div>
@@ -978,42 +413,2 @@
 </div>
 
-
-<!-- Modaldialog fÃŒr Zahlungsart -->
-<div class="modal fade" id="wpsg_payment_dialog" tabindex="-1" role="dialog">
-  <div class="modal-dialog" role="document">
-    <div class="modal-content">
-      <div class="modal-header">
-        <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
-        <h4 class="modal-title" id="myModalLabel"><?php echo __('Zahlungsart', 'wpsg'); ?></h4>
-      </div>
-      <div class="modal-body">
-      	<br />
-        <div class="row">
-          <div class="col-md-3 col-sm-6 control_label"><label for="zahlungsartid" ><?php echo _("Zahlungsart"); ?></label></div>
-          <div class="col-md-3">
-			<select name="zahlungsartid" id="zahlungsartid" onchange="return WPSG_BE_Pay_Ship.dialogPaymentChange();" class="form-control input-sm" size="1" class="select">
-				<option value=0>"[unbekannt]"</option>
-			</select>
-		  </div>
-        </div>
-        <div class="clearfix wpsg_clear"></div>
-        <div class="clearfix wpsg_clear"></div>
-        <br />
-        <div class="row">
-          <div class="col-md-3 col-sm-6 control_label"><label for="zahlungsartvalue"><?php echo _("GebÃŒhr/Kosten"); ?></label></div>
-          <div class="col-md-3">
-			<input type="text" name="zahlungsartvalue" id="zahlungsartvalue" class="form-control input-sm" size="1" class="select">
-		  </div>
-        </div>
-        <div class="clearfix wpsg_clear"></div>
-
-      </div>
-      <div class="modal-footer">
-        <button type="button" class="btn btn-default" data-dismiss="modal">Abbrechen</button>
-        <button type="button" class="btn btn-primary" data-dismiss="modal" onclick="return WPSG_BE_Pay_Ship.dialogPaymentOK();">OK</button>
-      </div>
-    </div>
-  </div>
-</div>
-
-<?php echo wpsg_drawForm_AdminboxEnd(); ?>
Index: /views/warenkorb/basket.phtml
===================================================================
--- /views/warenkorb/basket.phtml	(revision 7172)
+++ /views/warenkorb/basket.phtml	(revision 7173)
@@ -112,6 +112,5 @@
 					<?php if (sizeof($this->view['basket']['mwst']) > 1 || $this->get_option('wpsg_showMwstAlways') == '1') { ?>
 					<div class="product_info">
-						
-						<div
+						 
 						<?php if ($this->view['$bPicture'] == true) { ?>class="titlep"><?php } else { ?>class="title"><?php } ?>
 							<?php echo __("MwSt.", "wpsg"); ?>
Index: /wpshopgermany.php
===================================================================
--- /wpshopgermany.php	(revision 7172)
+++ /wpshopgermany.php	(revision 7173)
@@ -120,5 +120,5 @@
 	require_once(dirname(__FILE__).'/lib/wpsg_imagehandler.class.php');
 	require_once(dirname(__FILE__).'/lib/wpsg_cache.class.php');
-	require_once(dirname(__FILE__).'/lib/wpsg_basket.class.php');
+	require_once(dirname(__FILE__).'/lib/wpsg_basket.class.php');    
 	require_once(dirname(__FILE__).'/lib/wpsg_header.class.php');
 	require_once(dirname(__FILE__).'/lib/wpsg_remoteconnection.class.php');
@@ -132,5 +132,6 @@
 	require_once(dirname(__FILE__).'/model/wpsg_customer.class.php');
 	require_once(dirname(__FILE__).'/model/wpsg_news.class.php');
-	require_once(dirname(__FILE__).'/mods/wpsg_mod_basic.class.php');	
+	require_once(dirname(__FILE__).'/mods/wpsg_mod_basic.class.php');
+    require_once(dirname(__FILE__).'/lib/wpsg_calculation.class.php');
 	require_once(dirname(__FILE__).'/controller/wpsg_SystemController.class.php');
 	require_once(dirname(__FILE__).'/controller/wpsg_ShopController.class.php');
@@ -248,2 +249,3 @@
     
 	$GLOBALS['wpsg_sc']->callMods('load', array());
+ 
