Index: /lib/wpsg_calculation.class.php
===================================================================
--- /lib/wpsg_calculation.class.php	(revision 7462)
+++ /lib/wpsg_calculation.class.php	(revision 7464)
@@ -393,90 +393,108 @@
             	//die(wpsg_debug($this->arCalculationRow));
 				  
+				wpsg_debug("CALC");
+				
                 foreach ($this->arCalculationRow as $cr) {
                 	             
                 	$this->addTax($cr['tax_key']);
                 	$this->calculateTaxProportionally($cr['bruttonetto']);
-							   
-                	if (strpos($cr['set'], '|') !== false) {
-		                		
-                		list($typ, $cr['set']) = explode('-', $cr['set']);
+							
+                	if (!is_array($cr['set'])) $cr['set'] = [$cr['set']];
+                	
+                	$brutto = 0;
+                	$netto = 0;
+                	
+                	foreach ($cr['set'] as $set) {
+		
+						$set_brutto = 0;
+						$set_brutto = 0;
                 		
-						$arKosten = explode('|', $cr['set']);
-						$arKosten = array_reverse($arKosten);
-		
-						if ($typ === 'w') $value = (($this->shop->getBackendTaxview() === WPSG_NETTO)?$this->arCalculation['sum']['productsum_netto']:$this->arCalculation['sum']['productsum_brutto']);
-						else if ($typ === 's') $value = $this->arCalculation['sum']['amount']; // Menge
-						else if ($typ === 'g') $value = $this->dWeight; // Gewicht
-						else throw new \Exception(wpsg_translate(__('Typ (#1#) fÃŒr KostenschlÃŒssel nicht definiert.', 'wpsg'), $typ));
-						
-						foreach ($arKosten as $k) {
-			
-							$arP = explode(":", $k);
-			
-							if (sizeof($arP) == 1) $kosten = $arP[0];
-							else if (wpsg_tf($arP[0]) <= $value) $kosten = $arP[1];
-			
+						if (strpos($set, '|') !== false) {
+									
+							list($typ, $set) = explode('-', $set);
+							
+							$arKosten = explode('|', $set);
+							$arKosten = array_reverse($arKosten);
+			
+							if ($typ === 'w') $value = (($this->shop->getBackendTaxview() === WPSG_NETTO)?$this->arCalculation['sum']['productsum_netto']:$this->arCalculation['sum']['productsum_brutto']);
+							else if ($typ === 's') $value = $this->arCalculation['sum']['amount']; // Menge
+							else if ($typ === 'g') $value = $this->dWeight; // Gewicht
+							else throw new \Exception(wpsg_translate(__('Typ (#1#) fÃŒr KostenschlÃŒssel nicht definiert.', 'wpsg'), $typ));
+							
+							foreach ($arKosten as $k) {
+				
+								$arP = explode(":", $k);
+				
+								if (sizeof($arP) == 1) $kosten = $arP[0];
+								else if (wpsg_tf($arP[0]) <= $value) $kosten = $arP[1];
+				
+							}
+							
+							$kosten = wpsg_tf($kosten);
+				
+							if ($this->shop->getBackendTaxview() === WPSG_NETTO) {
+								
+								list($set_netto, $set_brutto) = $this->calculateTaxPart(WPSG_NETTO, $kosten, $cr['tax_key']);
+								
+							} else {
+								
+								list($set_netto, $set_brutto) = $this->calculateTaxPart(WPSG_BRUTTO, $kosten, $cr['tax_key']);
+								
+							}
+							
+						} else if (strpos($set, '%') !== false) {
+							
+							// Prozentualer Wert
+							$set_netto = $this->arCalculation['sum']['netto'] / 100 * wpsg_tf($set);
+							$set_brutto = $this->arCalculation['sum']['brutto'] / 100 * wpsg_tf($set);
+					
+						} else {
+							
+							if (preg_match('/^(.*)\-(.*)$/', $set)) {
+								
+								list($typ, $set) = explode('-', $set);
+								
+							}
+							
+							// Netto / Brutto berechnen
+							if ($cr['bruttonetto'] === WPSG_NETTO) {
+								
+								$set_netto = wpsg_tf($set);
+								
+								list($set_netto, $set_brutto) = $this->calculateTaxPart(WPSG_NETTO, $set_netto, $cr['tax_key']);
+													
+							} else {
+																							
+								if (wpsg_isTrue($cr['data']['targetCountry'])) {
+								
+									$tax_key_part = preg_replace('/\_(.*)/', '', $cr['tax_key']);
+									
+									$tax_default = $this->arCountry[$this->getDefaultCountryID()][$tax_key_part.'_'.$this->getDefaultCountryID()];
+									$tax_target = $this->arCountry[$this->getTargetCountryID()][$tax_key_part.'_'.$this->getTargetCountryID()];
+									
+									$set_brutto = wpsg_calculatePreis(
+										wpsg_calculatePreis(wpsg_tf($set), WPSG_NETTO, $tax_default),
+										WPSG_BRUTTO,
+										$tax_target
+									);
+									
+								} else {
+									
+									$set_brutto = wpsg_tf($set);
+									
+								}
+								
+								list($set_netto, $set_brutto) = $this->calculateTaxPart(WPSG_BRUTTO, $set_brutto, $cr['tax_key']);
+								
+							}
+																									
 						}
-						
-						$kosten = wpsg_tf($kosten);
-			
-						if ($this->shop->getBackendTaxview() === WPSG_NETTO) {
-							
-							list($netto, $brutto) = $this->calculateTaxPart(WPSG_NETTO, $kosten, $cr['tax_key']);
-							
-						} else {
-							
-							list($netto, $brutto) = $this->calculateTaxPart(WPSG_BRUTTO, $kosten, $cr['tax_key']);
-							
-						}
-                		
-					} else if (strpos($cr['set'], '%') !== false) {
-						
-						// Prozentualer Wert
-						$netto = $this->arCalculation['sum']['netto'] / 100 * wpsg_tf($cr['set']);
-						$brutto = $this->arCalculation['sum']['brutto'] / 100 * wpsg_tf($cr['set']);
-				
-					} else {
-												
-						// Netto / Brutto berechnen
-						if ($cr['bruttonetto'] === WPSG_NETTO) {
-							
-							$netto = wpsg_tf($cr['set']);
-							
-							list($netto, $brutto) = $this->calculateTaxPart(WPSG_NETTO, $netto, $cr['tax_key']); 
-							
-							
-						} else {
-							
-							if (preg_match('/^(.*)\-(.*)$/', $cr['set'])) {
-								
-								list($typ, $cr['set']) = explode('-', $cr['set']);
-								
-							}
-														
-							if (wpsg_isTrue($cr['data']['targetCountry'])) {
-							
-								$tax_key_part = preg_replace('/\_(.*)/', '', $cr['tax_key']);
-								
-								$tax_default = $this->arCountry[$this->getDefaultCountryID()][$tax_key_part.'_'.$this->getDefaultCountryID()];
-								$tax_target = $this->arCountry[$this->getTargetCountryID()][$tax_key_part.'_'.$this->getTargetCountryID()];
-																
-								$brutto = wpsg_calculatePreis(
-									wpsg_calculatePreis(wpsg_tf($cr['set']), WPSG_NETTO, $tax_default),
-									WPSG_BRUTTO,
-									$tax_target
-								);
-								
-							} else {
-							
-								$brutto = wpsg_tf($cr['set']);
-								
-							}
-							
-							list($netto, $brutto) = $this->calculateTaxPart(WPSG_BRUTTO, $brutto, $cr['tax_key']);
-								
-						}
-																								
+											
+						$netto += $set_netto;
+						$brutto += $set_brutto;
+						
 					}
+	
+					$cr['set'] = array_values($cr['set'])[0];
 						
 					//$country_id = preg_replace('/(.*)\_/', '',$cr['tax_key']);
@@ -1001,5 +1019,5 @@
 				
 				$payment = $this->shop->arPayment[$_SESSION['wpsg']['checkout']['payment']];
-				
+												
 				if (wpsg_isSizedArray($payment)) $this->addPayment($payment['price'], $this->shop->getBackendTaxview(), @$payment['tax_key'], $_SESSION['wpsg']['checkout']['payment']);
 				
@@ -1011,5 +1029,17 @@
 				$shipping = $this->shop->arShipping[$_SESSION['wpsg']['checkout']['shipping']];
 				
-				if (wpsg_isSizedArray($shipping)) $this->addShipping($shipping['price'], $this->shop->getBackendTaxview(), $shipping['tax_key'], $_SESSION['wpsg']['checkout']['shipping']);
+				if (wpsg_isSizedArray($shipping['sub'])) {
+					 
+					$price = [];
+					
+					foreach ($shipping['sub'] as $sub_shipping) {
+						
+						$price[] = $sub_shipping['price'];
+						
+					}
+					
+				} else $price = $shipping['price'];
+				
+				if (wpsg_isSizedArray($shipping)) $this->addShipping($price, $this->shop->getBackendTaxview(), $shipping['tax_key'], $_SESSION['wpsg']['checkout']['shipping']);
 				
 			}
