Index: /mods/wpsg_mod_export.class.php
===================================================================
--- /mods/wpsg_mod_export.class.php	(revision 6142)
+++ /mods/wpsg_mod_export.class.php	(revision 6143)
@@ -185,5 +185,5 @@
 					
                     $profil = $this->loadProfil($profil_id);
-                    
+                
                     if ($profil['format'] == self::FORMAT_CSV) $file = $this->handleExportCSV($profil_id);
                     else if ($profil['format'] == self::FORMAT_XML) $file = $this->handleExportXML($profil_id);
@@ -192,5 +192,6 @@
                         $file,
                         $profil['filename'],
-                        $profil['cron_path']
+                        $profil['cron_path'],
+						$profil['format']
                     );
                     
@@ -237,6 +238,8 @@
             {
             
-                header("Content-Type: text/csv"); 
-                header("Content-Disposition: attachment; filename=".$arFiles[0][0]); 
+                if ($arFiles[0][3] == self::FORMAT_CSV) header("Content-Type: text/csv");
+				else header("Content-Type: text/xml");
+				
+                header("Content-Disposition: attachment; filename=".$arFiles[0][1]); 
                 header("Pragma: no-cache"); 
                 header("Expires: 0"); 
@@ -426,4 +429,5 @@
 					case 'field_escape': $col = 'field_escape'; break;
 					case 'order_onetime': $col = 'order_onetime'; break;
+					case 'csv_fieldnames': $col = 'csv_fieldnames'; break; 
 					case 'cron_interval': $col = 'cron_interval'; break;
 					case 'cron_path': $col = 'cron_path'; break;
@@ -610,5 +614,5 @@
             $arExportData = array();
             
-            if ($profil['format'] == self::FORMAT_CSV && $profil['csv_fieldnames'] == '1')
+            if ($profil['csv_fieldnames'] == '1')
             {
                 
@@ -629,4 +633,6 @@
             {
                 
+				$row = array();
+				
                 if ($profil['order_online'] == '1')
                 {
@@ -680,11 +686,6 @@
             {
                 
-                if ($profil['format'] == self::FORMAT_CSV)
-                {
-                    
-                    fputcsv($filehandler, $row, $profil['field_delimiter'], $profil['field_enclosure'], $profil['field_escape']);
-                    
-                }
-                
+                fputcsv($filehandler, $row, $profil['field_delimiter'], $profil['field_enclosure'], $profil['field_escape']);
+                                    
             }
             
@@ -700,65 +701,5 @@
                         
             return $tmpfname;
-            
-			/*			
-			if (sizeof($arFiles) > 1)
-			{
-				
-				// Zip erstellen und ablegen
-				$zip = new ZipArchive();					
-				$tmpfname = tempnam($this->getTmpFilePath(), "wpsg");
-				
-				if ($zip->open($tmpfname, ZIPARCHIVE::CREATE) == true) 
-				{
-
-					foreach ($arFiles as $f)
-					{
-					
-						$zip->addFile($f[1], $f[0]);
-						
-					}
-					
-					$zip->close();
-					
-					header("Content-Type: application/octet-stream"); 
-					header("Content-Disposition: attachment; filename=export.zip"); 
-					header("Pragma: no-cache"); 
-					header("Expires: 0"); 
-					
-					die(file_get_contents($tmpfname));
-					
-				}
-				else
-				{
-					
-					throw new \Exception(__('Konnte Zip Archiv nicht erstellen!', 'wpsg'));
-					
-				}
-
-			}
-			else
-			{
-			
-				if ($cron === false)
-				{
-				
-					header("Content-Type: text/csv"); 
-					header("Content-Disposition: attachment; filename=".$arFiles[0][0]); 
-					header("Pragma: no-cache"); 
-					header("Expires: 0"); 
-					
-					die(file_get_contents($arFiles[0][1]));
-					
-				}
-				else
-				{
-					
-					if (wpsg_remoteconnection::handleConenctionString($arFiles[0][2], $arFiles[0][3], $arFiles[0][1]) !== true) file_put_contents($arFiles[0][2], file_get_contents($arFiles[0][1]));
-					
-				}
-				
-			}
-			*/
-			
+            			
 		} // private function handleExportCSV($arProfile, $arOrderFilter = array(), $cron = false)
 
@@ -906,65 +847,5 @@
             
             return $tmpfname;
-              
-            /*
-			if (sizeof($arFiles) > 1)
-			{
-				
-				// Zip erstellen und ablegen
-				$zip = new ZipArchive();					
-				$tmpfname = tempnam($this->getTmpFilePath(), "wpsg");
-				
-				if ($zip->open($tmpfname, ZIPARCHIVE::CREATE) == true) 
-				{
-
-					foreach ($arFiles as $f)
-					{
-					
-						$zip->addFile($f[1], $f[0]);
-						
-					}
-					
-					$zip->close();
-					
-					header("Content-Type: application/octet-stream"); 
-					header("Content-Disposition: attachment; filename=export.zip"); 
-					header("Pragma: no-cache"); 
-					header("Expires: 0"); 
-					
-					die(file_get_contents($tmpfname));
-					
-				}
-				else
-				{
-					
-					throw new \Exception(__('Konnte Zip Archiv nicht erstellen!', 'wpsg'));
-					
-				}
-
-			}
-			else
-			{
-			
-				if ($cron === false)
-				{
-				
-					header("Content-Type: text/xml"); 
-					header("Content-Disposition: attachment; filename=".$arFiles[0][0]); 
-					header("Pragma: no-cache"); 
-					header("Expires: 0"); 
-					
-					die(file_get_contents($arFiles[0][1]));
-					
-				}
-				else
-				{
-					
-					if (wpsg_remoteconnection::handleConenctionString($arFiles[0][2], $arFiles[0][3], $arFiles[0][1]) !== true) file_put_contents($arFiles[0][2], file_get_contents($arFiles[0][1]));
-					
-				}
-				
-			} 
-            */
-			
+              			
 		} // private function handleExportXML($arProfile, $arOrderFilter = array(), $cron = false)
 
