Index: /changelog
===================================================================
--- /changelog	(revision 8131)
+++ /changelog	(revision 8132)
@@ -528,2 +528,3 @@
 - Feature: Exportprofile: XML Erstellung verbessert
 - Feature: Exportprofile: Automatischer Export bei Bestellung
+- Feature: Vorgabe Standardversand je Versandzone
Index: /controller/wpsg_ShopController.class.php
===================================================================
--- /controller/wpsg_ShopController.class.php	(revision 8131)
+++ /controller/wpsg_ShopController.class.php	(revision 8132)
@@ -1939,6 +1939,19 @@
 			
 			if (!wpsg_isSizedString($_SESSION['wpsg']['checkout']['shipping']) && wpsg_isSizedString($this->get_option('wpsg_customerpreset_shipping')) && sizeof($_SESSION['wpsg']['basket']??[]) > 0) {
-
-				if ($this->get_option('wpsg_customerpreset_shipping') === '-1') {
+				
+				$land_id = intval($_SESSION['wpsg']['checkout']['land']);
+				$preset = $this->get_option('wpsg_customerpreset_shipping');
+				
+				if ($land_id > 0) {
+					
+					$oCountry = wpsg_country::getInstance($land_id);
+					
+					$preset_vz = $oCountry->__get('shippingpreset');
+					
+					if ($preset_vz !== '' && $preset_vz !== '0') $preset = $preset_vz;
+										
+				}
+
+				if ($preset === '-1') {
 					 
 					$min_shipping_key = null; $min_shipping_cost = null;
@@ -1976,9 +1989,9 @@
 					}  
 					
-				} else if (isset($this->arShipping[$this->get_option('wpsg_customerpreset_shipping')])) {
-				
-					$this->basket->arCheckout['shipping'] = $this->get_option('wpsg_customerpreset_shipping');
+				} else if (isset($this->arShipping[$preset])) {
+				
+					$this->basket->arCheckout['shipping'] = $preset;
 					
-					$_SESSION['wpsg']['checkout']['shipping'] = $this->get_option('wpsg_customerpreset_shipping');
+					$_SESSION['wpsg']['checkout']['shipping'] = $preset;
 					$oCalculation->update();
 					
@@ -4692,15 +4705,14 @@
 		 * In $this->arShipping sind schon die zusammengefÃŒgten Pakete drin
 		 */
-		public function getShippingName($shipping_key)
-		{
-
-			if (array_key_exists($shipping_key, $this->arShipping))
-			{
+		public function getShippingName($shipping_key, $lookAll = false) {
+
+			if ($lookAll) $arShipping = $this->arShippingAll;
+			else $arShipping = $this->arShipping;
+			
+			if (array_key_exists($shipping_key, $arShipping)) {
 
 				return __($this->arShipping[$shipping_key]['name'], 'wpsg');
 
-			}
-			else
-			{
+			} else {
 
 				return wpsg_translate(__('Deaktivierte Versandart (#1#)', 'wpsg'), $shipping_key);
Index: /lib/install.php
===================================================================
--- /lib/install.php	(revision 8131)
+++ /lib/install.php	(revision 8132)
@@ -239,4 +239,5 @@
 		name VARCHAR(255) NOT NULL,
 		innereu int(1) NOT NULL,
+		shippingpreset varchar(100) NOT NULL,
 		param TEXT NOT NULL,
 		PRIMARY KEY  (id)		
Index: /model/wpsg_country.class.php
===================================================================
--- /model/wpsg_country.class.php	(revision 8131)
+++ /model/wpsg_country.class.php	(revision 8132)
@@ -15,5 +15,13 @@
 			parent::load($country_id);
 			
-			$this->data = $this->db->fetchRow("SELECT L.* FROM `".WPSG_TBL_LAND."` AS L WHERE L.`id` = '".wpsg_q($country_id)."' ");
+			$this->data = $this->db->fetchRow("
+				SELECT
+					L.*, VZ.`shippingpreset`
+				FROM 
+				    `".WPSG_TBL_LAND."` AS L
+				        LEFT JOIN `".WPSG_TBL_VZ."` AS VZ ON (VZ.`id` = L.`vz`) 
+				WHERE 
+					L.`id` = '".wpsg_q($country_id)."' 
+			");
 			
 			if (!wpsg_isSizedArray($this->data) || $this->data['id'] != $country_id || !wpsg_isSizedInt($this->data['id'])) {
Index: /mods/wpsg_mod_export.class.php
===================================================================
--- /mods/wpsg_mod_export.class.php	(revision 8131)
+++ /mods/wpsg_mod_export.class.php	(revision 8132)
@@ -607,5 +607,5 @@
         } // public function be_ajax()
 
-	    public function basket_save_done($order_id, $customer_id, $oBasket) {
+	    public function basket_save_done(&$order_id, $customer_id, $oBasket) {
 			
 			$arProfile = $this->db->fetchAssoc("
@@ -618,6 +618,9 @@
 					EXP.`export_type` = '".wpsg_q(self::TYPE_ORDER)."'
 			");
+						
+			foreach ($arProfile as $profil) {
 			
-			foreach ($arProfile as $profil) {
+				$this->shop->cache->clearOrderCache($order_id);
+				wpsg_order::clearCache($order_id);
 				
 				$arFilter = ['id' => $order_id];
@@ -640,4 +643,9 @@
 
                 }
+				
+				// Letzte AusfÃŒhrung speichern
+                $this->db->UpdateQuery(WPSG_TBL_EXPORTPROFILE, array(
+                    'cron_lastrun' => 'NOW()'
+                ), " `id` = '".wpsg_q($profil['id'])."' ");
 				
 			}
@@ -2294,5 +2302,5 @@
 
                         $return = false;
-						
+					 
                         $this->shop->callMods('wpsg_mod_export_getValue', array(&$return, $field_value, $o_id, $p_id, $order_product_id, $profil_separator));
 
Index: /mods/wpsg_mod_productvariants.class.php
===================================================================
--- /mods/wpsg_mod_productvariants.class.php	(revision 8131)
+++ /mods/wpsg_mod_productvariants.class.php	(revision 8132)
@@ -2349,4 +2349,5 @@
             $arFields[10]['fields']['wpsg_mod_productvariants_varname'] = __('Varianten Name', 'wpsg');
             $arFields[10]['fields']['wpsg_mod_productvariants_varanr'] = __('Varianten Artikelnummer', 'wpsg');
+            $arFields[10]['fields']['wpsg_mod_productvariants_product_varname'] = __('Produktname / Varianten Name', 'wpsg');
 	
 			$arVariant = $this->db->fetchAssoc("
@@ -2377,60 +2378,66 @@
         public function wpsg_mod_export_getValue(&$return, $field_value, $o_id, $p_id, $order_product_id, $profil_separator) {
 
-			if ($order_product_id === null) return;
+			if (wpsg_isSizedInt($order_product_id)) {
 			
-			$oOrderProduct = wpsg_order_product::getInstance($order_product_id);
-			
-			$product_key = $oOrderProduct->getId();
-			
-		    if (preg_match('/^var_\d+$/', $field_value)) {
-		        
-		        $var_id = intval(substr($field_value, 4));
-		        $arProductKey = $this->explodeProductKey($product_key);
-		        $arVariation = $this->getVariationOfVariant($var_id);
-		        
-		        $return = $arVariation[$arProductKey['arVari'][$var_id]]['name'];
-		        		        
-            } else if (in_array($field_value, ['wpsg_mod_productvariants_varname', 'wpsg_mod_productvariants_varanr'])) {
-            
-                $return = '';
-    
-                $arProductExportProductKeys = [];
-                $arReturn = [];
-    
-                if (wpsg_isSizedString($product_key)) $arProductExportProductKeys = [$product_key];
-                else {
-    
-                    $oOrder = wpsg_order::getInstance($o_id);
-    
-                    /** @var \wpsg_order_product $oOrderProducts */
-                    foreach ($oOrder->getOrderProducts() as $oOrderProduct) {
-    
-                        if (!in_array($oOrderProduct->getProductKey(), $arProductExportProductKeys)) $arProductExportProductKeys[] = $oOrderProduct->getProductKey();
-    
-                    }
-    
-                }
-                
-                foreach ($arProductExportProductKeys as $product_key) {
-                    
-                    if ($this->isVariantsProductKey($product_key)) {
-        
-                        $arVariInfo = $this->getVariantenInfoArray($product_key);
-                        
-                        if ($field_value === 'wpsg_mod_productvariants_varname') {
-                                                
-                            $return = $arVariInfo['key']; 
-                            
-                        } else if ($field_value === 'wpsg_mod_productvariants_varanr') {
-        
-                            $return = $arVariInfo['akey'];
-        
-                        }
-                        
-                    }
-                    
-                }
-                
-            }
+				$oOrderProduct = wpsg_order_product::getInstance($order_product_id);
+				  
+				$product_key = $oOrderProduct->getProductKey();
+				 
+			    if (preg_match('/^var_\d+$/', $field_value)) {
+			        
+			        $var_id = intval(substr($field_value, 4));
+			        $arProductKey = $this->explodeProductKey($product_key);
+			        $arVariation = $this->getVariationOfVariant($var_id);
+			        
+			        $return = $arVariation[$arProductKey['arVari'][$var_id]]['name'];
+			                        
+	            } else if (in_array($field_value, ['wpsg_mod_productvariants_varname', 'wpsg_mod_productvariants_varanr', 'wpsg_mod_productvariants_product_varname'])) {
+	           
+	                $return = '';
+	    
+	                $arProductExportProductKeys = [];
+	                $arReturn = [];
+	   
+	                if (wpsg_isSizedString($product_key)) $arProductExportProductKeys = [$product_key];
+	                else {
+	    
+	                    $oOrder = wpsg_order::getInstance($o_id);
+	    
+	                    /** @var \wpsg_order_product $oOrderProducts */
+	                    foreach ($oOrder->getOrderProducts() as $oOrderProduct) {
+	    
+	                        if (!in_array($oOrderProduct->getProductKey(), $arProductExportProductKeys)) $arProductExportProductKeys[] = $oOrderProduct->getProductKey();
+	    
+	                    }
+	    
+	                }
+	                	                
+					foreach ($arProductExportProductKeys as $product_key) {
+	                    
+	                    if ($this->isVariantsProductKey($product_key)) {
+	        
+	                        $arVariInfo = $this->getVariantenInfoArray($product_key);
+	                        
+	                        if ($field_value === 'wpsg_mod_productvariants_varname') {
+	                                           
+	                            $return = $arVariInfo['key'];
+
+	                        } else if ($field_value === 'wpsg_mod_productvariants_product_varname') {
+								
+								$return = $oOrderProduct->getProduct()->getProductName().' / '.$arVariInfo['key'];
+								
+	                        } else if ($field_value === 'wpsg_mod_productvariants_varanr') {
+	        
+	                            $return = $arVariInfo['akey'];
+	        
+	                        }
+	                        
+	                    }
+	                    
+	                }
+	                
+	            }
+
+			}
             
         }
Index: /views/admin/versandzonen_list.phtml
===================================================================
--- /views/admin/versandzonen_list.phtml	(revision 8131)
+++ /views/admin/versandzonen_list.phtml	(revision 8132)
@@ -5,4 +5,17 @@
 	 */
 
+    $arShipping = $this->arShippingAll;
+        
+    $arShippingPreset = [
+        '0' => __('Kundenvoreinstellung', 'wpsg'),
+        '-1' => __('gÃŒnstigste Versandart', 'wpsg'),
+    ]; 
+    
+    foreach ($arShipping as $s_key => $s) {
+        
+        $arShippingPreset[$s_key] = $s['name'];
+        
+    }
+    
 ?>
 <?php if (!is_array($this->view['data']) || sizeof($this->view['data']) <= 0) { ?>
@@ -14,4 +27,5 @@
 		<th class="col_name"><?php echo __('Bezeichnung', 'wpsg'); ?></th>
 		<th class="col_innereu"><?php echo __('Inner- gemeinschaftlich', 'wpsg'); ?></th>
+		<th class="col_shippingpreset"><?php echo __('Standardversandart', 'wpsg'); ?></th>
 		<th class="col_aktion"></th>
 	</tr>
@@ -33,4 +47,27 @@
                 <?php echo (($vz['innereu'] == '1')?'checked="checked"':''); ?> type="checkbox" value="1" name="innereu_<?php echo $vz['id']; ?>" id="innereu_<?php echo $vz['id']; ?>" />
 		</td>
+        <td class="col_shippingpreset">
+            <span id="vz_<?php echo $vz['id']; ?>_shippingpreset"><?php echo wpsg_hspc(wpsg_getStr($arShippingPreset[$vz['shippingpreset']], __('Kundenvoreinstellung', 'wpsg'))); ?></span>
+            <script>
+                
+                jQuery('#vz_<?php echo $vz['id']; ?>_shippingpreset').wpsg_editable('<?php
+					
+						echo html_entity_decode(wp_nonce_url(WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Admin&subaction=vz&do=inlinedit&noheader=1', 'wpsg-admin-versandzonen-inline_edit-'.$vz['id']));
+					
+					?>', {
+					submitdata: { 
+			    		field: 'shippingpreset',
+			    		vz_id: '<?php echo $vz['id']; ?>'
+					}, 				
+                    data: <?php echo wpsg_prepare_for_inlineEdit($arShippingPreset); ?>,               
+                    type: 'select',
+					submit: '<?php echo __('Speichern', 'wpsg'); ?>',
+					placeholder: '<?php echo __('Zum Bearbeiten anklicken ...', 'wpsg'); ?>',
+					indicator: '<?php echo __('Speicher ...', 'wpsg'); ?>',
+			    	tooltip: '<?php echo __('Zum Bearbeiten anklicken ...', 'wpsg'); ?>'
+                });
+                
+            </script>
+        </td>
 		<td class="col_aktion">
 						
