Index: /controller/wpsg_OrderController.class.php
===================================================================
--- /controller/wpsg_OrderController.class.php	(revision 5891)
+++ /controller/wpsg_OrderController.class.php	(revision 5896)
@@ -584,5 +584,5 @@
 			$this->shop->view['tabs'] = array('left' => array(), 'right' => array());
 
-			$this->shop->callMods('product_index_tab', array(&$this->shop->view['tabs']));
+			$this->shop->callMods('order_index_tab', array(&$this->shop->view['tabs']));
 
 			if (wpsg_isSizedArray($_REQUEST['filter']))
Index: /mods/wpsg_mod_basic.class.php
===================================================================
--- /mods/wpsg_mod_basic.class.php	(revision 5891)
+++ /mods/wpsg_mod_basic.class.php	(revision 5896)
@@ -246,8 +246,8 @@
 
 		/** Integriert eine Reiter in die BestellÃŒberischt */
-		public function product_index_tab(&$arTabs) { }
+		public function order_index_tab(&$arTabs) { }
 		
 		/** Integriert sich in die Bestellverwaltung nach dem Suchformular */
-		public function produkt_index_aftersearch() { }
+		public function order_index_aftersearch() { }
 		
 		/** Wird beim bearbeiten eines Produktes aufgerufen, hier kann der Array modifiziert werden, der an das view ÃŒbergeben wird */
Index: /mods/wpsg_mod_export.class.php
===================================================================
--- /mods/wpsg_mod_export.class.php	(revision 5891)
+++ /mods/wpsg_mod_export.class.php	(revision 5896)
@@ -15,7 +15,21 @@
 		
 		/** Array fÃŒr die mÃ¶glichen Format Umwandlungen */
-		var $arFormats = array();
-		
+		var $arFieldFormats = array();
+		
+		/** @var array Array mit den Exportformaten (XML/CSV) */
+		var $arExportFormats = array();
+		
+		/** @var array Array mit verfÃŒgbaren Charsets */
+		var $arFileEncoding = array();
+				
 		var $arCache = array();
+		
+		const TYPE_ORDER = '1';
+		
+		const ENCODING_UTF8 = '1';
+		const ENCODING_ISO88591 = '2';
+		
+		const FORMAT_CSV = '1';
+		const FORMAT_XML = '2';
 		
 		/**
@@ -24,23 +38,8 @@
 		public function __construct()
 		{ 
-			
-			/*
-			$data = @unserialize('a:6:{s:8:"filename";s:17:"bestellexport.csv";s:9:"separator";s:1:";";s:7:"oneline";s:1:"1";s:3:"iso";s:1:"1";s:16:"firstlinecolname";s:1:"1";s:6:"fields";a:35:{i:0;a:3:{s:4:"name";s:3:"OID";s:5:"value";s:8:"order_id";s:6:"format";s:1:"0";}i:1;a:2:{s:4:"name";s:3:"KID";s:5:"value";s:8:"kunde_id";}i:2;a:2:{s:4:"name";s:3:"RNR";s:5:"value";s:11:"rechnung_nr";}i:3;a:3:{s:4:"name";s:14:"Rechnungsdatum";s:5:"value";s:6:"rdatum";s:6:"format";s:3:"400";}i:4;a:2:{s:4:"name";s:6:"Status";s:5:"value";s:12:"order_status";}i:5;a:2:{s:4:"name";s:9:"Bezahlart";s:5:"value";s:20:"order_payment_method";}i:6;a:2:{s:4:"name";s:10:"Versandart";s:5:"value";s:21:"order_shipping_method";}i:7;a:2:{s:4:"name";s:4:"Name";s:5:"value";s:10:"kunde_name";}i:8;a:2:{s:4:"name";s:7:"Vorname";s:5:"value";s:13:"kunde_vorname";}i:9;a:3:{s:4:"name";s:12:"Bestelldatum";s:5:"value";s:11:"order_cdate";s:6:"format";s:3:"400";}i:10;a:3:{s:4:"name";s:11:"Gesamtpreis";s:5:"value";s:11:"order_price";s:6:"format";s:3:"200";}i:11;a:3:{s:4:"name";s:5:"Netto";s:5:"value";s:17:"order_price_netto";s:6:"format";s:3:"200";}i:12;a:2:{s:4:"name";s:9:"Kommentar";s:5:"value";s:15:"order_bemerkung";}i:15;a:2:{s:4:"name";s:5:"EMail";s:5:"value";s:11:"kunde_email";}i:16;a:2:{s:4:"name";s:8:"UStIdNr.";s:5:"value";s:11:"kunde_ustid";}i:17;a:2:{s:4:"name";s:5:"Firma";s:5:"value";s:11:"kunde_firma";}i:18;a:2:{s:4:"name";s:3:"Tel";s:5:"value";s:9:"kunde_tel";}i:19;a:2:{s:4:"name";s:3:"Fax";s:5:"value";s:9:"kunde_fax";}i:20;a:2:{s:4:"name";s:7:"Strasse";s:5:"value";s:13:"kunde_strasse";}i:21;a:2:{s:4:"name";s:3:"PLZ";s:5:"value";s:9:"kunde_plz";}i:22;a:2:{s:4:"name";s:3:"Ort";s:5:"value";s:9:"kunde_ort";}i:23;a:2:{s:4:"name";s:4:"Land";s:5:"value";s:10:"kunde_land";}i:24;a:2:{s:4:"name";s:20:"Versandadresse Firma";s:5:"value";s:11:"order_firma";}i:25;a:2:{s:4:"name";s:22:"Versandadresse Vorname";s:5:"value";s:13:"order_vorname";}i:26;a:2:{s:4:"name";s:19:"Versandadresse Name";s:5:"value";s:10:"order_name";}i:27;a:2:{s:4:"name";s:22:"Versandadresse Strasse";s:5:"value";s:13:"order_strasse";}i:28;a:2:{s:4:"name";s:18:"Versandadresse PLZ";s:5:"value";s:9:"order_plz";}i:29;a:2:{s:4:"name";s:18:"Versandadresse Ort";s:5:"value";s:9:"order_ort";}i:30;a:2:{s:4:"name";s:19:"Versandadresse Land";s:5:"value";s:10:"order_land";}i:31;a:2:{s:4:"name";s:26:"Name der Bank (Bankeinzug)";s:5:"value";s:11:"order_bname";}i:32;a:2:{s:4:"name";s:24:"Kontonummer (Bankeinzug)";s:5:"value";s:9:"order_bnr";}i:33;a:2:{s:4:"name";s:25:"BLZ der Bank (Bankeinzug)";s:5:"value";s:10:"order_bblz";}i:34;a:2:{s:4:"name";s:25:"Kontoinhaber (Bankeinzug)";s:5:"value";s:14:"order_binhaber";}i:35;a:2:{s:4:"name";s:2:"ip";s:5:"value";s:8:"order_ip";}i:36;a:2:{s:4:"name";s:9:"UserAgent";s:5:"value";s:15:"order_useragent";}}}');
-			array_splice($data['fields'], 1, 0, array(array('name' => 'ONR', 'value' => 'order_onr', 'format' => 900)));
-			array_splice($data['fields'], 3, 0, array(array('name' => 'KNR', 'value' => 'kunde_nr', 'format' => 900)));
-			$data['fields'][18]['format'] = 900;
-			$data['fields'][19]['format'] = 900;
-			$data['fields'][21]['format'] = 900;
-			$data['fields'][16]['format'] = 900;
-			$data['fields'][28]['format'] = 900;
-			$data['fields'][32]['format'] = 900;
-			$data['fields'][33]['format'] = 900;
-			$data['fields'][35]['format'] = 900;			
-			wpsg_debug($data);die(serialize($data));			
-			*/
-			
+			 
 			parent::__construct();
 						
-			$this->arFormats = array(
+			$this->arFieldFormats = array(
 				0 => __('UnverÃ€ndert', 'wpsg'),
 				100 => __('Zahl (99.99)', 'wpsg'),
@@ -55,4 +54,14 @@
 			);
 			
+			$this->arExportFormats = array(
+				self::FORMAT_CSV => __('CSV', 'wpsg'),
+				self::FORMAT_XML => __('XML', 'wpsg')
+			);
+			
+			$this->arFileEncoding = array(
+				self::ENCODING_UTF8 => __('UTF-8', 'wpsg'),
+				self::ENCODING_ISO88591 => __('ISO-8859-1', 'wpsg')
+			);
+			
 			$this->name = __('Exportprofile', 'wpsg');
 			$this->group = __('Sonstiges', 'wpsg');
@@ -71,28 +80,39 @@
 		   	$sql = "CREATE TABLE ".WPSG_TBL_EXPORTPROFILE." (
 		   		id mediumint(9) NOT NULL AUTO_INCREMENT,
-		   		name VARCHAR(255) NOT NULL,
-		   		data LONGTEXT NOT NULL,
+		   		name VARCHAR(255) NOT NULL COMMENT 'Der Name des Profils',
+		   		filename VARCHAR(255) NOT NULL COMMENT 'Dateiname fÃŒr den Export',
+		   		export_type INT(1) NOT NULL COMMENT 'Typ des Exportprofils',
+		   		format INT(1) NOT NULL COMMENT 'Format des Exportes (XML/CSV)',
+		   		field_delimiter VARCHAR(1) NOT NULL COMMENT 'Feld-Trennzeichen (CSV)',
+		   	  	field_enclosure VARCHAR(1) NOT NULL COMMENT 'Feld-Begrenzungs Zeichen (CSV)',
+		   	  	field_escape VARCHAR(1) NOT NULL COMMENT 'Maskierungs-Zeichen (CSV)',
+		   	  	order_online INT(1) NOT NULL COMMENT 'Bestellungen in einer Zeile auffÃŒhren',
+		   	  	order_onetime INT(1) NOT NULL COMMENT 'Bestellungen nur einmal exportieren',
+		   	  	csv_fieldnames INT(1) NOT NULL COMMENT 'Beim CSV Export die Feldnamen in erster Zeile auffÃŒhren',
+		   	  	file_encoding INT(1) NOT NULL COMMENT 'Encoding der Datei',		   	  	
 		   		PRIMARY KEY  (id)
 		   	) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;";
 		   	
 		   	dbDelta($sql);
-			
-		   	// StandardmÃ€Ãig einen Export vorgeben sollte keiner existieren
-		   	$existsID1 = $this->db->fetchOne("SELECT COUNT(*) FROM `".WPSG_TBL_EXPORTPROFILE."` WHERE `id` = '1'");
-		   	
-		   	if ($existsID1 <= 0)
-		   	{
-		   		
-		   		$ins_data = array(
-		   			"id" => 1,
-		   			"name" => __("Bestellexport", "wpsg"),
-		   			"data" => 'a:6:{s:8:"filename";s:17:"bestellexport.csv";s:9:"separator";s:1:";";s:7:"oneline";s:1:"1";s:3:"iso";s:1:"1";s:16:"firstlinecolname";s:1:"1";s:6:"fields";a:37:{i:0;a:3:{s:4:"name";s:3:"OID";s:5:"value";s:8:"order_id";s:6:"format";s:1:"0";}i:1;a:3:{s:4:"name";s:3:"ONR";s:5:"value";s:9:"order_onr";s:6:"format";i:900;}i:2;a:2:{s:4:"name";s:3:"KID";s:5:"value";s:8:"kunde_id";}i:3;a:3:{s:4:"name";s:3:"KNR";s:5:"value";s:8:"kunde_nr";s:6:"format";i:900;}i:4;a:2:{s:4:"name";s:3:"RNR";s:5:"value";s:11:"rechnung_nr";}i:5;a:3:{s:4:"name";s:14:"Rechnungsdatum";s:5:"value";s:6:"rdatum";s:6:"format";s:3:"400";}i:6;a:2:{s:4:"name";s:6:"Status";s:5:"value";s:12:"order_status";}i:7;a:2:{s:4:"name";s:9:"Bezahlart";s:5:"value";s:20:"order_payment_method";}i:8;a:2:{s:4:"name";s:10:"Versandart";s:5:"value";s:21:"order_shipping_method";}i:9;a:2:{s:4:"name";s:4:"Name";s:5:"value";s:10:"kunde_name";}i:10;a:2:{s:4:"name";s:7:"Vorname";s:5:"value";s:13:"kunde_vorname";}i:11;a:3:{s:4:"name";s:12:"Bestelldatum";s:5:"value";s:11:"order_cdate";s:6:"format";s:3:"400";}i:12;a:3:{s:4:"name";s:11:"Gesamtpreis";s:5:"value";s:11:"order_price";s:6:"format";s:3:"200";}i:13;a:3:{s:4:"name";s:5:"Netto";s:5:"value";s:17:"order_price_netto";s:6:"format";s:3:"200";}i:14;a:2:{s:4:"name";s:9:"Kommentar";s:5:"value";s:15:"order_bemerkung";}i:15;a:2:{s:4:"name";s:5:"EMail";s:5:"value";s:11:"kunde_email";}i:16;a:3:{s:4:"name";s:8:"UStIdNr.";s:5:"value";s:11:"kunde_ustid";s:6:"format";i:900;}i:17;a:2:{s:4:"name";s:5:"Firma";s:5:"value";s:11:"kunde_firma";}i:18;a:3:{s:4:"name";s:3:"Tel";s:5:"value";s:9:"kunde_tel";s:6:"format";i:900;}i:19;a:3:{s:4:"name";s:3:"Fax";s:5:"value";s:9:"kunde_fax";s:6:"format";i:900;}i:20;a:2:{s:4:"name";s:7:"Strasse";s:5:"value";s:13:"kunde_strasse";}i:21;a:3:{s:4:"name";s:3:"PLZ";s:5:"value";s:9:"kunde_plz";s:6:"format";i:900;}i:22;a:2:{s:4:"name";s:3:"Ort";s:5:"value";s:9:"kunde_ort";}i:23;a:2:{s:4:"name";s:4:"Land";s:5:"value";s:10:"kunde_land";}i:24;a:2:{s:4:"name";s:20:"Versandadresse Firma";s:5:"value";s:11:"order_firma";}i:25;a:2:{s:4:"name";s:22:"Versandadresse Vorname";s:5:"value";s:13:"order_vorname";}i:26;a:2:{s:4:"name";s:19:"Versandadresse Name";s:5:"value";s:10:"order_name";}i:27;a:2:{s:4:"name";s:22:"Versandadresse Strasse";s:5:"value";s:13:"order_strasse";}i:28;a:3:{s:4:"name";s:18:"Versandadresse PLZ";s:5:"value";s:9:"order_plz";s:6:"format";i:900;}i:29;a:2:{s:4:"name";s:18:"Versandadresse Ort";s:5:"value";s:9:"order_ort";}i:30;a:2:{s:4:"name";s:19:"Versandadresse Land";s:5:"value";s:10:"order_land";}i:31;a:2:{s:4:"name";s:26:"Name der Bank (Bankeinzug)";s:5:"value";s:11:"order_bname";}i:32;a:3:{s:4:"name";s:24:"IBAN Nummer (Bankeinzug)";s:5:"value";s:10:"order_iban";s:6:"format";i:900;}i:33;a:3:{s:4:"name";s:25:"BIC der Bank (Bankeinzug)";s:5:"value";s:9:"order_bic";s:6:"format";i:900;}i:34;a:2:{s:4:"name";s:25:"Kontoinhaber (Bankeinzug)";s:5:"value";s:14:"order_binhaber";}i:35;a:3:{s:4:"name";s:2:"ip";s:5:"value";s:8:"order_ip";s:6:"format";i:900;}i:36;a:2:{s:4:"name";s:9:"UserAgent";s:5:"value";s:15:"order_useragent";}}}'
-		   		);
-		   		
-		   		// Standardexport anlegen
-		   		$this->db->ImportQuery(WPSG_TBL_EXPORTPROFILE, $ins_data);
-		   		
-		   	}
-		   	
+
+			/**
+			 * Tabelle fÃŒr die Felder des Exportprofils
+			 */
+			$sql = "CREATE TABLE ".WPSG_TBL_EXPORTPROFILE_FIELDS." (
+				id mediumint(9) NOT NULL AUTO_INCREMENT,
+				profil_id INT(11) NOT NULL COMMENT 'Link zu WPSG_TBL_EXPORTPROFILE',
+				pos int(11) NOT NULL COMMENT 'Position im Export',
+				name VARCHAR(255) NOT NULL COMMENT 'Spaltenname / Feldname im XML',
+				value_key VARCHAR(255) NOT NULL COMMENT 'Der SchlÃŒssel, mit dem der Wert gefÃŒllt wird',
+				format INT(2) NOT NULL COMMENT 'Zellenformat',
+				xml_exporttype INT(1) NOT NULL COMMENT 'Tag oder Attributexport',
+				userformat VARCHAR(255) NOT NULL COMMENT 'Benutzerdefiniertes Format',
+				clear_spaces INT(1) NOT NULL COMMENT 'Leerzeichen entfernen',
+				INDEX profil_id (profil_id),
+				PRIMARY KEY  (id)
+			) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=1;";
+			
+			dbDelta($sql);
+			 		   	
 		} // public function install() 
 		
@@ -103,11 +123,5 @@
 						
 		} // public function settings_edit()
-		
-		public function settings_save()
-		{
-			
-			
-		} // public function settings_save()
-		
+		 
 		public function profilList()
 		{
@@ -119,12 +133,5 @@
 					`".WPSG_TBL_EXPORTPROFILE."`
 			");
-			
-			foreach ($this->shop->view['arProfile'] as $k => $v)
-			{
-				
-				$this->shop->view['arProfile'][$k]['data'] = @unserialize($v['data']);
-							
-			}
-			
+			 			
 			$this->shop->render(WPSG_PATH_VIEW.'/mods/mod_export/profillist.phtml');
 			
@@ -133,30 +140,31 @@
 		public function handleExport()
 		{
-						
-			$arProfile = explode(",", $_REQUEST['wpsg_mod_export_profile']);
-			
+						 
+			$arProfile = array_values($_REQUEST['wpsg_mod_export_profile']);
+			
+			parse_str($_REQUEST['filter'], $filter);
+			$arData = wpsg_order::find($filter['filter']);
+			 			
 			if (sizeof($arProfile) >= 1)
 			{
 				
 				$this->loadFields();
-
+ 						
 				foreach ($arProfile as $profil_id)
 				{
 					
-					$profil = $this->db->fetchRow("SELECT * FROM `".WPSG_TBL_EXPORTPROFILE."` WHERE `id` = '".wpsg_q($profil_id)."'");
-					$profil['data'] = @unserialize($profil['data']);
-					$profil['filename'] = $profil['data']['filename'];
-					
 					$tmpfname = tempnam($this->getTmpFilePath(), "wpsg");
-					
 					$filehandler = fopen($tmpfname, 'w');
 					
-					// Kopf
-					if ($profil['data']['firstlinecolname'] == '1')
-					{
-					
+					$profil = $this->loadProfil($profil_id);
+				 
+					$arExportData = array();
+					
+					if ($profil['format'] == self::FORMAT_CSV && $profil['csv_fieldnames'] == '1')
+					{
+						
 						$row = array();
 						
-						foreach ($profil['data']['fields'] as $f)
+						foreach ($profil['fields'] as $f)
 						{
 							
@@ -165,24 +173,22 @@
 						}
 						
-						fputcsv($filehandler, $row, $profil['data']['separator']);
-						
-					}
-					
-					foreach ($this->shop->view['data'] as $d) 
-					{
-												
-						$row = array();
-						
-						if ($profil['data']['oneline'] == '1')
+						$arExportData[] = $row;
+						
+					}
+					
+					foreach ($arData as $oOrder) 
+					{
+						
+						if ($profil['order_online'] == '1')
 						{
 						
-							foreach ($profil['data']['fields'] as $f) 
+							foreach ($profil['fields'] as $f) 
 							{
 
-								$row[] = $this->getValue($f, $profil['data']['separator'], $d['id']);
+								$row[] = $this->getValue($f, $profil['field_delimiter'], $oOrder->id);
 								
 							}
 							
-							fputcsv($filehandler, $row, $profil['data']['separator']);
+							$arExportData[] = $row; 
 							
 						}
@@ -199,5 +205,5 @@
 									`".WPSG_TBL_ORDERPRODUCT."` AS OP 
 								WHERE 
-									OP.`o_id` = '".wpsg_q($d['id'])."'
+									OP.`o_id` = '".wpsg_q($oOrder->id)."'
 							");
 							
@@ -207,17 +213,29 @@
 								$row = array();
 								
-								foreach ($profil['data']['fields'] as $f)
+								foreach ($profil['fields'] as $f)
 								{
 
-									$row[] = $this->getValue($f, $profil['data']['separator'], $d['id'], $p['p_id'], $p['product_index'], $p['productkey'], $p['order_product_id']);
+									$row[] = $this->getValue($f, $profil['field_delimiter'], $oOrder->id, $p['p_id'], $p['product_index'], $p['productkey'], $p['order_product_id']);
 																		
 								}
 
-								fputcsv($filehandler, $row, $profil['data']['separator']);
-																	
+								$arExportData[] = $row; 
+								
 							}
 							
 						}
-	    				
+						
+					} // foreach arData
+										
+					foreach ($arExportData as $row)
+					{
+						
+						if ($profil['format'] == self::FORMAT_CSV)
+						{
+							
+							fputcsv($filehandler, $row, $profil['field_delimiter']);
+							
+						}
+						
 					}
 					
@@ -225,5 +243,5 @@
 					
 					// In ISO wandeln
-					if ($profil['data']['iso'] == '1')
+					if ($profil['file_encoding'] == self::ENCODING_ISO88591)
 					{
 						
@@ -232,9 +250,9 @@
 					}
 					
-					$arFiles[] = array(strval($profil['data']['filename']), $tmpfname);
-					
-				}
-				
-				if (sizeof($arFiles) == 1)
+					$arFiles[] = array(strval($profil['filename']), $tmpfname);
+					
+				} // foreach profile
+				 				
+				if (sizeof($arFiles) == 1 && $profil['format'] == self::FORMAT_CSV)
 				{
 					
@@ -277,19 +295,17 @@
 					{
 						
-						die(__('Konnte Zip Archiv nicht erstellen!', 'wpsg'));
-						
-					}
-					
-				}
-				
-				return true;
-				
-			}
-			
-			return false;			
+						throw new \Exception(__('Konnte Zip Archiv nicht erstellen!', 'wpsg'));
+						
+					}
+					
+				} 
+				
+			} 
+			 
+			$this->shop->redirect(WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Order');
 			
 		} // public function handleExport()
 		
-		public function produkt_index_head()
+		public function order_index_tab(&$arTabs)
 		{
 
@@ -298,217 +314,264 @@
 			if (sizeof($this->shop->view['wpsg_mod_export']['arProfile']) <= 0) return;
 			
-			$this->shop->render(WPSG_PATH_VIEW.'/mods/mod_export/produkt_index_head.phtml');
-			
-		} // public function produkt_index_head()
+			$arTabs['left'][$this->id] = array(
+				'tab_title' => __('Bestellexport', 'wpsg'),
+				'tab_icon' => 'glyphicon glyphicon-export',
+				'tab_content' => $this->shop->render(WPSG_PATH_VIEW.'/mods/mod_export/order_index_tab.phtml', false)
+			);
+
+		} // public function order_index_tab(&$arTabs)
+		 		  		
+		public function be_ajax()
+		{ 
+			
+			if ($_REQUEST['do'] == 'wpsg_mod_export_addProfil')
+			{
+				
+				$this->db->ImportQuery(WPSG_TBL_EXPORTPROFILE, array(
+					'name' => wpsg_q(__('Neues Profil', 'wpsg')),
+					'filename' => 'export.csv',
+					'export_type' => wpsg_q(self::TYPE_ORDER),
+					'file_encoding' => wpsg_q(self::ENCODING_UTF8),
+					'field_delimiter' => ';',
+					'field_enclosure' => '"',
+					'field_escape' => wpsg_q('\\'),
+					'format' => wpsg_q(self::FORMAT_CSV)
+				));
+				
+				die($this->profilList());
+				
+			}
+			else if ($_REQUEST['do'] == 'handleExport')
+			{
+				
+				die($this->handleExport());
+				
+			}
+			else if ($_REQUEST['do'] == 'wpsg_mod_export_removeProfil')
+			{
+				
+				$this->db->Query("DELETE FROM `".WPSG_TBL_EXPORTPROFILE."` WHERE `id` = '".wpsg_q($_REQUEST['profil'])."'");
+				
+				die($this->profilList());
+				
+			}
+			else if ($_REQUEST['do'] == 'wpsg_mod_export_removeField')
+			{
+				
+				$this->db->Query("DELETE FROM `".WPSG_TBL_EXPORTPROFILE_FIELDS."` WHERE `id` = '".wpsg_q($_REQUEST['field_id'])."' ");
+				
+				die("1");
+				
+			}
+			else if ($_REQUEST['do'] == 'wpsg_mod_export_reorder')
+			{
+				
+				parse_str($_REQUEST['wpsg_reorder'], $reorder);
+			
+				foreach ($reorder['field'] as $k => $field_id)
+				{
+					
+					$this->db->UpdateQuery(WPSG_TBL_EXPORTPROFILE_FIELDS, array(
+						'pos' => wpsg_q($k)
+					), " `id` = '".wpsg_q($field_id)."' ");
+					
+				}
+				
+				die("1");
+				
+			}
+			else if ($_REQUEST['do'] == 'wpsg_mod_export_addField')
+			{
+				
+				$this->db->ImportQuery(WPSG_TBL_EXPORTPROFILE_FIELDS, array(
+					'profil_id' => wpsg_q($_REQUEST['profil_id']),
+					'name' => __('Neues Feld', 'wpsg'),
+					'value_key' => '-1'
+				));
+				
+				die($this->renderFields($this->loadProfil($_REQUEST['profil_id'])));
+				
+			}
+			else if ($_REQUEST['do'] == 'wpsg_mod_export_profilSwitch')
+			{
+				
+				die($this->renderProfil($_REQUEST['profil']));
+								
+			}
+			else if ($_REQUEST['do'] == 'inlinedit')
+			{
+				
+				if (preg_match('/field_/', $_REQUEST['name']))
+				{
+					
+					// Feldwert wurde bearbeitet
+					$field_id = preg_replace('/(.*)\_/', '', $_REQUEST['name']);
+					$col = preg_replace('/\_\d+$/', '', $_REQUEST['name']);
+								
+					switch ($col) 
+					{
+						
+						case 'field_name': $col = 'name'; break;
+						case 'field_format': $col = 'format'; break;
+						case 'field_userformat': $col = 'userformat'; break;
+						case 'field_typ': $col = 'value_key'; break;
+						
+						default: throw new \Exception(__('UngÃŒltiger Feldname', 'wpsg'));
+							
+					}
+					
+					$this->db->UpdateQuery(WPSG_TBL_EXPORTPROFILE_FIELDS, array(
+						wpsg_q($col) => wpsg_q($_REQUEST['value']) 
+					), " `id` = '".wpsg_q($field_id)."' ");
+					
+					echo $this->db->fetchOne("SELECT `".wpsg_q($col)."` FROM `".WPSG_TBL_EXPORTPROFILE_FIELDS."` WHERE `id` = '".wpsg_q($field_id)."' "); 
+					exit;
+					
+				}
+				
+				$col = null;
+				
+				switch ($_REQUEST['name'])
+				{
+					
+					case 'name': $col = 'name'; break;
+					case 'filename': $col = 'filename'; break;
+					case 'file_encoding': $col = 'file_encoding'; break;
+					case 'format': $col = 'format'; break;
+					case 'field_delimiter': $col = 'field_delimiter'; break;
+		   	  		case 'field_enclosure': $col = 'field_enclosure'; break;
+					case 'field_escape': $col = 'field_escape'; break;
+					case 'order_online': $col = 'order_online'; break;
+					case 'field_delimiter': $col = 'field_delimiter'; break;
+					case 'field_enclosure': $col = 'field_enclosure'; break;
+					case 'field_escape': $col = 'field_escape'; break;
+					case 'order_onetime': $col = 'order_onetime'; break;
+										
+					default: throw new \Exception(__('UngÃŒltiger Feldname', 'wpsg'));
+					
+				}
+				
+				$this->db->UpdateQuery(WPSG_TBL_EXPORTPROFILE, array(
+					wpsg_q($col) => wpsg_q($_REQUEST['value']) 
+				), " `id` = '".wpsg_q($_REQUEST['profil_id'])."' ");
+												
+				echo $this->db->fetchOne("SELECT `".wpsg_q($col)."` FROM `".WPSG_TBL_EXPORTPROFILE."` WHERE `id` = '".wpsg_q($_REQUEST['profil_id'])."' "); 
+				exit;
+				 
+			}
+			else if ($_REQUEST['do'] == 'musterupload')
+			{
+				
+				$arProfil = $this->loadProfil($_REQUEST['profil_id']);
+						 
+				if ($arProfil['file_encoding'] == self::ENCODING_ISO88591)
+				{
+
+					$strFileContent = wpsg_toUtf8(file_get_contents($_FILES['file']['tmp_name']));
+					
+				}
+				else
+				{
+				
+					$strFileContent = file_get_contents($_FILES['file']['tmp_name']);
+					
+				}
+
+				if ($arProfil['format'] == self::FORMAT_CSV)
+				{
+									
+					// Alles nach erstem Zeilenumbruch entfernen
+					$strFileContent = preg_replace("/\r(.*)/s", "", $strFileContent);
+	
+					$arFields = explode($arProfil['field_delimiter'], $strFileContent);
+					 
+					if (sizeof($arFields) > 1) 
+					{
+						 						
+						foreach ($arFields as $f) 
+						{
+								
+							// Hochkommas am Anfang und am Ende abtrennen
+							if (preg_match('/^\"(.*)\"$/', $f)) $f = substr($f, 1, strlen($f) - 2);
+	
+							// Existiert das Feld schon
+							$existID = $this->db->fetchOne("SELECT `id` FROM `".WPSG_TBL_EXPORTPROFILE_FIELDS."` WHERE `profil_id` = '".wpsg_q($_REQUEST['profil_id'])."' AND `name` = '".wpsg_q($f)."' ");
+							
+							if (!wpsg_isSizedInt($existID))
+							{
+							
+								$this->db->ImportQuery(WPSG_TBL_EXPORTPROFILE_FIELDS, array(
+									'profil_id' => wpsg_q($_REQUEST['profil_id']),
+									'name' => wpsg_q($f),
+									'value_key' => '-1'
+								));
+								
+							} 						
+							
+						}
+					
+					}
+										
+				}
+					
+				$this->shop->addBackendMessage(__('Muster Datei erfolgreich verarbeitet.', 'wpsg'));
+				
+				die($this->renderFields($this->loadProfil($_REQUEST['profil_id'])));
+								
+			}
+		
+		} // public function be_ajax()
+		
+		/* Modulfunktionen */
+
+		public function renderProfil($profil_id)
+		{
+			
+			$this->loadFields();
+												
+			$this->shop->view['profil'] = $this->loadProfil($profil_id);
+													
+			$this->shop->view['arExportFormats'] = $this->arExportFormats;
+			$this->shop->view['arFileEncoding'] = $this->arFileEncoding;				
+			$this->shop->view['arFieldFormats'] = $this->arFieldFormats;
+			$this->shop->view['fields'] = $this->fields;
+			$this->shop->view['strFields'] = $this->renderFields($this->shop->view['profil']);
+			
+			return $this->shop->render(WPSG_PATH_VIEW.'/mods/mod_export/profil.phtml', false);
+			
+		} // public function renderProfil($profil_id)
+
+		/**
+		 * Zeichner die Felder des Profils
+		 * @param $profil_data
+		 */
+		function renderFields($profil_data)
+		{
+		
+			$this->shop->view['arFieldFormats'] = $this->arFieldFormats;
+			$this->shop->view['fields'] = $this->fields;
+			$this->shop->view['profil'] = $profil_data;
+			
+			return $this->shop->render(WPSG_PATH_VIEW.'/mods/mod_export/fields.phtml', false);
+			
+		} // function renderFields($profil_data)
+		
+		/**
+		 * Gibt die Daten eines Profils zurÃŒck
+		 * @return Array Array mit den Profildaten
+		 * @param int $profil_id Die ID des zu ladenden Profils
+		 */
+		public function loadProfil($profil_id)
+		{
+			
+			$arReturn = $this->db->fetchRow("SELECT * FROM `".WPSG_TBL_EXPORTPROFILE."` WHERE `id` = '".wpsg_q($profil_id)."' ");
+			$arReturn['fields'] = $this->db->fetchAssoc("SELECT * FROM `".WPSG_TBL_EXPORTPROFILE_FIELDS."` WHERE `profil_id` = '".wpsg_q($profil_id)."' ORDER BY `pos` ASC, `id` ASC ", "id");
+			
+			if ($profil_id != wpsg_getInt($arReturn['id'])) throw new \Exception(__('Profil konnte nicht geladen werden.', 'wpsg'));
+			
+			return $arReturn;
+			
+		} // public function loadProfil($profil_id)
 		 
-		public function produkt_index_aftersearch()
-		{
-			
-			$this->shop->view['wpsg_mod_export']['arProfile'] = $this->db->fetchAssoc("SELECT * FROM `".WPSG_TBL_EXPORTPROFILE."`");
-			
-			if (sizeof($this->shop->view['wpsg_mod_export']['arProfile']) <= 0) return;
-			
-			$this->shop->render(WPSG_PATH_VIEW.'/mods/mod_export/produkt_index_aftersearch.phtml');
-			
-		} // public function produkt_index_aftersearch()
-		
-		public function be_ajax()
-		{
-			
-			if ($_REQUEST['do'] == 'wpsg_mod_export_addProfil')
-			{
-				
-				$this->db->ImportQuery(WPSG_TBL_EXPORTPROFILE, array(
-					"name" => __('Neues Profil', 'wpsg'),
-					"data" => serialize(array('separator' => ';')),
-				));
-				
-				die($this->profilList());
-				
-			}
-			else if ($_REQUEST['do'] == 'wpsg_mod_export_removeProfil')
-			{
-				
-				$this->db->Query("DELETE FROM `".WPSG_TBL_EXPORTPROFILE."` WHERE `id` = '".wpsg_q($_REQUEST['profil'])."'");
-				die($this->profilList());
-				
-			
-			}
-			else if ($_REQUEST['do'] == 'wpsg_mod_export_removeField')
-			{
-				
-				$data = $this->db->fetchRow("SELECT * FROM `".WPSG_TBL_EXPORTPROFILE."` WHERE `id` = '".wpsg_q($_REQUEST['profil'])."'");
-				$data['data'] = @unserialize($data['data']);
-		 
-				unset($data['data']['fields'][$_REQUEST['field_key']]);
-				
-				$data['data'] = @serialize($data['data']);				
-				$this->db->UpdateQuery(WPSG_TBL_EXPORTPROFILE, $data, "`id` = '".wpsg_q($_REQUEST['profil'])."'");
-				
-				die("1");
-				
-			}
-			else if ($_REQUEST['do'] == 'wpsg_mod_export_profilSwitch')
-			{
-				
-				$this->loadFields();
-				
-				$this->shop->view['profil'] = $this->db->fetchRow("SELECT * FROM `".WPSG_TBL_EXPORTPROFILE."` WHERE `id` = '".wpsg_q($_REQUEST['profil'])."'");
-				 
-				$this->shop->view['profil']['data'] = unserialize($this->shop->view['profil']['data']);
-											
-				foreach ((array)$this->shop->view['profil']['data']['fields'] as $k => $v)
-				{
-					if (!isset($v['format'])) $this->shop->view['profil']['data']['fields'][$k]['format'] = 0;
-				}
-				
-				$this->shop->view['arFormats'] = $this->arFormats;
-				$this->shop->view['fields'] = $this->fields;
-				
-				die($this->shop->render(WPSG_PATH_VIEW.'/mods/mod_export/profil.phtml'));
-				
-			}
-			else if ($_REQUEST['do'] == 'inlinedit')
-			{
-				
-				$data = $this->db->fetchRow("SELECT * FROM `".WPSG_TBL_EXPORTPROFILE."` WHERE `id` = '".wpsg_q($_REQUEST['profil_id'])."'");
-				$data['data'] = @unserialize($data['data']);
-				
-				switch ($_REQUEST['field'])
-				{
-					
-					case 'name': $data['name'] = wpsg_q($_REQUEST['value']); break;
-					case 'filename': $data['data']['filename'] = wpsg_q($_REQUEST['value']); break;
-					case 'separator': $data['data']['separator'] = wpsg_q($_REQUEST['value']); break;
-					case 'oneline': $data['data']['oneline'] = wpsg_q($_REQUEST['value']); break;
-					case 'firstlinecolname': $data['data']['firstlinecolname'] = wpsg_q($_REQUEST['value']); break;
-					case 'iso': $data['data']['iso'] = wpsg_q($_REQUEST['value']); break;
-					
-				}
-				
-				if (preg_match('/fieldname_/', $_REQUEST['field']))				    
-				{
-					
-					$f_id = substr($_REQUEST['field'], 10);
-					$data['data']['fields'][$f_id]['name'] = $_REQUEST['value'];
-					
-				}
-				
-				if (preg_match('/fieldformat_/', $_REQUEST['field']))
-				{
-					
-					$f_id = substr($_REQUEST['field'], 12);
-					$data['data']['fields'][$f_id]['format'] = $_REQUEST['value'];
-					$_REQUEST['value'] = $this->arFormats[$_REQUEST['value']];
-					
-				}
-				
-				if (preg_match('/fielduserformat_/', $_REQUEST['field']))
-				{
-					
-					$f_id = substr($_REQUEST['field'], 16);					
-					$data['data']['fields'][$f_id]['userformat'] = $_REQUEST['value'];
-										
-				}
-				
-				if (preg_match('/fieldtyp_/', $_REQUEST['field']))
-				{
-					
-					$f_id = substr($_REQUEST['field'], 9);
-					$data['data']['fields'][$f_id]['value'] = $_REQUEST['value'];
-					$this->loadFields();
-					$_REQUEST['value'] = $this->getFieldName($_REQUEST['value']);
-					
-				}
-				
-				$data['data'] = @serialize($data['data']);				
-				$this->db->UpdateQuery(WPSG_TBL_EXPORTPROFILE, $data, "`id` = '".wpsg_q($_REQUEST['profil_id'])."'");
-				
-				die($_REQUEST['value']);
-				
-			}
-			else if ($_REQUEST['do'] == 'musterupload')
-			{
-				
-				$data = $this->db->fetchRow("SELECT * FROM `".WPSG_TBL_EXPORTPROFILE."` WHERE `id` = '".wpsg_q($_REQUEST['profil_id'])."'");
-				$data['data'] = @unserialize($data['data']);
-				
-				if (!isset($data['data']['separator']) || strlen($data['data']['separator']) < 1) 
-				{
-					
-					$this->shop->addBackendError(__('UngÃŒltiges Trennzeichen angegeben!', 'wpsg'));
-					die('<script type="text/javascript">parent.wpsg_mod_export_profilSwitch();</script>');
-						
-				}
-				
-				if ($data['data']['iso'] == '1')
-				{
-
-					$strFileContent = wpsg_toUtf8(file_get_contents($_FILES['wpsg_mod_export_muster']['tmp_name']));
-					
-				}
-				else
-				{
-				
-					$strFileContent = file_get_contents($_FILES['wpsg_mod_export_muster']['tmp_name']);
-					
-				}
-
-				// Alles nach erstem Zeilenumbruch entfernen
-				$strFileContent = preg_replace("/\r(.*)/s", "", $strFileContent);
-
-				$arFields = explode($data['data']['separator'], $strFileContent);
-				
-				if (sizeof($arFields) > 1) 
-				{
-					
-					// Neue Felder gefundne, verwirft die alten
-					$data['data']['fields'] = array();
-					
-					foreach ($arFields as $f) 
-					{
-
-						if (preg_match('/^\"(.*)\"$/', $f)) $f = substr($f, 1, strlen($f) - 2);
-						
-						$data['data']['fields'][] = array(
-							'name' => $f,
-							'value' => '-1'
-						);							
-						
-					}
-				
-				}
-				
-				$data['data'] = @serialize($data['data']);
-						 
-				$data = wpsg_q($data);
-				 
-				$this->db->UpdateQuery(WPSG_TBL_EXPORTPROFILE, $data, "`id` = '".wpsg_q($_REQUEST['profil_id'])."'");
-				 
-				$this->shop->addBackendMessage(__('Muster Datei erfolgreich verarbeitet.', 'wpsg'));
-				
-				die('<script type="text/javascript">parent.wpsg_mod_export_profilSwitch();</script>');
-				
-			}
-		
-		} // public function be_ajax()
-		
-		private function getFieldName($field_key)
-		{
-			
-			foreach ($this->fields as $fieldgroup)
-			{
-				
-				foreach ($fieldgroup['fields'] as $key => $fieldname)
-				{
-					
-					if ($key == $field_key) return $fieldname;
-					
-				}
-				
-			}
-			
-		} // private function getFieldName($field_key)
-		
 		private function loadFields()
 		{
@@ -748,5 +811,5 @@
 		{
 			
-			$field_value = $f['value'];
+			$field_value = $f['value_key'];
 			
 			$cache_key = $o_id.'_'.$p_id.'_'.$product_index.'_'.$productkey.'_'.$order_product_id;
@@ -766,10 +829,7 @@
 				$order = $this->db->fetchRow("
 					SELECT 
-						O.*,
-						L.`name` AS land,
-						L.`kuerzel` AS land_krzl
+						O.*
 					FROM
-						`".WPSG_TBL_ORDER."` AS O
-							LEFT JOIN `".WPSG_TBL_LAND."` AS L ON (O.`shipping_land` = L.`id`)
+						`".WPSG_TBL_ORDER."` AS O							
 					WHERE
 						O.`id` = '".wpsg_q($o_id)."'
@@ -779,11 +839,13 @@
 				$order['menge'] = $this->db->fetchOne("SELECT SUM(OP.`menge`) FROM `".WPSG_TBL_ORDERPRODUCT."` AS OP WHERE OP.`o_id` = '".wpsg_q($order['id'])."'");
 				
+				$order['oOrder'] = wpsg_order::getInstance($order['id']);
+				
 				// Anzahl an Produkten in der Bestellung (MengenunabhÃ€ngig)
 				$order['count'] = $this->db->fetchOne("SELECT COUNT(*) FROM `".WPSG_TBL_ORDERPRODUCT."` WHERE `o_id` = '".wpsg_q($order['id'])."'");
-				
-				$order['payment_method'] = $this->shop->arPayment[$order['type_payment']]['name'];
-				$order['shipping_method'] = $this->shop->arShipping[$order['type_shipping']]['name'];
-				
-				$order['custom_data'] = unserialize($order['custom_data']);
+			
+				$order['payment_method'] = $order['oOrder']->getPaymentLabel();
+				$order['shipping_method'] = $order['oOrder']->getShippingLabel();
+				
+				$order['custom_data'] = @unserialize($order['custom_data']);
 				
 				if ($this->shop->hasMod('wpsg_mod_rechnungen'))
@@ -834,10 +896,7 @@
 				$kunde = $this->db->fetchRow("
 					SELECT
-						K.*,
-						L.`kuerzel` AS land_krzl,
-						L.`name` AS land
+						K.*
 					FROM
 						`".WPSG_TBL_KU."` AS K
-							LEFT JOIN `".WPSG_TBL_LAND."` AS L ON (K.`land` = L.`id`)
 					WHERE
 						K.`id` = '".wpsg_q($order['k_id'])."'
Index: /views/admin/form/checkbox.phtml
===================================================================
--- /views/admin/form/checkbox.phtml	(revision 5891)
+++ /views/admin/form/checkbox.phtml	(revision 5896)
@@ -18,5 +18,9 @@
 
 				<div class="wpsg_field_wrap">
+					
+					<?php if (!isset($this->view['field_config']['noHidden'])) { ?>
 					<input type="hidden" name="<?php echo $this->view['field_name']; ?>" value="0" />
+					<?php } ?>
+					
 					<input type="checkbox" id="<?php echo $this->view['field_id']; ?>" name="<?php echo $this->view['field_name']; ?>" value="<?php echo wpsg_getStr($this->view['field_config']['value'], '1'); ?>" <?php echo (($this->view['field_checked'] > 0)?'checked="checked"':''); ?> />
 				
@@ -34,4 +38,29 @@
 	</div>
 	
+	<?php if (wpsg_isTrue($this->view['field_config']['inlineEdit'])) { ?>
+    <script type="text/javascript">/* <![CDATA[ */
+
+        jQuery(document).ready(function() {
+
+			jQuery('#<?php echo $this->view['field_id']; ?>').on('change', function() {
+				
+				var value = '0';
+				if (jQuery(this).prop('checked')) value = '1';
+				
+				jQuery.ajax( {
+					url: '<?php echo $this->view['field_config']['inlineEdit_url']; ?>',
+					data: {
+						'name': '<?php echo $this->view['field_name']; ?>',
+						'value': value
+					}
+				} );
+				
+			} );
+			 
+        } );
+
+    /* ]]> */</script>
+    <?php } ?>
+		
 	<div class="clearfix wpsg_clear"></div>
 	
Index: /views/admin/form/text.phtml
===================================================================
--- /views/admin/form/text.phtml	(revision 5891)
+++ /views/admin/form/text.phtml	(revision 5896)
@@ -18,5 +18,5 @@
 	</div>
 
-    <?php if (isset($this->view['field_config']['inlineEdit']) && $this->view['field_config']['inlineEdit']) { ?>
+    <?php if (wpsg_isTrue($this->view['field_config']['inlineEdit'])) { ?>
     <script type="text/javascript">/* <![CDATA[ */
 
@@ -28,4 +28,7 @@
                 'placement': 'bottom'
                 <?php } ?>
+                <?php if (wpsg_isSizedArray($this->view['field_config']['inlineEdit_source'])) { ?>
+                ,'data': <?php echo json_encode($this->view['field_config']['inlineEdit_source']); ?>
+                <?php } ?>
             } );
 
Index: /views/admin/form/upload.phtml
===================================================================
--- /views/admin/form/upload.phtml	(revision 5891)
+++ /views/admin/form/upload.phtml	(revision 5896)
@@ -29,4 +29,35 @@
 	</div>
 	
+	<?php if (wpsg_isTrue($this->view['field_config']['ajax_upload'])) { ?>
+	<script type="text/javascript">/* <![CDATA[ */
+	
+	    jQuery(document).ready(function() {
+			
+			jQuery('#<?php echo $this->view['field_id']; ?>').on('change', function() {
+   
+				var data = new FormData();
+   				data.append('file', this.files[0]);
+				   
+				jQuery.ajax( {
+      				url: '<?php echo $this->view['field_config']['ajax_upload_url']; ?>',
+      				data: data,
+      				type: 'POST',         
+      				processData: false,
+      				contentType: false,
+					success: function(data) {
+						
+						<?php if (wpsg_isSizedString($this->view['field_config']['ajax_success'])) { ?>
+						<?php echo $this->view['field_config']['ajax_success']; ?>(data);
+						<?php } ?>
+						
+					}
+				} );
+			} );
+			
+		} );
+	
+	/* ]]> */</script>
+	<?php } ?>
+	
 	<div class="clearfix wpsg_clear"></div>
 	
Index: /views/js/admin.js
===================================================================
--- /views/js/admin.js	(revision 5891)
+++ /views/js/admin.js	(revision 5896)
@@ -148,25 +148,11 @@
 }
 
-	jQuery(document).ready(function() {
-
-        // Sortierung
-        jQuery('th.wpsg_order').bind('click', function() {
-
-            var direction = "ASC";
-            if (jQuery(this).hasClass('wpsg_order_asc') && jQuery('#wpsg_order').val() == jQuery(this).attr("data-order")) direction = "DESC";
-
-            jQuery('#wpsg_ascdesc').val(direction);
-            jQuery('#wpsg_order').val(jQuery(this).attr("data-order"));
-
-            jQuery('#filter_form').submit();
-
-		    return false;
-
-        } );
-
+	function wpsg_ajaxBind()
+	{
+		
 		// Hilfe Tooltips
-		jQuery('*[data-wpsg-tip]').bind('click', function() { 
-
-			jQuery(this).unbind('click');
+		jQuery('*[data-wpsg-tip]').on('click', function() { 
+
+			jQuery(this).off('click').on('click', function() { return false; } );
  
 			var po = this;
@@ -198,5 +184,24 @@
 			
 		} );
-		
+				
+	}
+
+	jQuery(document).ready(function() {
+
+        // Sortierung
+        jQuery('th.wpsg_order').bind('click', function() {
+
+            var direction = "ASC";
+            if (jQuery(this).hasClass('wpsg_order_asc') && jQuery('#wpsg_order').val() == jQuery(this).attr("data-order")) direction = "DESC";
+
+            jQuery('#wpsg_ascdesc').val(direction);
+            jQuery('#wpsg_order').val(jQuery(this).attr("data-order"));
+
+            jQuery('#filter_form').submit();
+
+		    return false;
+
+        } );
+
 		jQuery('.wpsg_showhide_filter').bind('click', function() { 
 			
@@ -217,4 +222,6 @@
 			
 		} );
+				
+		wpsg_ajaxBind();
 		
 	} );
Index: /views/js/editable.js
===================================================================
--- /views/js/editable.js	(revision 5891)
+++ /views/js/editable.js	(revision 5896)
@@ -48,4 +48,21 @@
 
             }
+			else if (options.type == "select" && typeof options.data == "object")
+			{
+				
+				var value = 0;
+				var strValue = jQuery(this).html();
+				
+				for (var i in options.data)
+				{
+					
+					if (options.data[i] == strValue) value = i;
+					
+				}
+				
+				opt.source = options.data;
+				opt.value = value
+				
+			}
             else if (options.type == 'multiarray')
             {
@@ -73,5 +90,5 @@
                 opt.type = 'select';
 
-            }
+            }			
 			else if (options.type == 'string' && typeof options.data == "string")
             {
Index: /views/mods/mod_export/fields.phtml
===================================================================
--- /views/mods/mod_export/fields.phtml	(revision 5896)
+++ /views/mods/mod_export/fields.phtml	(revision 5896)
@@ -0,0 +1,139 @@
+<?php
+
+    /**
+     * User: Daschmi (daschmi@daschmi.de)
+     * Date: 03.11.2016
+     * Time: 14:12
+     */
+
+    $inlineEdit_url = WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_export&do=inlinedit&noheader=1&profil_id='.$this->view['profil']['id'];
+
+?>
+<table class="table table-body-striped" id="wpsg_mod_export_fieldtable">
+    <thead>
+        <tr>
+            <th class="wpsg_mod_export_col_name"><?php echo __('Spaltenname', 'wpsg'); ?></th>
+            <th class="wpsg_mod_export_col_value"><?php echo __('Wert', 'wpsg'); ?></th>
+            <th class="wpsg_mod_export_col_format"><?php echo __('Format', 'wpsg'); ?></th>
+            <th class="wpsg_mod_export_col_remove">
+                
+                <a style="float:right;" onclick="return wpsg_mod_export_addField(<?php echo $this->view['profil']['id']; ?>);" title="<?php echo __('Neues Feld einfÃŒgen', 'wpsg'); ?>" href="#" class="glyphicon glyphicon-plus"></a>
+                
+            </th>
+        </tr>
+    </thead>
+
+    <?php $i = 0; foreach ((array)$this->view['profil']['fields'] as $f_id => $f) { $i ++; ?>
+    <tbody id="field_<?php echo $f_id; ?>">
+        <tr class="wpsg_tablerow wpsg_mod_export_row1 wpsg_mod_export_fieldrow_<?php echo $f_id; ?> <?php echo (($i % 2 == 0)?'odd':'even'); ?>">
+            
+            <td class="wpsg_mod_export_col">
+                <div class="name wpsg_editable" id="field_name_<?php echo $f_id; ?>"><?php echo $f['name']; ?></div>
+            </td>
+            <td class="wpsg_mod_export_col_field"><div class="wpsg_editable" id="field_typ_<?php echo $f_id; ?>"><?php
+    
+                foreach ($this->view['fields'] as $fieldgroup)
+                {
+    
+                    foreach ($fieldgroup['fields'] as $field_key => $field)
+                    {
+    
+                        if ($field_key == $f['value_key'])
+                        {
+                            
+                            echo $field;
+                            
+                        }
+    
+                    }
+    
+                }
+    
+            ?></div></td>
+            <td class="wpsg_mod_export_col_format">
+                
+                <div class="wpsg_editable" id="field_format_<?php echo $f_id; ?>"><?php echo $this->view['arFieldFormats'][$f['format']]; ?></div>
+            
+            </td>
+            <td>
+                
+                <a style="float:right;" onclick="return wpsg_mod_export_removeField(<?php echo $f_id; ?>);" title="<?php echo __('Feld lÃ¶schen', 'wpsg'); ?>" href="#" class="glyphicon glyphicon-trash"></a>
+                               
+            </td>
+            
+        </tr>
+        <tr id="userformatrow_<?php echo $f_id; ?>" style="<?php echo (($f['format'] != 700)?'display:none;':''); ?>" class="wpsg_mod_export_row2 wpsg_tablerow wpsg_mod_export_fieldrow_<?php echo $f_id; ?> <?php echo (($i % 2 == 0)?'odd':'even'); ?>">
+            <td class="wpsg_mod_export_col_format_user" colspan="3">
+            
+                <?php echo __('Format', 'wpsg'); ?>:
+                
+                <div class="wpsg_editable" id="field_userformat_<?php echo $f_id; ?>"><?php echo wpsg_hspc(wpsg_getStr($f['userformat'])); ?></div>
+            
+            </td>
+            <td style="position:relative;">
+                
+                <a rel="?page=wpsg-Admin&subaction=loadHelp&noheader=1&field=mod_export_userformat" href="?page=wpsg-Admin&subaction=loadHelp&noheader=1&field=mod_export_userformat" data-wpsg-tip="mod_export_userformat" class="glyphicon glyphicon-info-sign" style="float:right;"></a>
+               
+                <script type="text/javascript">/* <![CDATA[ */
+                
+                    jQuery(document).ready(function() {
+                        
+                        jQuery('#field_name_<?php echo $f_id; ?>').wspg_editable('<?php echo $inlineEdit_url; ?>', { } );
+                        
+                        jQuery('#field_typ_<?php echo $f_id; ?>').wspg_editable('<?php echo $inlineEdit_url; ?>', { 
+                            'type': 'multiarray',
+                            'data': '<?php echo json_encode($this->view['fields']); ?>'                            
+                        } );
+                        
+                        jQuery('#field_format_<?php echo $f_id; ?>').wspg_editable('<?php echo $inlineEdit_url; ?>', {
+                            'type': 'select',
+                            'data': <?php echo json_encode($this->view['arFieldFormats']); ?>,
+                            'callback': function(response, newValue) {
+                                
+                                if (newValue === "700") jQuery('#userformatrow_<?php echo $f_id; ?>').show();
+                                else jQuery('#userformatrow_<?php echo $f_id; ?>').hide();
+                                
+                            }
+                        } );
+                        
+                        jQuery('#field_userformat_<?php echo $f_id; ?>').wspg_editable('<?php echo $inlineEdit_url; ?>', { } );
+                        
+                    } );
+                
+                /* ]]> */</script>
+                
+            </td>
+        </tr>
+    </tbody>
+    <?php } ?>
+
+</table>
+
+<script type="text/javascript">/* <![CDATA[ */
+
+    wpsg_ajaxBind();
+
+    jQuery("#wpsg_mod_export_fieldtable").sortable( { 
+        helper: wpsg_Tablefix,
+        items: 'tbody',
+        handler: '.wpsg_id',
+        update: function(event, ui) {
+
+            var wpsg_reorder = jQuery(this).sortable('serialize');
+            
+            jQuery.ajax( {
+                url: '<?php echo WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_export&do=wpsg_mod_export_reorder&noheader=1&profil_id='.$this->view['profil']['id']; ?>',
+                data: { 
+                    wpsg_reorder: wpsg_reorder
+                },
+                success: function(data) {
+
+                    if (data !== "1") alert(data);
+                    
+                }
+            } );
+            
+        }} 
+    ).disableSelection();
+    
+/* ]]> */</script>
Index: /views/mods/mod_export/order_index_tab.phtml
===================================================================
--- /views/mods/mod_export/order_index_tab.phtml	(revision 5891)
+++ /views/mods/mod_export/order_index_tab.phtml	(revision 5896)
@@ -6,5 +6,5 @@
 
 ?>
-<form class="container-fluid form-horizontal" method="post" action="<?php echo WPSG_URL_WP ?>wp-admin/admin.php?page=wpsg-Order&action=ajax&mod=wpsg_mod_export&noheader=1" onsubmit="wpsg_mod_export_serializefilter();">
+<form class="container-fluid form-horizontal" method="post" action="<?php echo WPSG_URL_WP ?>wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_export&do=handleExport&noheader=1" onsubmit="wpsg_mod_export_serializefilter();">
 
     <div class="row">
@@ -12,5 +12,5 @@
 
             <?php foreach ($this->view['wpsg_mod_export']['arProfile'] as $p) { ?>
-                <?php echo wpsg_drawForm_Checkbox('wpsg_mod_export_profile[]', $p['name'], false, array('value' => $p['id'])); ?>
+                <?php echo wpsg_drawForm_Checkbox('wpsg_mod_export_profile[]', $p['name'], false, array('value' => $p['id'], 'noHidden' => true)); ?>
             <?php } ?>
 
Index: /views/mods/mod_export/profil.phtml
===================================================================
--- /views/mods/mod_export/profil.phtml	(revision 5891)
+++ /views/mods/mod_export/profil.phtml	(revision 5896)
@@ -5,293 +5,81 @@
 	 */
 
+	$inlineEdit_url = WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_export&do=inlinedit&noheader=1&profil_id='.$this->view['profil']['id'];
+	$upload_url = WPSG_URL_WP.'wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_export&do=musterupload&noheader=1&profil_id='.$this->view['profil']['id'];
+
 ?>
 
 <?php echo $this->writeBackendMessage(); ?>
 
-<div class="wpsg_form_field">
-	<div class="wpsg_form_left">
-		<label for="wpsg_mod_export[name]"><?php echo __('Profilname', 'wpsg'); ?>:</label>
-	</div>
-	<div style="width:350px;" class="wpsg_form_right wpsg_editable" id="wpsg_mod_export_profilname"><?php echo $this->view['profil']['name']; ?></div>
-	<a style="float:right;" onclick="return wpsg_mod_export_removeProfil(<?php echo $this->view['profil']['id']; ?>);" title="<?php echo __('Profil lÃ¶schen', 'wpsg'); ?>" href="#" class="wpsg_icon wpsg_icon_remove"></a>
-	<div class="wpsg_clear"></div>
-</div>
-<script type="text/javascript">
-
-	jQuery('#wpsg_mod_export_profilname').wspg_editable('<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_export&do=inlinedit&noheader=1', {
-		submitdata: { 
-			field: 'name',
-			profil_id: '<?php echo $this->view['profil']['id']; ?>'
-		}, 					
-		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>
-<div class="wpsg_form_field">
-	<div class="wpsg_form_left">
-		<label for="wpsg_mod_export[filename]"><?php echo __('Dateiname', 'wpsg'); ?>:</label>
-	</div>
-	<div class="wpsg_form_right wpsg_editable" id="wpsg_mod_export_filename"><?php echo @$this->view['profil']['data']['filename']; ?></div>
-	<div class="wpsg_clear"></div>
-</div>
-<script type="text/javascript">
-
-	jQuery('#wpsg_mod_export_filename').wspg_editable('<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_export&do=inlinedit&noheader=1', {
-		submitdata: { 
-			field: 'filename',
-			profil_id: '<?php echo $this->view['profil']['id']; ?>'
-		}, 					
-		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>
-<div class="wpsg_form_field">
-	<div class="wpsg_form_left">
-		<label for="wpsg_mod_export[separator]"><?php echo __('Trennzeichen', 'wpsg'); ?>:</label>
-	</div>
-	<div class="wpsg_form_right wpsg_editable" id="wpsg_mod_export_separator"><?php echo @$this->view['profil']['data']['separator']; ?></div>
-	<div class="wpsg_clear"></div>
-</div>
-<script type="text/javascript">
-
-	jQuery('#wpsg_mod_export_separator').wspg_editable('<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_export&do=inlinedit&noheader=1', {
-		submitdata: { 
-			field: 'separator',
-			profil_id: '<?php echo $this->view['profil']['id']; ?>'
-		}, 					
-		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>
-<div class="wpsg_form_field">
-	<div class="wpsg_form_left">
-		<label for="wpsg_mod_export_oneline"><?php echo __('Eine Zeile pro Bestellung', 'wpsg'); ?>:</label>
-	</div>
-	<div class="wpsg_form_right">
-		<input style="width:auto;" type="checkbox" <?php echo ((@$this->view['profil']['data']['oneline'] == '1')?'checked="checked"':''); ?> value="1" onchange="" id="wpsg_mod_export_oneline" /></div>
-	<div class="wpsg_clear"></div>
-</div>
-<script type="text/javascript">
-
-	jQuery('#wpsg_mod_export_oneline').bind('change', function() {
-		jQuery.ajax( {
-			url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_export&do=inlinedit&noheader=1',
-			data: {
-				field: 'oneline',
-				value: ((jQuery('#wpsg_mod_export_oneline').attr("checked") == 'checked')?'1':'0'),
-				profil_id: '<?php echo $this->view['profil']['id']; ?>'
-			}
-		} );
-	} );
-
-</script>
-<div class="wpsg_form_field">
-	<div class="wpsg_form_left">
-		<label for="wpsg_mod_export_firstlinecolname"><?php echo __('Spaltennamen in erster Spalte', 'wpsg'); ?>:</label>
-	</div>
-	<div class="wpsg_form_right">
-		<input style="width:auto;" type="checkbox" <?php echo ((@$this->view['profil']['data']['firstlinecolname'] == '1')?'checked="checked"':''); ?> value="1" onchange="" id="wpsg_mod_export_firstlinecolname" id="wpsg_mod_export_firstlinecolname" /></div>
-	<div class="wpsg_clear"></div>
-</div>
-<script type="text/javascript">
-
-	jQuery('#wpsg_mod_export_firstlinecolname').bind('change', function() {
-		jQuery.ajax( {
-			url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_export&do=inlinedit&noheader=1',
-			data: {
-				field: 'firstlinecolname',
-				value: ((jQuery('#wpsg_mod_export_firstlinecolname').attr("checked") == 'checked')?'1':'0'),
-				profil_id: '<?php echo $this->view['profil']['id']; ?>'
-			}
-		} );
-	} );
-
-</script>
-<div class="wpsg_form_field">
-	<div class="wpsg_form_left">
-		<label for="wpsg_mod_export_iso"><?php echo __('Dateiformat (Import wie Export)', 'wpsg'); ?>:</label>
-	</div>
-	<div class="wpsg_form_right">
-		<select name="wpsg_mod_export_iso" id="wpsg_mod_export_iso">
-			<option value="0" <?php echo ((@$this->view['profil']['data']['iso'] != '1')?'selected="selected"':''); ?>><?php echo __('UTF-8', 'wpsg'); ?></option>
-			<option value="1" <?php echo ((@$this->view['profil']['data']['iso'] == '1')?'selected="selected"':''); ?>><?php echo __('ISO-8859-1', 'wpsg'); ?></option>
-		</select>
-	</div>
-	<div class="wpsg_clear"></div>
+<div id="wpsg_mod_export_profil_tab">	
+    <ul class="nav nav-tabs" role="tablist">
+        <li role="presentation" class="active"><a href="#tab1" aria-controls="home" role="tab" data-toggle="tab"><?php echo __('Profiloptionen', 'wpsg'); ?></a></li>
+        <li role="presentation"><a href="#tab2" aria-controls="profile" role="tab" data-toggle="tab"><?php echo __('Feldkonfiguration', 'wpsg'); ?></a></li>
+        <li role=""
+    </ul>
+	<div class="tab-content">
+		<div id="tab1" role="tabpanel" class="tab-pane active" >
+            
+            <?php echo wpsg_drawForm_Text(__('Profilname', 'wpsg'), $this->view['profil']['name'], 'name', array('inlineEdit' => true, 'inlineEdit_url' => $inlineEdit_url)); ?>
+            <?php echo wpsg_drawForm_Text(__('Dateiname', 'wpsg'), $this->view['profil']['filename'], 'filename', array('inlineEdit' => true, 'inlineEdit_url' => $inlineEdit_url)); ?>
+            <?php echo wpsg_drawForm_Text(__('Encoding', 'wpsg'), $this->view['arFileEncoding'][$this->view['profil']['file_encoding']], 'file_encoding', array('inlineEdit' => true, 'inlineEdit_type' => 'select', 'inlineEdit_source' => $this->view['arFileEncoding'], 'inlineEdit_url' => $inlineEdit_url)); ?>
+            <?php echo wpsg_drawForm_Text(__('Dateiformat', 'wpsg'), $this->view['arExportFormats'][$this->view['profil']['format']], 'format', array('inlineEdit' => true, 'inlineEdit_type' => 'select', 'inlineEdit_source' => $this->view['arExportFormats'], 'inlineEdit_url' => $inlineEdit_url)); ?>
+            
+            <?php /* CSV */ ?>
+            <div class="wpsg_mod_export_format wpsg_mod_export_format_<?php echo wpsg_mod_export::FORMAT_CSV; ?>" style="display:<?php echo (($this->view['profil']['format'] == wpsg_mod_export::FORMAT_CSV)?'block':'none'); ?>;">
+                
+                <?php echo wpsg_drawForm_Text('Feld-Trennzeichen', $this->view['profil']['field_delimiter'], 'field_delimiter', array('inlineEdit' => true, 'inlineEdit_url' => $inlineEdit_url)); ?>
+                <?php echo wpsg_drawForm_Text('Feld-Begrenzungs', $this->view['profil']['field_enclosure'], 'field_enclosure', array('inlineEdit' => true, 'inlineEdit_url' => $inlineEdit_url)); ?>
+                <?php echo wpsg_drawForm_Text('Maskierungs-Zeichen', $this->view['profil']['field_escape'], 'field_escape', array('inlineEdit' => true, 'inlineEdit_url' => $inlineEdit_url)); ?>
+                
+            </div>
+            
+            <div class="wpsg_mod_export_format wpsg_mod_export_format_<?php echo wpsg_mod_export::FORMAT_CSV; ?>" style="display:<?php echo (($this->view['profil']['format'] == wpsg_mod_export::FORMAT_CSV)?'block':'none'); ?>">
+                <?php echo wpsg_drawForm_Upload('samplefile', __('Muster Vorlage', 'wpsg'), false, '50', '100000', array('ajax_upload' => true, 'ajax_upload_url' => $upload_url, 'ajax_success' => 'samplefile_success')); ?>
+            </div>
+            
+            <?php echo wpsg_drawForm_Checkbox('order_online', __('Eine Zeile pro Bestellung', 'wpsg'), $this->view['profil']['order_online'], array('label' => __('Optionen', 'wpsg'), 'inlineEdit' => true, 'inlineEdit_url' => $inlineEdit_url)); ?>
+            <?php echo wpsg_drawForm_Checkbox('order_onetime', __('Bestellungen nur einmalig exportieren', 'wpsg'), $this->view['profil']['order_onetime'], array('inlineEdit' => true, 'inlineEdit_url' => $inlineEdit_url)); ?>
+            
+            <div class="wpsg_mod_export_format wpsg_mod_export_format_<?php echo wpsg_mod_export::FORMAT_CSV; ?>" style="display:<?php echo (($this->view['profil']['format'] == wpsg_mod_export::FORMAT_CSV)?'block':'none'); ?>">
+                
+                <?php echo wpsg_drawForm_Checkbox('csv_fieldnames', __('Spaltennamen in erster Spalte', 'wpsg'), $this->view['profil']['csv_fieldnames'], array('inlineEdit' => true, 'inlineEdit_url' => $inlineEdit_url)); ?>
+                
+            </div>
+            
+        </div>
+        
+        <div id="tab2" role="tabpanel" class="tab-pane" >
+            
+            <div id="wpsg_mod_export_fields"><?php echo $this->view['strFields']; ?></div>
+            
+        </div>
+    </div>
 </div>
 
 <br />
 
-<script type="text/javascript">
+<a onclick="return wpsg_mod_export_removeProfil(<?php echo $this->view['profil']['id']; ?>);" href="#"><span class="glyphicon glyphicon-trash wpsg-glyphicon"></span><?php echo __('Profil lÃ¶schen', 'wpsg'); ?></a>
 
-	jQuery('#wpsg_mod_export_iso').bind('change', function() {
+<script type="text/javascript">/* <![CDATA[ */
 
-		var ckbVal = '0';
-		if (jQuery('#wpsg_mod_export_onetime').prop('checked') == true) ckbVal = '1';
-		
-		jQuery.ajax( {
-			url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_export&do=inlinedit&noheader=1',
-			data: {
-				field: 'iso',
-				value: ckbVal,
-				profil_id: '<?php echo $this->view['profil']['id']; ?>'
-			}
-		} );
-	} );
+    function samplefile_success(data)
+    {
+        
+        jQuery('#wpsg_mod_export_fields').html(data);
+        jQuery('#samplefile').val('');
+        
+    }
+    
+    jQuery(document).ready(function() {
+		        
+		jQuery('#format').on('save', function(e, params) {
 
-</script>
-<div class="wpsg_form_field">
-	<div class="wpsg_form_left">
-		<label for="wpsg_mod_export_iso"><?php echo __('Muster Vorlage (csv Datei)', 'wpsg'); ?>:</label>
-	</div>
-	<div class="wpsg_form_right">
-		<iframe name="wpsg_mod_export_upload_frame" style="display:none;"></iframe>
-		<form action="<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_export&do=musterupload&noheader=1&profil_id=<?php echo $this->view['profil']['id']; ?>" target="wpsg_mod_export_upload_frame" method="post" enctype="multipart/form-data">
-			<input style="float:left; width:auto;" type="file" name="wpsg_mod_export_muster" />
-			<input style="float:right; width:auto;" type="submit" value="<?php echo __('Hochladen', 'wpsg'); ?>" />
-		</form> 
-	</div>
-	<div class="wpsg_clear"></div>
-</div>
-<br />
-<table class="table table-body-striped">
-    <thead>
-        <tr>
-            <th class="wpsg_mod_export_col_name"><?php echo __('Spaltenname', 'wpsg'); ?></th>
-            <th class="wpsg_mod_export_col_value"><?php echo __('Wert', 'wpsg'); ?></th>
-            <th class="wpsg_mod_export_col_format"><?php echo __('Format', 'wpsg'); ?></th>
-            <th class="wpsg_mod_export_col_remove"></th>
-        </tr>
-    </thead>
+			jQuery('.wpsg_mod_export_format').hide();
+			jQuery('.wpsg_mod_export_format_' + params.newValue).show();
 
-    <?php $i = 0; foreach ((array)$this->view['profil']['data']['fields'] as $f_key => $f) { $i ++; ?>
-    <tbody>
-    <tr class="wpsg_tablerow wpsg_mod_export_row1 wpsg_mod_export_fieldrow_<?php echo $f_key; ?> <?php echo (($i % 2 == 0)?'odd':'even'); ?>">
-        <td class="wpsg_mod_export_col"><div class="name wpsg_editable" id="field_name_<?php echo $f_key; ?>"><?php echo $f['name']; ?></div></td>
-        <td class="wpsg_mod_export_col_field"><div class="wpsg_editable" id="field_typ_<?php echo $f_key; ?>"><?php
-
-            foreach ($this->view['fields'] as $fieldgroup)
-            {
-
-                foreach ($fieldgroup['fields'] as $field_key => $field)
-                {
-
-                    if ($field_key == $f['value'])
-                    {
-                        echo $field;
-                    }
-
-                }
-
-            }
-
-        ?></div></td>
-        <td class="wpsg_mod_export_col_format"><div class="wpsg_editable" id="field_format_<?php echo $f_key; ?>"><?php echo $this->view['arFormats'][$f['format']]; ?></div></td>
-        <td>
-            <a style="float:right;" onclick="return wpsg_mod_export_removeField(<?php echo $this->view['profil']['id']; ?>, <?php echo $f_key; ?>);" title="<?php echo __('Profil lÃ¶schen', 'wpsg'); ?>" href="#" class="wpsg_icon wpsg_icon_remove"></a>
-        </td>
-    </tr>
-    <tr id="userformatrow_<?php echo $f_key; ?>" style="<?php echo (($f['format'] != 700)?'display:none;':''); ?>" class="wpsg_mod_export_row2 wpsg_tablerow wpsg_mod_export_fieldrow_<?php echo $f_key; ?> <?php echo (($i % 2 == 0)?'odd':'even'); ?>">
-        <td class="wpsg_mod_export_col_name"></td>
-        <td class="wpsg_mod_export_col_field_user"><?php echo __('Format:', 'wpsg'); ?></td>
-        <td class="wpsg_mod_export_col_format_user"><div class="wpsg_editable" id="field_userformat_<?php echo $f_key; ?>"><?php echo wpsg_hspc(wpsg_getStr($f['userformat'])); ?></div></td>
-        <td style="position:relative;">
-            <a rel="?page=wpsg-Admin&subaction=loadHelp&noheader=1&field=mod_export_userformat" href="?page=wpsg-Admin&subaction=loadHelp&noheader=1&field=mod_export_userformat" class="wpsg_form_help" style="float:right; position:relative;"></a>
-            <script type="text/javascript">
-
-                jQuery('#field_userformat_<?php echo $f_key; ?>').wspg_editable('<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_export&do=inlinedit&noheader=1', {
-                    submitdata: {
-                        field: 'fielduserformat_<?php echo $f_key; ?>',
-                        profil_id: '<?php echo $this->view['profil']['id']; ?>'
-                    },
-                    submit: '<?php echo __('Speichern', 'wpsg'); ?>',
-                    placeholder: '<?php echo __('Zum Bearbeiten anklicken ...', 'wpsg'); ?>',
-                    indicator: '<?php echo __('Speicher ...', 'wpsg'); ?>',
-                    tooltip: '<?php echo __('Zum Bearbeiten anklicken ...', 'wpsg'); ?>'
-                });
-
-                jQuery('#field_format_<?php echo $f_key; ?>').wspg_editable('<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_export&do=inlinedit&noheader=1', {
-                    submitdata: {
-                        field: 'fieldformat_<?php echo $f_key; ?>',
-                        profil_id: '<?php echo $this->view['profil']['id']; ?>'
-                    },
-                    submit: '<?php echo __('Speichern', 'wpsg'); ?>',
-                    data: '<?php echo json_encode($this->view['arFormats']); ?>',
-                    type: 'select',
-                    placeholder: '<?php echo __('Zum Bearbeiten anklicken ...', 'wpsg'); ?>',
-                    indicator: '<?php echo __('Speicher ...', 'wpsg'); ?>',
-                    tooltip: '<?php echo __('Zum Bearbeiten anklicken ...', 'wpsg'); ?>',
-                    callback: function(el) {
-
-                        if (el == '<?php echo $this->view['arFormats'][700]; ?>')
-                        {
-                            jQuery('#userformatrow_<?php echo $f_key; ?>').show();
-                        }
-                        else
-                        {
-                            jQuery('#userformatrow_<?php echo $f_key; ?>').hide();
-                        }
-
-                    }
-                });
-
-                jQuery('#field_name_<?php echo $f_key; ?>').wspg_editable('<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_export&do=inlinedit&noheader=1', {
-                    submitdata: {
-                        field: 'fieldname_<?php echo $f_key; ?>',
-                        profil_id: '<?php echo $this->view['profil']['id']; ?>'
-                    },
-                    submit: '<?php echo __('Speichern', 'wpsg'); ?>',
-                    placeholder: '<?php echo __('Zum Bearbeiten anklicken ...', 'wpsg'); ?>',
-                    indicator: '<?php echo __('Speicher ...', 'wpsg'); ?>',
-                    tooltip: '<?php echo __('Zum Bearbeiten anklicken ...', 'wpsg'); ?>'
-                });
-
-                jQuery('#field_typ_<?php echo $f_key; ?>').wspg_editable('<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_export&do=inlinedit&noheader=1', {
-                    submitdata: {
-                        field: 'fieldtyp_<?php echo $f_key; ?>',
-                        profil_id: '<?php echo $this->view['profil']['id']; ?>'
-                    },
-                    submit: '<?php echo __('Speichern', 'wpsg'); ?>',
-                    data: '<?php echo json_encode($this->view['fields']); ?>',
-                    type: 'multiarray',
-                    placeholder: '<?php echo __('Zum Bearbeiten anklicken ...', 'wpsg'); ?>',
-                    indicator: '<?php echo __('Speicher ...', 'wpsg'); ?>',
-                    tooltip: '<?php echo __('Zum Bearbeiten anklicken ...', 'wpsg'); ?>'
-                });
-
-            </script>
-        </td>
-    </tr>
-    </tbody>
-    <?php } ?>
-
-</table>
-
-<script type="text/javascript">
-
-	jQuery(document).ready(function() {
-		 
-		jQuery('.wpsg_mod_export_row1').bind('mouseover', function() {
-			jQuery(this).next().addClass('wpsg_tablerow_hover');
-		} ).bind('mouseout', function() {
-			jQuery(this).next().removeClass('wpsg_tablerow_hover');
-		} );
-
-		jQuery('.wpsg_mod_export_row2').bind('mouseover', function() {
-			jQuery(this).prev().addClass('wpsg_tablerow_hover');
-		} ).bind('mouseout', function() {
-			jQuery(this).prev().removeClass('wpsg_tablerow_hover');
 		} );
 		
 	} );
 
-</script>
+/* ]]> */</script>
Index: /views/mods/mod_export/settings_edit.phtml
===================================================================
--- /views/mods/mod_export/settings_edit.phtml	(revision 5891)
+++ /views/mods/mod_export/settings_edit.phtml	(revision 5896)
@@ -27,24 +27,46 @@
 	} // function wpsg_mod_export_profilSwitch()
 
-	function wpsg_mod_export_removeField(profil_id, field_key)
+	function wpsg_mod_export_addField(profil_id)
+	{
+		
+		jQuery('#wpsg_mod_export_fields').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-Admin&action=module&modul=wpsg_mod_export&do=wpsg_mod_export_addField&noheader=1',
+			data: {
+				profil_id: profil_id
+			},			
+			success: function(data) {
+				
+				jQuery('#wpsg_mod_export_fields').html(data);
+				
+			}
+		} );
+		
+		return false;
+		
+	}
+	
+	function wpsg_mod_export_removeField(field_id)
 	{
 
-		if (!confirm('<?php echo __('Sind Sie sich sicher?', 'wpsg'); ?>')) return false;
+		if (!confirm('<?php echo __('Sind Sie sich sicher, dass das Feld gelÃ¶scht werden soll?', 'wpsg'); ?>')) return false;
+		
+		jQuery('tr.wpsg_mod_export_fieldrow_' + field_id).parent().remove();
 		
 		jQuery.ajax( { 
 			url: '<?php echo WPSG_URL_WP; ?>wp-admin/admin.php?page=wpsg-Admin&action=module&modul=wpsg_mod_export&do=wpsg_mod_export_removeField&noheader=1',
 			data: {
-				profil: profil_id,
-				field_key: field_key
+				field_id: field_id
 			},			
 			success: function(data) {
-				if (data == '1')
+				
+				if (data != '1')
 				{
-					jQuery('tr.wpsg_mod_export_fieldrow_' + field_key).remove();
+					
+					alert(data);
+					
 				}
-				else
-				{
-					alert(data);
-				}
+				
 			}
 		} );
@@ -52,5 +74,5 @@
 		return false;	
 		
-	} // function wpsg_mod_export_removeField(profil_id, field_key)
+	} // function wpsg_mod_export_removeField(field_id)
 	
 	function wpsg_mod_export_removeProfil(profil_id)
Index: /views/order/index.phtml
===================================================================
--- /views/order/index.phtml	(revision 5891)
+++ /views/order/index.phtml	(revision 5896)
@@ -19,5 +19,5 @@
 					<li role="presentation" class="wpsg_showhide_filter wpsg-order-tab-a <?php echo (($this->view['hasFilter'] === true)?'active':''); ?>" id="wpsg-order-tab-0"><a href="#" onclick="return false;"><span class="glyphicon glyphicon-search"></span><?php echo __("Suche", "wpsg"); ?></a></li>
                     <?php foreach ($this->view['tabs']['left'] as $k => $tab) { ?>
-                    <li role="presentation" class="wpsg-order-tab-a" 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>
+                    <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 } ?>
 				</ul>
Index: /wpshopgermany.php
===================================================================
--- /wpshopgermany.php	(revision 5891)
+++ /wpshopgermany.php	(revision 5896)
@@ -48,5 +48,6 @@
 	define('WPSG_TBL_GUTSCHEIN', $prefix.'wpsg_gutscheine');
  	define('WPSG_TBL_PRODUCTS_REL', $prefix.'wpsg_products_related');
- 	define('WPSG_TBL_EXPORTPROFILE', $prefix.'wpsg_exportprofile');
+	define('WPSG_TBL_EXPORTPROFILE', $prefix.'wpsg_exportprofile');
+	define('WPSG_TBL_EXPORTPROFILE_FIELDS', $prefix.'wpsg_exportprofile_fields');
  	define('WPSG_TBL_PRODUCTS_VARS', $prefix.'wpsg_productvars');
  	define('WPSG_TBL_PRODUCTS_STICKY', $prefix.'wpsg_products_sticky');
