function getExportContent()
{
    $fake_suppliernumber = array('No Name', '000', '0000', 'Diverse', '', ' ');
    $ordernumber = 0;
    $missing_article = array();
    $shop = 'hoh';
    $shopArticleData_hoh = getShopArticleData($shop, $missing_article);
    $mentionArticleData = getMentionArticleData();
    // UTF8 Bom
    writeBom();
    /*echo "<pre>";
      print_r($mentionArticleData);
      echo "<pre>";
      exit();*/
    $count = 0;
    $content = 'Artikelnummer|Hersteller-Artikelnummer|EAN|Hersteller|Bezeichnung|Kategorie 1|HEK|Lagerbestand|Image|Deep-Link' . "\r\n";
    $result = writeCsvFile($content, 'a');
    $content = "";
    $tmpContentArray = array();
    $cats = array();
    $catNbr = 0;
    $tmpCategories = array();
    $categories = array();
    foreach ($mentionArticleData as $key => $value) {
        unset($supplier, $suppliernumber, $ean, $art_bezeichnung, $net_price, $shop_ean, $shop_herst, $shop_herstnr, $shop_image, $shop_deeplink, $shop_categorie);
        $lagerbestand = 0;
        $shop_art_exists = 0;
        if ($value['VK_Netto'] > 0) {
            $net_price = $value['VK_Netto'];
        } else {
            if ($value['VK_Brutto'] > 0) {
                $net_price = $value['VK_Brutto'] / (1 + $value['mwst'] / 100);
            } else {
                if ($value['VK_Kalkulation'] > 0 && ($value['MLEKPREIS'] > 0 || $value['AEEKPREIS'] > 0)) {
                    if ($value['Rieck-Bestand'] > 0) {
                        $net_price = $value['MLEKPREIS'] * (1 + $value['VK_Kalkulation'] / 100);
                    } else {
                        $net_price = $value['AEEKPREIS'] * (1 + $value['VK_Kalkulation'] / 100);
                    }
                } else {
                    $net_price = 0;
                }
            }
        }
        /*if ( $key == 10184851 ) {
                    echo "<br>Netto: " . $net_price;
                    echo "<br>MLEKPREIS: " . $value['MLEKPREIS'];
                    echo "<br>AEEKPREIS: " . $value['AEEKPREIS'];
        
                    echo "<pre>";
                    print_r($shopArticleData_hoh);
                    echo "<pre>";
                    exit();
                }*/
        if ($net_price > 0 && $net_price >= $value['MLEKPREIS'] && $net_price >= $value['AEEKPREIS']) {
            if (array_key_exists($key, $shopArticleData_hoh)) {
                $shop_art_exists = 1;
                $shop_ean = $shopArticleData_hoh[$key]['ean'];
                #$selContent .= iconv('UTF-8', 'ISO-8859-1', $value)."\r\n";
                #$art_bezeichnung = iconv('ISO-8859-1', 'UTF-8', $shopArticleData_hoh[$key]['artikelbez']);
                $art_bezeichnung = $shopArticleData_hoh[$key]['artikelbez'];
                #$art_bezeichnung = $shopArticleData_hoh[$key]['artikelbez'];
                $shop_herstnr = $shopArticleData_hoh[$key]['suppliernumber'];
                $shop_herst = $shopArticleData_hoh[$key]['supplier'];
                $shop_image = $shopArticleData_hoh[$key]['imageURL'];
                $shop_deeplink = $shopArticleData_hoh[$key]['URL'];
            } else {
                $missing_article[] = $key;
            }
            if ($shop_art_exists == 1) {
                if ($value['AREANCODE'] == 0 && $shop_ean != 0 || $value['AREANCODE'] == '' && $shop_ean != '') {
                    $ean = $shop_ean;
                } else {
                    $ean = $value['AREANCODE'];
                }
                if ($value['ARHERSTNR'] == '' && $shop_herstnr != '') {
                    $suppliernumber = $shop_herstnr;
                } else {
                    $suppliernumber = $value['ARHERSTNR'];
                }
                if (($value['KOHTEXT'] == '' || trim($value['KOHTEXT']) == "keine Angabe") && $shop_herst != '') {
                    $supplier = $shop_herst;
                } else {
                    $supplier = $value['KOHTEXT'];
                }
                /*                if ( $key == 100073412 ) {
                                    echo "<br>Netto: " . $net_price;
                                    echo "<br>MLEKPREIS: " . $value['MLEKPREIS'];
                                    echo "<br>AEEKPREIS: " . $value['AEEKPREIS'];
                                    echo "<br>******************";
                                    echo "<br>EAN: " . $ean;
                                    echo "<br>suppliernumber: " . $suppliernumber;
                
                                    echo "<pre>";
                                    print_r($catNbr);
                                    echo "<pre>";
                                    exit();
                                }*/
                if ($ean != 0 && $ean != '' || !in_array($suppliernumber, $fake_suppliernumber)) {
                    if ($value['Rieck-Bestand'] > 0) {
                        $lagerbestand = $value['Rieck-Bestand'];
                    } else {
                        $lagerbestand = $value['Conrad-Bestand'];
                    }
                    $net_price = number_format($net_price + 0, 2, ',', '');
                    $art_bezeichnung = str_replace('"', '""', $art_bezeichnung);
                    $art_bezeichnung = str_replace('&quot;', '""', $art_bezeichnung);
                    $art_bezeichnung = str_replace('&amp;', '&', $art_bezeichnung);
                    $supplier = str_replace('&amp;', '&', $supplier);
                    $supplier = iconv('ISO-8859-1', 'UTF-8', $supplier);
                    $cats[] = $shopArticleData_hoh[$key]['artikelNr'];
                    $catNbr++;
                    /*if ( $key == 100073412 ) {
                                            echo "<br>Netto: " . $net_price;
                                            echo "<br>MLEKPREIS: " . $value['MLEKPREIS'];
                                            echo "<br>AEEKPREIS: " . $value['AEEKPREIS'];
                                            echo "<br>******************";
                                            echo "<br>EAN: " . $ean;
                                            echo "<br>suppliernumber: " . $suppliernumber;
                    
                                            echo "<pre>";
                                            print_r($catNbr);
                                            echo "<pre>";
                                            exit();
                                        }*/
                    if ($catNbr == 1000) {
                        $tmpCatArray = getCategories($shop, $cats);
                        if (!empty($tmpCategories)) {
                            $tmpCategories = array_merge($tmpCategories, $tmpCatArray);
                        } else {
                            $tmpCategories = $tmpCatArray;
                        }
                        $catNbr = 0;
                        unset($cats);
                    }
                    $tmpArray = array('ordernumber' => $key, 'suppliernumber' => $suppliernumber, 'ean' => $ean, 'supplier' => $supplier, 'artBez' => $art_bezeichnung, 'artikelNr' => $shopArticleData_hoh[$key]['artikelNr'], 'net_price' => $net_price, 'lagerbestand' => $lagerbestand, 'shop_image' => $shop_image, 'deeplink' => $shop_deeplink, 'shop' => $shop);
                    $tmpContentArray[] = $tmpArray;
                }
            }
        }
    }
    /*echo "<pre>";
      print_r($tmpContentArray);
      echo "<pre>";*/
    /*echo "<br>***************************** missing ******************************<br>";
        echo "<pre>";
        print_r($missing_article);
        echo "<pre>";
    
        exit('aus');*/
    if (!empty($cats)) {
        $tmpCatArray = getCategories($shop, $cats);
        if (!empty($tmpCategories)) {
            $tmpCategories = array_merge_recursive($tmpCategories, $tmpCatArray);
        } else {
            $tmpCategories = $tmpCatArray;
        }
        $catNbr = 0;
        unset($cats);
    }
    $categories[$shop] = $tmpCategories;
    foreach ($tmpContentArray as $contentValue) {
        /*if ($contentValue['ordernumber'] == 100073412) {
              echo "<pre>";
              print_r($contentValue);
              echo "<pre>";
          }*/
        if (array_key_exists("'" . $contentValue['artikelNr'] . "'", $categories[$contentValue['shop']])) {
            if ($contentValue['ordernumber'] == 100073412) {
                echo "<br> array found";
            }
            $shop_categorie = $categories[$contentValue['shop']]["'" . $contentValue['artikelNr'] . "'"];
        } else {
            if ($contentValue['ordernumber'] == 100073412) {
                echo "<br> array not found";
            }
            $shop_categorie = $contentValue['shop'];
        }
        $content .= $contentValue['ordernumber'] . '|' . $contentValue['suppliernumber'] . '|' . $contentValue['ean'] . '|' . $contentValue['supplier'] . '|"' . $contentValue['artBez'] . '"|' . $shop_categorie . '|' . $contentValue['net_price'] . '|' . $contentValue['lagerbestand'] . '|' . $contentValue['shop_image'] . '|' . $contentValue['deeplink'] . "\r\n";
    }
    #echo "<pre>";
    #print_r($tmpContentArray);
    #echo "<pre>";
    $result = writeCsvFile($content, 'a');
    #exit("aus");
    unset($content, $tmpCategories, $tmpContentArray, $shopArticleData_hoh);
    if (!empty($missing_article)) {
        $shop = 'getgoods';
        $content = '';
        $tmpCategories = array();
        $tmpContentArray = array();
        $shopArticleData_hoh = getShopArticleData($shop, $missing_article);
        foreach ($mentionArticleData as $key => $value) {
            unset($supplier, $suppliernumber, $ean, $art_bezeichnung, $net_price, $shop_ean, $shop_herst, $shop_herstnr, $shop_image, $shop_deeplink, $shop_categorie);
            $lagerbestand = 0;
            $shop_art_exists = 0;
            if ($value['VK_Netto'] > 0) {
                $net_price = $value['VK_Netto'];
            } else {
                if ($value['VK_Brutto'] > 0) {
                    $net_price = $value['VK_Brutto'] / (1 + $value['mwst'] / 100);
                } else {
                    if ($value['VK_Kalkulation'] > 0 && ($value['MLEKPREIS'] > 0 || $value['AEEKPREIS'] > 0)) {
                        if ($value['Rieck-Bestand'] > 0) {
                            $net_price = $value['MLEKPREIS'] * (1 + $value['VK_Kalkulation'] / 100);
                        } else {
                            $net_price = $value['AEEKPREIS'] * (1 + $value['VK_Kalkulation'] / 100);
                        }
                    } else {
                        $net_price = 0;
                    }
                }
            }
            if ($net_price > 0 && $net_price >= $value['MLEKPREIS'] && $net_price >= $value['AEEKPREIS'] && in_array($key, $missing_article)) {
                if (array_key_exists($key, $shopArticleData_hoh)) {
                    $shop_art_exists = 1;
                    $shop_ean = $shopArticleData_hoh[$key]['ean'];
                    $art_bezeichnung = $shopArticleData_hoh[$key]['artikelbez'];
                    $shop_herstnr = $shopArticleData_hoh[$key]['suppliernumber'];
                    $shop_herst = $shopArticleData_hoh[$key]['supplier'];
                    $shop_image = $shopArticleData_hoh[$key]['imageURL'];
                    $shop_deeplink = $shopArticleData_hoh[$key]['URL'];
                } else {
                    $missing_article[] = $key;
                }
                if ($shop_art_exists == 1) {
                    if ($value['AREANCODE'] == 0 && $shop_ean != 0 || $value['AREANCODE'] == '' && $shop_ean != '') {
                        $ean = $shop_ean;
                    } else {
                        $ean = $value['AREANCODE'];
                    }
                    if ($value['ARHERSTNR'] == '' && $shop_herstnr != '') {
                        $suppliernumber = $shop_herstnr;
                    } else {
                        $suppliernumber = $value['ARHERSTNR'];
                    }
                    if (($value['KOHTEXT'] == '' || trim($value['KOHTEXT']) == "keine Angabe") && $shop_herst != '') {
                        $supplier = $shop_herst;
                    } else {
                        $supplier = $value['KOHTEXT'];
                    }
                    if ($ean != 0 && $ean != '' || !in_array($suppliernumber, $fake_suppliernumber)) {
                        if ($value['Rieck-Bestand'] > 0) {
                            $lagerbestand = $value['Rieck-Bestand'];
                        } else {
                            $lagerbestand = $value['Conrad-Bestand'];
                        }
                        $net_price = number_format($net_price + 0, 2, ',', '');
                        $art_bezeichnung = str_replace('"', '""', $art_bezeichnung);
                        $art_bezeichnung = str_replace('&quot;', '""', $art_bezeichnung);
                        $art_bezeichnung = str_replace('&amp;', '&', $art_bezeichnung);
                        $supplier = str_replace('&amp;', '&', $supplier);
                        $cats[] = $shopArticleData_hoh[$key]['artikelNr'];
                        $catNbr++;
                        if ($catNbr == 1000) {
                            $tmpCatArray = getCategories($shop, $cats);
                            if (!empty($tmpCategories)) {
                                $tmpCategories = array_merge($tmpCategories, $tmpCatArray);
                            } else {
                                $tmpCategories = $tmpCatArray;
                            }
                            $catNbr = 0;
                            unset($cats);
                        }
                        $tmpArray = array('ordernumber' => $key, 'suppliernumber' => $suppliernumber, 'ean' => $ean, 'supplier' => $supplier, 'artBez' => $art_bezeichnung, 'artikelNr' => $shopArticleData_hoh[$key]['artikelNr'], 'net_price' => $net_price, 'lagerbestand' => $lagerbestand, 'shop_image' => $shop_image, 'deeplink' => $shop_deeplink, 'shop' => $shop);
                        $tmpContentArray[] = $tmpArray;
                    }
                }
            }
        }
        if (!empty($cats)) {
            $tmpCatArray = getCategories($shop, $cats);
            if (!empty($tmpCategories)) {
                $tmpCategories = array_merge($tmpCategories, $tmpCatArray);
            } else {
                $tmpCategories = $tmpCatArray;
            }
            $catNbr = 0;
            unset($cats);
        }
    }
    $categories[$shop] = $tmpCategories;
    foreach ($tmpContentArray as $contentValue) {
        if (array_key_exists("'" . $contentValue['artikelNr'] . "'", $categories[$contentValue['shop']])) {
            $shop_categorie = $categories[$contentValue['shop']]["'" . $contentValue['artikelNr'] . "'"];
        } else {
            $shop_categorie = $contentValue['shop'];
        }
        $content .= $contentValue['ordernumber'] . '|' . $contentValue['suppliernumber'] . '|' . $contentValue['ean'] . '|' . $contentValue['supplier'] . '|"' . $contentValue['artBez'] . '"|' . $shop_categorie . '|' . $contentValue['net_price'] . '|' . $contentValue['lagerbestand'] . '|' . $contentValue['shop_image'] . '|' . $contentValue['deeplink'] . "\r\n";
    }
    $result = writeCsvFile($content, 'a');
    unset($content);
    return $result;
}
function getExportContent()
{
    $fake_suppliernumber = array('No Name', '000', '0000', 'Diverse', '', ' ');
    $ordernumber = 0;
    $missing_article = array();
    $shop = 'hoh';
    $catpaths = getCategoryPaths();
    $shopArticleData_hoh = getShopArticleData($shop, $missing_article);
    $mentionArticleData = getMentionArticleData();
    $count = 0;
    $content = 'Artikelnummer|Hersteller-Artikelnummer|EAN|Hersteller|Bezeichnung|Kategorie 1|HEK|Lagerbestand|Image|Deep-Link' . "\r\n";
    $tmpContentArray = array();
    $cats = array();
    $catNbr = 0;
    $tmpCategories = array();
    $categories = array();
    foreach ($mentionArticleData as $key => $value) {
        unset($supplier, $suppliernumber, $ean, $art_bezeichnung, $net_price, $shop_ean, $shop_herst, $shop_herstnr, $shop_image, $shop_deeplink, $shop_categorie);
        $lagerbestand = 0;
        $shop_art_exists = 0;
        if ($value['VK_Netto'] > 0) {
            $net_price = $value['VK_Netto'];
        } else {
            if ($value['VK_Brutto'] > 0) {
                $net_price = $value['VK_Brutto'] / (1 + $value['mwst'] / 100);
            } else {
                if ($value['VK_Kalkulation'] > 0 && ($value['MLEKPREIS'] > 0 || $value['AEEKPREIS'] > 0)) {
                    if ($value['Rieck-Bestand'] > 0) {
                        $net_price = $value['MLEKPREIS'] * (1 + $value['VK_Kalkulation'] / 100);
                    } else {
                        $net_price = $value['AEEKPREIS'] * (1 + $value['VK_Kalkulation'] / 100);
                    }
                } else {
                    $net_price = 0;
                }
            }
        }
        if ($net_price > 0 && $net_price >= $value['MLEKPREIS'] && $net_price >= $value['AEEKPREIS']) {
            if (array_key_exists($key, $shopArticleData_hoh)) {
                $shop_art_exists = 1;
                $shop_ean = $shopArticleData_hoh[$key]['ean'];
                $art_bezeichnung = $shopArticleData_hoh[$key]['artikelbez'];
                $shop_herstnr = $shopArticleData_hoh[$key]['suppliernumber'];
                $shop_herst = $shopArticleData_hoh[$key]['supplier'];
                $shop_image = $shopArticleData_hoh[$key]['imageURL'];
                $shop_deeplink = $shopArticleData_hoh[$key]['URL'];
            } else {
                $missing_article[] = $key;
            }
            if ($shop_art_exists == 1) {
                if ($value['AREANCODE'] == 0 && $shop_ean != 0 || $value['AREANCODE'] == '' && $shop_ean != '') {
                    $ean = $shop_ean;
                } else {
                    $ean = $value['AREANCODE'];
                }
                if ($value['ARHERSTNR'] == '' && $shop_herstnr != '') {
                    $suppliernumber = $shop_herstnr;
                } else {
                    $suppliernumber = $value['ARHERSTNR'];
                }
                if (($value['KOHTEXT'] == '' || trim($value['KOHTEXT']) == "keine Angabe") && $shop_herst != '') {
                    $supplier = $shop_herst;
                } else {
                    $supplier = $value['KOHTEXT'];
                }
                if ($ean != 0 && $ean != '' || !in_array($suppliernumber, $fake_suppliernumber)) {
                    if ($value['Rieck-Bestand'] > 0) {
                        $lagerbestand = $value['Rieck-Bestand'];
                    } else {
                        $lagerbestand = $value['Conrad-Bestand'];
                    }
                    $net_price = number_format($net_price + 0, 2, ',', '');
                    $art_bezeichnung = str_replace('"', '""', $art_bezeichnung);
                    $art_bezeichnung = str_replace('&quot;', '""', $art_bezeichnung);
                    $art_bezeichnung = str_replace('&amp;', '&', $art_bezeichnung);
                    $supplier = str_replace('&amp;', '&', $supplier);
                    if (key_exists($key, $catpaths) && key_exists($shop, $catpaths[$key])) {
                        $categoriepath = $catpaths[$key][$shop];
                    } else {
                        $categoriepath = '';
                        $cats[] = $shopArticleData_hoh[$key]['artikelNr'];
                        $catNbr++;
                    }
                    if ($catNbr == 1000) {
                        $tmpCatArray = getCategories($shop, $cats);
                        if (!empty($tmpCategories)) {
                            $tmpCategories = array_merge($tmpCategories, $tmpCatArray);
                        } else {
                            $tmpCategories = $tmpCatArray;
                        }
                        $catNbr = 0;
                        unset($cats);
                    }
                    $tmpArray = array('ordernumber' => $key, 'suppliernumber' => $suppliernumber, 'ean' => $ean, 'supplier' => $supplier, 'artBez' => $art_bezeichnung, 'artikelNr' => $shopArticleData_hoh[$key]['artikelNr'], 'net_price' => $net_price, 'lagerbestand' => $lagerbestand, 'shop_image' => $shop_image, 'deeplink' => $shop_deeplink, 'shop' => $shop, 'category' => $categoriepath);
                    $tmpContentArray[] = $tmpArray;
                }
            }
        }
    }
    if (!empty($cats)) {
        $tmpCatArray = getCategories($shop, $cats);
        if (!empty($tmpCategories)) {
            $tmpCategories = array_merge_recursive($tmpCategories, $tmpCatArray);
        } else {
            $tmpCategories = $tmpCatArray;
        }
        $catNbr = 0;
        unset($cats);
    }
    $categories[$shop] = $tmpCategories;
    foreach ($tmpContentArray as $contentValue) {
        if ($contentValue['category'] != '') {
            $shop_categorie = $contentValue['category'];
        } else {
            if (array_key_exists("'" . $contentValue['artikelNr'] . "'", $categories[$contentValue['shop']])) {
                $shop_categorie = $categories[$contentValue['shop']]["'" . $contentValue['artikelNr'] . "'"];
                writeCategoryPaths($contentValue['ordernumber'], $contentValue['shop'], $shop_categorie);
            } else {
                $shop_categorie = $contentValue['shop'];
            }
        }
        $content .= $contentValue['ordernumber'] . '|' . $contentValue['suppliernumber'] . '|' . $contentValue['ean'] . '|' . $contentValue['supplier'] . '|"' . $contentValue['artBez'] . '"|' . $shop_categorie . '|' . $contentValue['net_price'] . '|' . $contentValue['lagerbestand'] . '|' . $contentValue['shop_image'] . '|' . $contentValue['deeplink'] . "\r\n";
    }
    $result = writeCsvFile($content, 'w');
    unset($content, $tmpCategories, $tmpContentArray);
    print '<br>AnzahlMissing: ' . count($missing_article);
    if (!empty($missing_article)) {
        $content = '';
        $shop = 'getgoods';
        unset($shopArticleData_hoh);
        $shopArticleData_hoh = getShopArticleData($shop, $missing_article);
        foreach ($mentionArticleData as $key => $value) {
            unset($supplier, $suppliernumber, $ean, $art_bezeichnung, $net_price, $shop_ean, $shop_herst, $shop_herstnr, $shop_image, $shop_deeplink, $shop_categorie);
            $lagerbestand = 0;
            $shop_art_exists = 0;
            if ($value['VK_Netto'] > 0) {
                $net_price = $value['VK_Netto'];
            } else {
                if ($value['VK_Brutto'] > 0) {
                    $net_price = $value['VK_Brutto'] / (1 + $value['mwst'] / 100);
                } else {
                    if ($value['VK_Kalkulation'] > 0 && ($value['MLEKPREIS'] > 0 || $value['AEEKPREIS'] > 0)) {
                        if ($value['Rieck-Bestand'] > 0) {
                            $net_price = $value['MLEKPREIS'] * (1 + $value['VK_Kalkulation'] / 100);
                        } else {
                            $net_price = $value['AEEKPREIS'] * (1 + $value['VK_Kalkulation'] / 100);
                        }
                    } else {
                        $net_price = 0;
                    }
                }
            }
            if ($net_price > 0 && $net_price >= $value['MLEKPREIS'] && $net_price >= $value['AEEKPREIS'] && in_array($key, $missing_article)) {
                if (array_key_exists($key, $shopArticleData_hoh)) {
                    $shop_art_exists = 1;
                    $shop_ean = $shopArticleData_hoh[$key]['ean'];
                    $art_bezeichnung = $shopArticleData_hoh[$key]['artikelbez'];
                    $shop_herstnr = $shopArticleData_hoh[$key]['suppliernumber'];
                    $shop_herst = $shopArticleData_hoh[$key]['supplier'];
                    $shop_image = $shopArticleData_hoh[$key]['imageURL'];
                    $shop_deeplink = $shopArticleData_hoh[$key]['URL'];
                } else {
                    $missing_article[] = $key;
                }
                if ($shop_art_exists == 1) {
                    if ($value['AREANCODE'] == 0 && $shop_ean != 0 || $value['AREANCODE'] == '' && $shop_ean != '') {
                        $ean = $shop_ean;
                    } else {
                        $ean = $value['AREANCODE'];
                    }
                    if ($value['ARHERSTNR'] == '' && $shop_herstnr != '') {
                        $suppliernumber = $shop_herstnr;
                    } else {
                        $suppliernumber = $value['ARHERSTNR'];
                    }
                    if (($value['KOHTEXT'] == '' || trim($value['KOHTEXT']) == "keine Angabe") && $shop_herst != '') {
                        $supplier = $shop_herst;
                    } else {
                        $supplier = $value['KOHTEXT'];
                    }
                    if ($ean != 0 && $ean != '' || !in_array($suppliernumber, $fake_suppliernumber)) {
                        if ($value['Rieck-Bestand'] > 0) {
                            $lagerbestand = $value['Rieck-Bestand'];
                        } else {
                            $lagerbestand = $value['Conrad-Bestand'];
                        }
                        $net_price = number_format($net_price + 0, 2, ',', '');
                        $art_bezeichnung = str_replace('"', '""', $art_bezeichnung);
                        $art_bezeichnung = str_replace('&quot;', '""', $art_bezeichnung);
                        $art_bezeichnung = str_replace('&amp;', '&', $art_bezeichnung);
                        $supplier = str_replace('&amp;', '&', $supplier);
                        if (key_exists($key, $catpaths) && key_exists($shop, $catpaths[$key])) {
                            $categoriepath = $catpaths[$key][$shop];
                        } else {
                            $categoriepath = '';
                            $cats[] = $shopArticleData_hoh[$key]['artikelNr'];
                            $catNbr++;
                        }
                        if ($catNbr == 1000) {
                            $tmpCatArray = getCategories($shop, $cats);
                            if (!empty($tmpCategories)) {
                                $tmpCategories = array_merge($tmpCategories, $tmpCatArray);
                            } else {
                                $tmpCategories = $tmpCatArray;
                            }
                            $catNbr = 0;
                            unset($cats);
                        }
                        $tmpArray = array('ordernumber' => $key, 'suppliernumber' => $suppliernumber, 'ean' => $ean, 'supplier' => $supplier, 'artBez' => $art_bezeichnung, 'artikelNr' => $shopArticleData_hoh[$key]['artikelNr'], 'net_price' => $net_price, 'lagerbestand' => $lagerbestand, 'shop_image' => $shop_image, 'deeplink' => $shop_deeplink, 'shop' => $shop, 'category' => $categoriepath);
                        $tmpContentArray[] = $tmpArray;
                    }
                }
            }
        }
        if (!empty($cats)) {
            $tmpCatArray = getCategories($shop, $cats);
            if (!empty($tmpCategories)) {
                $tmpCategories = array_merge($tmpCategories, $tmpCatArray);
            } else {
                $tmpCategories = $tmpCatArray;
            }
            $catNbr = 0;
            unset($cats);
        }
    }
    $categories[$shop] = $tmpCategories;
    foreach ($tmpContentArray as $contentValue) {
        if ($contentValue['category'] != '') {
            $shop_categorie = $contentValue['category'];
        } else {
            if (array_key_exists("'" . $contentValue['artikelNr'] . "'", $categories[$contentValue['shop']])) {
                $shop_categorie = $categories[$contentValue['shop']]["'" . $contentValue['artikelNr'] . "'"];
                writeCategoryPaths($contentValue['ordernumber'], $contentValue['shop'], $shop_categorie);
            } else {
                $shop_categorie = $contentValue['shop'];
            }
        }
        $content .= $contentValue['ordernumber'] . '|' . $contentValue['suppliernumber'] . '|' . $contentValue['ean'] . '|' . $contentValue['supplier'] . '|"' . $contentValue['artBez'] . '"|' . $shop_categorie . '|' . $contentValue['net_price'] . '|' . $contentValue['lagerbestand'] . '|' . $contentValue['shop_image'] . '|' . $contentValue['deeplink'] . "\r\n";
    }
    $result = writeCsvFile($content, 'a');
    unset($content);
    return $result;
}