Index: /lib/wpsg_basket.class.php
===================================================================
--- /lib/wpsg_basket.class.php	(revision 7275)
+++ /lib/wpsg_basket.class.php	(revision 7276)
@@ -820,5 +820,5 @@
 				else $update_data['status'] = wpsg_ShopController::STATUS_UNVOLLSTAENDIG;
 				
-				$this->db->UpdateQuery(WPSG_TBL_ORDER, $update_data, "`id` = '".wpsg_q($o_id)."'");
+				if (wpsg_isSizedInt($o_id)) $this->db->UpdateQuery(WPSG_TBL_ORDER, $update_data, "`id` = '".wpsg_q($o_id)."'");
 				
 				// URL Benachrichtigung beim Kauf
@@ -1949,4 +1949,5 @@
 			}
 			
+			
 			$arReturn['sum'] = [
 				'preis' => (($this->shop->getFrontendTaxview() === WPSG_NETTO)?$arCalculation['sum']['productsum_netto']:$arCalculation['sum']['productsum_brutto']),
@@ -1969,5 +1970,9 @@
 			$arReturn['shipping']['preis_shipping_netto'] = ($arCalculation['shipping'][0]['netto']??0);
 			$arReturn['shipping']['preis_shipping_brutto'] = ($arCalculation['shipping'][0]['brutto']??0);
-			$arReturn['shipping']['tax_value'] = $arCalculation['tax'][$arCalculation['shipping'][0]['tax_key']]['tax_value'];
+			
+			if (isset($arCalculation['shipping']))
+				$arReturn['shipping']['tax_value'] = $arCalculation['tax'][$arCalculation['shipping'][0]['tax_key']]['tax_value'];
+			else
+				$arReturn['shipping']['tax_value'] = 0;
 			 
 			$arReturn['mwst'] = [];
Index: /lib/wpsg_calculation.class.php
===================================================================
--- /lib/wpsg_calculation.class.php	(revision 7275)
+++ /lib/wpsg_calculation.class.php	(revision 7276)
@@ -366,4 +366,10 @@
 						'productsum_netto' => 0,
 						'productsum_brutto' => 0,
+						'payment_netto' => 0,
+						'payment_brutto' => 0,
+						'shipping_netto' => 0,
+						'shipping_brutto' => 0,
+						'discount_netto' => 0,
+						'discount_brutto' => 0,
 						'netto' => 0,
 						'brutto' => 0,
@@ -907,5 +913,5 @@
 										
 					$this->addProduct(
-						$oProduct->getPrice($this->shop->getBackendTaxview()), 
+						$oProduct->getPrice($p['id'], $this->shop->getBackendTaxview()), 
 						$this->shop->getBackendTaxview(), 
 						$oProduct->mwst_key, 
@@ -925,16 +931,18 @@
 			
 			// Shipping 
-			if (isset($_SESSION['wpsg']['checkout']['payment'])) {
+			if (isset($_SESSION['wpsg']['checkout']['payment']) && array_key_exists($_SESSION['wpsg']['checkout']['payment'], $this->shop->arPayment)) {
 				
 				$payment = $this->shop->arPayment[$_SESSION['wpsg']['checkout']['payment']];
-				$this->addPayment($payment['price'], $this->shop->getBackendTaxview(), $payment['mwst_key'], $_SESSION['wpsg']['checkout']['payment']);
+				
+				if (isset($payment['price'])) $this->addPayment($payment['price'], $this->shop->getBackendTaxview(), $payment['mwst_key'], $_SESSION['wpsg']['checkout']['payment']);
 				
 			}
 			
 			// Payment
-			if (isset($_SESSION['wpsg']['checkout']['shipping'])) {
+			if (isset($_SESSION['wpsg']['checkout']['shipping']) && array_key_exists($_SESSION['wpsg']['checkout']['shipping'], $this->shop->arShipping)) {
 				
 				$shipping = $this->shop->arShipping[$_SESSION['wpsg']['checkout']['shipping']];
-				$this->addShipping($shipping['price_backend'], $this->shop->getBackendTaxview(), $shipping['mwst_key'], $_SESSION['wpsg']['checkout']['shipping']);
+				
+				if (isset($payment['price_backend'])) $this->addShipping($shipping['price_backend'], $this->shop->getBackendTaxview(), $shipping['mwst_key'], $_SESSION['wpsg']['checkout']['shipping']);
 				
 			}
@@ -1181,5 +1189,7 @@
 				$this->arCalculation['tax'][$tax_key] = [
 					'key' => $tax_key,
-					'tax_value' => $this->arCountry[$arTaxKey[1]][$tax_key]
+					'tax_value' => $this->arCountry[$arTaxKey[1]][$tax_key],
+					'netto' => 0,
+					'brutto' => 0
 				];
 				
Index: /model/wpsg_product.class.php
===================================================================
--- /model/wpsg_product.class.php	(revision 7275)
+++ /model/wpsg_product.class.php	(revision 7276)
@@ -12,6 +12,7 @@
 		const MULTIPLE_MULTI_ONE = 2; // Mehrfach mit Menge 1
 
-		public $loadedData = array(); /* EnthÃ€lt die Daten, die ÃŒber den ShopController und die Module geladen / erweitert wurden */
-
+		private $_cache = [];
+		
+		public $loadedData = array(); /* EnthÃ€lt die Daten, die ÃŒber den ShopController und die Module geladen / erweitert wurden */		
 		public $product_key = "";		
 
@@ -389,8 +390,8 @@
 		}
 
-		public function getMinPrice()
-		{
-
-			return $this->getPrice();
+		public function getMinPrice($product_key = false)
+		{
+
+			return $this->getPrice($product_key);
 
 		}
@@ -398,30 +399,61 @@
 		/**
 		 * Gibt den Preis fÃŒr das Frontend zurÃŒck
-		 */
-		public function getPrice($taxView = false)
-		{
-
-			if ($taxView === false)
-			{
-
-				if (is_admin()) $taxView = $this->shop->getBackendTaxview();
-				else $taxView = $this->shop->getFrontendTaxview();
-
-			}
-
-			if ($taxView === WPSG_BRUTTO)
-			{
-
-				$price = $this->loadedData['preis_brutto'];
-
-			}
-			else
-			{
-
-				$price = $this->loadedData['preis_netto'];
-
-			}
-
-			return $price;
+		 * @param $product_key Produktkey
+		 * @param $taxView Anzuzeigende Steuer
+		 */
+		public function getPrice($product_key = false, $taxView = false) {
+ 
+			$cache_key = 'price_'.strval($product_key).'_'.strval($taxView);
+			
+			if (!isset($this->_cache[$cache_key])) {
+			
+				// Grundpreis aus dem Produkt
+				if ($this->shop->getBackendTaxview() === WPSG_BRUTTO) {
+					
+					$price_brutto = $this->data['preis'];
+					$price_netto = wpsg_calculatePreis($price_brutto, WPSG_NETTO,$this->shop->getDefaultCountry()->getTax($this->data['mwst_key']));
+					
+				} else {
+					
+					$price_netto = $this->data['preis'];
+					$price_brutto = wpsg_calculatePreis($price_netto, WPSG_BRUTTO, $this->shop->getDefaultCountry()->getTax($this->data['mwst_key']));
+					
+				}
+				
+				// Staffelpreis
+				$this->shop->callMod('wpsg_mod_scaleprice','product_getPrice', [&$this, &$price_netto, &$price_brutto, $product_key]);
+				
+				// Varianten 
+				$this->shop->callMod('wpsg_mod_productvariants', 'product_getPrice', [&$this, &$price_netto, &$price_brutto, $product_key]);
+				
+				// Rabatte
+				$this->shop->callMod('wpsg_mod_discount', 'product_getPrice', [&$this, &$price_netto, &$price_brutto, $product_key]);
+				 
+				if ($taxView === false)
+				{
+					
+					if (is_admin()) $taxView = $this->shop->getBackendTaxview();
+					else $taxView = $this->shop->getFrontendTaxview();
+					
+				}
+				
+				if ($taxView === WPSG_BRUTTO)
+				{
+					
+					$price = $price_brutto;
+					
+				}
+				else
+				{
+					
+					$price = $price_netto;
+					
+				} 
+				
+				$this->_cache[$cache_key] = $price;
+				
+			}  
+			
+			return $this->_cache[$cache_key];
 
 		}
Index: /mods/wpsg_mod_basic.class.php
===================================================================
--- /mods/wpsg_mod_basic.class.php	(revision 7275)
+++ /mods/wpsg_mod_basic.class.php	(revision 7276)
@@ -296,4 +296,12 @@
 		
 		/**
+		 * @param wpsg_product $oProduct
+		 * @param double $price_netto
+		 * @param double $price_brutto
+		 * @param string $product_key
+		 */
+		public function product_getPrice(&$oProduct, &$price_netto, &$price_brutto, $product_key) { }
+		
+		/**
 		 * Integration von Modulen in die Produktverwaltung 
 		 * @param Array $product_content Hier ist die Konfiguration der Reiter drin. { "title":"", "content":"" } 
Index: /mods/wpsg_mod_discount.class.php
===================================================================
--- /mods/wpsg_mod_discount.class.php	(revision 7275)
+++ /mods/wpsg_mod_discount.class.php	(revision 7276)
@@ -246,5 +246,5 @@
 		} // public function getDiscountPrice($product_id, $price)
 
-		public function loadProduktArray(&$product_data)
+		public function loadProduktArray0(&$product_data)
 		{
 
@@ -306,5 +306,57 @@
 
 		} // public function loadProduktArray(&$produkt_data)
-
+		
+		public function product_getPrice(&$oProduct, &$price_netto, &$price_brutto, $product_key) {
+			
+			$arDiscountTypes = $this->getHierarchie();
+			
+			if (wpsg_isSizedArray($arDiscountTypes)) {
+					
+				foreach ($arDiscountTypes as $discount_type) {
+					
+					$discount_value = false;
+			
+					if ($discount_type == 'product' && $this->hasProductDiscount($oProduct->id)) {
+						
+						$discount_value = $this->getProductDiscount($oProduct->id);
+						
+					} else if ($discount_type == 'productgroup' && $this->hasProductgroupDiscount($oProduct->id)) {
+						
+						$discount_value = $this->getProductgroupDiscount($oProduct->id);
+						
+					} else if ($discount_type == 'general' && $this->hasGeneralProductdiscount()) {
+						
+						$discount_value = $this->getGeneralProductdiscount();
+						
+					} else if ($discount_type == 'customer' && $this->hasCustomergroupRabatt()) {
+						
+						$discount_value = $this->getCustomergroupRabatt();
+						
+					}
+			
+					if (wpsg_tf($discount_value) > 0) {
+			
+						if ($this->shop->getBackendTaxview() == WPSG_NETTO) {
+							
+							$this->applyDiscount($discount_value, $price_netto);	
+							$price_brutto = wpsg_calculatePreis($price_netto, WPSG_BRUTTO, $this->shop->getDefaultCountry()->getTax($oProduct->mwst_key));
+							
+						} else {
+							
+							$this->applyDiscount($discount_value, $price_brutto);
+							$price_netto = wpsg_calculatePreis($price_brutto, WPSG_NETTO, $this->shop->getDefaultCountry()->getTax($oProduct->mwst_key));
+							
+						}
+						 						
+						if (wpsg_isSizedInt($this->shop->get_option('wpsg_mod_discount_stopRabatt'))) break;
+						
+					}
+					
+				}
+				
+			}
+			
+		}
+		
 		public function wpsg_mod_productgroups_addedit_sidebar(&$productgroupdata)
 		{
@@ -550,6 +602,6 @@
 		 */
 		public function basket_toArray_discount(&$basket, &$arReturn)
-		{
-
+		{ 
+			
 			// Analog Gutschein, fÃŒr den Warenkorbrabatt
 
@@ -848,4 +900,21 @@
 		} // public function applyDiscountToVariData($discount_value, &$varianten_data, $discount_type)
 
+		private function applyDiscount($discount_value, &$price) {
+			
+			if (strpos($discount_value, '%') !== false)
+			{
+				
+				$price = $price - ($price * wpsg_tf($discount_value) / 100); 
+				
+			}
+			else
+			{
+				
+				$price = $price - wpsg_tf($discount_value); 
+				
+			}
+			
+		} // C:\xampp\htdocs\wp.home\wpsg4\wp-content\plugins\wpshopgermany-free\mods\wpsg_mod_discount.class.php
+		
 		/**
 		 * Bearbeitet einen Array mit Produktinformationen mit dem Rabatt
Index: /mods/wpsg_mod_productvariants.class.php
===================================================================
--- /mods/wpsg_mod_productvariants.class.php	(revision 7275)
+++ /mods/wpsg_mod_productvariants.class.php	(revision 7276)
@@ -905,6 +905,48 @@
 
         } // public function produkt_ajax()
-
-		/**
+		
+		public function product_getPrice(&$oProduct, &$price_netto, &$price_brutto, $product_key) {
+			
+			if ($this->isVariantsProduct($oProduct->id)) {
+				
+				$arVariant = $this->getVariants($oProduct->id, true, true, true);
+				
+				if ($product_key === false) {
+					
+					// StandardschlÃŒssel ermitteln
+										
+					foreach ($arVariant as $variant_id => $variant_data)
+					{
+						
+						$arDefaultKeyValues = $variant_id.':'.array_keys($variant_data['arVariation'])[0];
+						$arDefaultKey[] = $arDefaultKeyValues;
+						
+					}
+					
+					$product_key = 'pv_'.$oProduct->id.'|'.implode('|', $arDefaultKey);
+					
+				}
+				
+			}
+			
+			if ($this->isVariantsProductKey($product_key)) {
+				
+				if ($this->shop->getBackendTaxView() === WPSG_BRUTTO) {
+						
+					$price_brutto = $this->calculateVariantsPrice($price_brutto, $arVariant, $product_key);
+					$price_netto = wpsg_calculatePreis($price_brutto, WPSG_NETTO, $this->shop->getDefaultCountry()->getTax($oProduct->mwst_key));
+					
+				} else {
+					
+					$price_netto = $this->calculateVariantsPrice($price_netto, $arVariant, $product_key);
+					$price_brutto = wpsg_calculatePreis($price_netto, WPSG_BRUTTO, $this->shop->getDefaultCountry()->getTax($oProduct->mwst_key));
+					
+				}
+				
+			}
+			
+		}
+			
+			/**
 		 * Darf das Produkt gekauft werden?
 		 */
Index: /mods/wpsg_mod_scaleprice.class.php
===================================================================
--- /mods/wpsg_mod_scaleprice.class.php	(revision 7275)
+++ /mods/wpsg_mod_scaleprice.class.php	(revision 7276)
@@ -317,7 +317,55 @@
 		} // public function product_bottom(&$produkt_id, $template_index)
 		
-		public function loadProduktArray(&$product_data)
-		{
-
+		/**
+		 * @param wpsg_product $oProduct
+		 * @param double $price_netto
+		 * @param double $price_brutto
+		 * @param string ProduktschlÃŒssel
+		 */
+		public function product_getPrice(&$oProduct, &$price_netto, &$price_brutto, $product_key) { 
+			 
+			if ($product_key === false) $product_key = $oProduct->id;
+			
+			if ($oProduct->wpsg_mod_scaleprice_activ === '1') {
+				
+				if ($oProduct->wpsg_mod_scaleprice_typ == wpsg_mod_scaleprice::TYP_QUANTITY) {
+					
+					$amount_basket = 0;
+					
+					// Menge im Warenkorb bestimmen
+					foreach ($_SESSION['wpsg']['basket'] as $product_index => $basket_data) if ($this->shop->getProduktID($basket_data['id']) == $oProduct->id) $amount_basket += $basket_data['menge'];
+					
+					$scale = $amount_basket;
+					
+				} else if ($this->shop->hasMod('wpsg_mod_weight') && $oProduct->wpsg_mod_scaleprice_typ == wpsg_mod_scaleprice::TYP_WEIGHT) {
+					
+					$weight_basket = 0;
+					
+					// Menge im Warenkorb bestimmen
+					foreach ($_SESSION['wpsg']['basket'] as $product_index => $basket_data) if ($this->shop->getProduktID($basket_data['id']) == $oProduct->id) $weight_basket += $basket_data['menge'] * $this->shop->callMod('wpsg_mod_weight', 'getWeight', [$product_key]);
+					 
+					$scale = $weight_basket;
+										
+				} else throw new \wpsg\Exception(__('UngÃŒltige Preisberechnung bei Produkttemplate', 'wpsg'));
+				
+				if ($this->shop->getBackendTaxview() === WPSG_BRUTTO) {
+					
+					$price_brutto = $this->getScalePrice($oProduct, $price_brutto, $scale);
+					$price_netto = wpsg_calculatePreis($price_brutto, WPSG_NETTO, $this->shop->getDefaultCountry()->getTax($oProduct->mwst_key));
+					
+				} else {
+				
+					$price_netto = $this->getScalePrice($oProduct, $price_netto, $scale);
+					$price_brutto = wpsg_calculatePreis($price_netto, WPSG_BRUTTO, $this->shop->getDefaultCountry()->getTax($oProduct->mwst_key));
+					
+				}
+				
+			}
+			
+		}
+		
+		public function loadProduktArray0(&$product_data)
+		{
+ 
 			$product_key = $product_data['id'];
 			$product_id = $this->shop->getProduktId($product_key);
@@ -331,5 +379,5 @@
 
 					$scale = ((isset($product_data['menge']))?$product_data['menge']:0);
-				
+					 
 				}
 				else if ($this->shop->hasMod('wpsg_mod_weight') && $product_data_db['wpsg_mod_scaleprice_typ'] == wpsg_mod_scaleprice::TYP_WEIGHT)
@@ -355,5 +403,5 @@
 					
 				}
-				
+				 
 				$product_data['preis_brutto'] = $preis_brutto;
 				$product_data['preis_netto'] = $preis_netto;
@@ -388,17 +436,14 @@
 		/* Modulfunktionen */
 		
-		private function getScalePrice($product_id, $price, $scale)
-		{
-			
-			$arScale = $this->db->fetchAssoc("SELECT * FROM `".WPSG_TBL_SCALEPRICE."` WHERE `product_id` = '".wpsg_q($product_id)."' ORDER BY `scale` ASC");
-			$produkt_data = $this->shop->cache->loadProduct($product_id);
+		private function getScalePrice($oProduct, $price, $scale)
+		{
+			
+			$arScale = $this->db->fetchAssoc("SELECT * FROM `".WPSG_TBL_SCALEPRICE."` WHERE `product_id` = '".wpsg_q($oProduct->id)."' ORDER BY `scale` ASC");
 			
 			$set_scale = false;
 			
-			foreach ($arScale as $s)
-			{
+			foreach ($arScale as $s) {
 				 
-				if (wpsg_tf($scale) >= wpsg_tf($s['scale']))
-				{
+				if (wpsg_tf($scale) >= wpsg_tf($s['scale'])) {
 					
 					$set_scale = wpsg_tf($s['value']);
@@ -409,24 +454,17 @@
 			}
 			
-			if ($set_scale !== false)
-			{
-				
-				if ($produkt_data['wpsg_mod_scaleprice_calc'] == wpsg_mod_scaleprice::CALC_REPLACE)
-				{ 
+			if ($set_scale !== false) {
+				
+				if ($oProduct->wpsg_mod_scaleprice_calc == wpsg_mod_scaleprice::CALC_REPLACE) { 
 					
 					return $set_scale;
 					
-				}
-				else if ($produkt_data['wpsg_mod_scaleprice_calc'] == wpsg_mod_scaleprice::CALC_ADD)
-				{
+				} else if ($oProduct->wpsg_mod_scaleprice_calc == wpsg_mod_scaleprice::CALC_ADD) {
 					
 					return $price + $set_scale;
 					
-				}
-				else throw new \wpsg\Exception(__('UngÃŒltige Preisberechnung im Frontend', 'wpsg'));
-				
-			}
-			else
-			{
+				} else throw new \wpsg\Exception(__('UngÃŒltige Preisberechnung im Frontend', 'wpsg'));
+				
+			} else {
 			
 				return $price;
Index: /mods/wpsg_mod_weight.class.php
===================================================================
--- /mods/wpsg_mod_weight.class.php	(revision 7275)
+++ /mods/wpsg_mod_weight.class.php	(revision 7276)
@@ -117,6 +117,6 @@
 
 			if ($this->shop->get_option('wpsg_mod_weight_showBasket') != '1') return;
-
-			$this->shop->view['wpsg_mod_weight']['weight'] = $basket_view['basket']['sum']['weight'];
+						
+			$this->shop->view['wpsg_mod_weight']['weight'] = $this->getSessionBasketWeight();
 
 			$this->shop->render(WPSG_PATH_VIEW.'/mods/mod_weight/basket_row_end.phtml');
@@ -244,5 +244,26 @@
 		
 		/* --- */
-
+		
+		/**
+		 * Gibt das Gewicht der Produkte im aktuellen Warenkorb zurÃŒck (Session)
+		 */
+		private function getSessionBasketWeight() {
+			
+			$basket_amount = 0;
+			
+			if (wpsg_isSizedArray($_SESSION['wpsg']['basket'])) {
+								
+				foreach ($_SESSION['wpsg']['basket'] as $product_index => $product_data) {
+					
+					$basket_amount += $this->getWeight($product_data['id']) * $product_data['menge'];
+					
+				}
+								
+			}
+			
+			return $basket_amount;
+			
+		}
+		
 		public function getWeight($product_key)
 		{
Index: /wpshopgermany.php
===================================================================
--- /wpshopgermany.php	(revision 7275)
+++ /wpshopgermany.php	(revision 7276)
@@ -12,6 +12,4 @@
 	*/
  
-	//error_reporting(E_ALL); ini_set("display_errors", "1");
-
 	define('WPSG_VERSION', '9.9.9');
 
