Index: /mods/wpsg_mod_export.class.php
===================================================================
--- /mods/wpsg_mod_export.class.php	(revision 8236)
+++ /mods/wpsg_mod_export.class.php	(revision 8237)
@@ -1867,51 +1867,55 @@
             $field_value = $f['value_key'];
 
-			if (isset($this->arCache['oOrder'][$o_id])) {
-				
-				$order = $this->arCache['order'][$o_id];
-
-				/** @var wpsg_order $oOrder */
-				$oOrder = $this->arCache['oOrder'][$o_id];
-
-				/** @var array $arCalculation */
-				$arCalculation = $this->arCache['arCalculation'][$o_id];
-
-				$customer_id = $oOrder->getCustomer()->getId();
-				
-			} else {
-				
-				/** @var wpsg_order $oOrder */
-	            $oOrder = wpsg_order::getInstance($o_id);
-				
-                $order = $oOrder->data;
-                $order['custom_data'] = unserialize($oOrder->__get('custom_data'));
-
-                /* Bestellvariablen */
-                if ($this->shop->hasMod('wpsg_mod_ordervars')) {
-
-                    $order['bvars'] = @unserialize($oOrder->__get('bvars'));
-
-                }
-
-                /* Produktvariablen */
-                if ($this->shop->hasMod('wpsg_mod_productvars')) {
-
-                    $order['pvars'] = @unserialize($oOrder->__get('pvars'));
-
-                }
-								
-				$oCalculation = new \wpsg\wpsg_calculation();
-	            $oCalculation->fromDB($oOrder->getId());
-			
-				/** @var array $arCalculation */
-				$arCalculation = $oCalculation->getCalculationArray();
-			
-				$customer_id = $oOrder->getCustomer()->getId();
-				
-				$this->arCache['oOrder'][$o_id] = $oOrder;
-				$this->arCache['arCalculation'][$o_id] = $arCalculation;
-				$this->arCache['order'][$o_id] = $order;
-							
-			}
+            if ($o_id !== NULL) {
+
+                if (isset($this->arCache['oOrder'][$o_id])) {
+
+                    $order = $this->arCache['order'][$o_id];
+
+                    /** @var wpsg_order $oOrder */
+                    $oOrder = $this->arCache['oOrder'][$o_id];
+
+                    /** @var array $arCalculation */
+                    $arCalculation = $this->arCache['arCalculation'][$o_id];
+
+                    $customer_id = $oOrder->getCustomer()->getId();
+                    
+                } else {
+                    
+                    /** @var wpsg_order $oOrder */
+                    $oOrder = wpsg_order::getInstance($o_id);
+                    
+                    $order = $oOrder->data;
+                    $order['custom_data'] = unserialize($oOrder->__get('custom_data'));
+
+                    /* Bestellvariablen */
+                    if ($this->shop->hasMod('wpsg_mod_ordervars')) {
+
+                        $order['bvars'] = @unserialize($oOrder->__get('bvars'));
+
+                    }
+
+                    /* Produktvariablen */
+                    if ($this->shop->hasMod('wpsg_mod_productvars')) {
+
+                        $order['pvars'] = @unserialize($oOrder->__get('pvars'));
+
+                    }
+                                    
+                    $oCalculation = new \wpsg\wpsg_calculation();
+                    $oCalculation->fromDB($oOrder->getId());
+                
+                    /** @var array $arCalculation */
+                    $arCalculation = $oCalculation->getCalculationArray();
+                
+                    $customer_id = $oOrder->getCustomer()->getId();
+                    
+                    $this->arCache['oOrder'][$o_id] = $oOrder;
+                    $this->arCache['arCalculation'][$o_id] = $arCalculation;
+                    $this->arCache['order'][$o_id] = $order;
+                                
+                }
+
+            }
 						
 			if ($p_id !== null) {
@@ -1974,5 +1978,5 @@
 			}
 			
-            $oFrontendCountry = $oOrder->getInvoiceCountry();
+            if (isset($oOrder)) $oFrontendCountry = $oOrder->getInvoiceCountry();
 
             $getTaxSum = function($tax_code) use (&$arCalculation) {
