예제 #1
0
 function remove_categories($category_id)
 {
     $categories = xtc_get_category_tree($category_id, '', '0', '', true);
     $products = array();
     $products_delete = array();
     for ($i = 0, $n = sizeof($categories); $i < $n; $i++) {
         $product_ids_query = xtc_db_query("SELECT products_id\n                                                     FROM " . TABLE_PRODUCTS_TO_CATEGORIES . "\n                                                     WHERE categories_id = '" . $categories[$i]['id'] . "'");
         while ($product_ids = xtc_db_fetch_array($product_ids_query)) {
             $products[$product_ids['products_id']]['categories'][] = $categories[$i]['id'];
         }
     }
     reset($products);
     while (list($key, $value) = each($products)) {
         $category_ids = '';
         for ($i = 0, $n = sizeof($value['categories']); $i < $n; $i++) {
             $category_ids .= '\'' . $value['categories'][$i] . '\', ';
         }
         $category_ids = substr($category_ids, 0, -2);
         $check_query = xtc_db_query("SELECT COUNT(*) AS total\n                                                 FROM " . TABLE_PRODUCTS_TO_CATEGORIES . "\n                                                 WHERE products_id = '" . $key . "'\n                                                 AND categories_id NOT IN (" . $category_ids . ")");
         $check = xtc_db_fetch_array($check_query);
         if ($check['total'] < '1') {
             $products_delete[$key] = $key;
         }
     }
     // Removing categories can be a lengthy process
     @xtc_set_time_limit(0);
     for ($i = 0, $n = sizeof($categories); $i < $n; $i++) {
         $this->remove_category($categories[$i]['id']);
     }
     reset($products_delete);
     while (list($key) = each($products_delete)) {
         $this->remove_product($key);
     }
 }
예제 #2
0
 function process($file)
 {
     @xtc_set_time_limit(0);
     require DIR_FS_CATALOG . DIR_WS_CLASSES . 'xtcPrice.php';
     $xtPrice = new xtcPrice($_POST['currencies'], $_POST['status']);
     //$schema = 'Produktbezeichnung;Beschreibung;Preis;Url;Bild;W&auml;hrung;Kategorie;G&uuml;ltig bis;G&uuml;ltig ab;FSK;Typ;Produkt ID;Hersteller;Bestellnummer;Suchbegriffe;Preistyp' . "\n";
     $export_query = xtc_db_query("SELECT\n                             p.products_id,\n                             pd.products_name,\n                             pd.products_description,\n                             p.products_model,\n                             p.products_image,\n                             p.products_price,\n                             p.products_status,\n                             p.products_date_available,\n                             p.products_shippingtime,\n                             p.products_discount_allowed,\n                             pd.products_meta_keywords,\n                             p.products_tax_class_id,\n                             p.products_date_added,\n                             m.manufacturers_name\n                         FROM\n                             " . TABLE_PRODUCTS . " p LEFT JOIN\n                             " . TABLE_MANUFACTURERS . " m\n                           ON p.manufacturers_id = m.manufacturers_id LEFT JOIN\n                             " . TABLE_PRODUCTS_DESCRIPTION . " pd\n                           ON p.products_id = pd.products_id AND\n                            pd.language_id = '" . $_SESSION['languages_id'] . "' LEFT JOIN\n                             " . TABLE_SPECIALS . " s\n                           ON p.products_id = s.products_id\n                         WHERE\n                           p.products_status = 1\n                         ORDER BY\n                            p.products_date_added DESC,\n                            pd.products_name");
     while ($products = xtc_db_fetch_array($export_query)) {
         $products_price = $xtPrice->xtcGetPrice($products['products_id'], $format = false, 1, $products['products_tax_class_id'], '');
         // remove trash
         $products_description = strip_tags($products['products_description']);
         $products_description = substr($products_description, 0, 1000) . '..';
         $products_description = str_replace(";", ", ", $products_description);
         $products_description = str_replace("'", ", ", $products_description);
         $products_description = str_replace("\n", " ", $products_description);
         $products_description = str_replace("\r", " ", $products_description);
         $products_description = str_replace("\t", " ", $products_description);
         $products_description = str_replace("\v", " ", $products_description);
         $products_description = str_replace("&quot,", " \"", $products_description);
         $products_description = str_replace("&qout,", " \"", $products_description);
         // get product categorie
         $categorie_query = xtc_db_query("SELECT\n                                            categories_id\n                                            FROM " . TABLE_PRODUCTS_TO_CATEGORIES . "\n                                            WHERE products_id='" . $products['products_id'] . "'");
         while ($categorie_data = xtc_db_fetch_array($categorie_query)) {
             $categories = $categorie_data['categories_id'];
         }
         $categorie_query = xtc_db_query("SELECT\n                                            categories_name\n                                            FROM " . TABLE_CATEGORIES_DESCRIPTION . "\n                                            WHERE categories_id='" . $categories . "'\n                                            and language_id='" . $_SESSION['languages_id'] . "'");
         $categorie_data = xtc_db_fetch_array($categorie_query);
         //-- SNAKELAB ----//
         //$cat = $this->buildCAT($categories);
         require_once DIR_FS_INC . 'xtc_href_link_from_admin.inc.php';
         $link = xtc_href_link_from_admin('product_info.php', 'products_id=' . $products['products_id']);
         preg_match("/\\?/", $link) ? $link .= '&' : ($link .= '?');
         $link .= 'referer=' . $this->code;
         !empty($_POST['campaign']) ? $link .= '&' . $_POST['campaign'] : false;
         //-- SNAKELAB ----//
         //create content
         $schema .= $products['products_name'] . ';' . $products_description . ';' . number_format($products_price, 2, '.', '') . ';' . $link . ';' . HTTP_CATALOG_SERVER . DIR_WS_CATALOG_THUMBNAIL_IMAGES . $products['products_image'] . ';' . $_POST['currencies'] . ';' . $categorie_data['categories_name'] . ';' . ';' . xtc_date_short($products['products_date_available']) . ';' . ';' . ';' . $products['products_model'] . ';' . $products['manufacturers_name'] . ';' . $products['products_model'] . ';' . $products['products_meta_keywords'] . ';' . '0' . "\n";
     }
     // create File
     $fp = fopen(DIR_FS_DOCUMENT_ROOT . 'export/' . $file, "w+");
     fputs($fp, $schema);
     fclose($fp);
     switch ($_POST['export']) {
         case 'yes':
             // send File to Browser
             $extension = substr($file, -3);
             $fp = fopen(DIR_FS_DOCUMENT_ROOT . 'export/' . $file, "rb");
             $buffer = fread($fp, filesize(DIR_FS_DOCUMENT_ROOT . 'export/' . $file));
             fclose($fp);
             header('Content-type: application/x-octet-stream');
             header('Content-disposition: attachment; filename=' . $file);
             echo $buffer;
             exit;
             break;
     }
 }
예제 #3
0
 function process($file)
 {
     @xtc_set_time_limit(0);
     require DIR_FS_CATALOG . DIR_WS_CLASSES . 'xtcPrice.php';
     $xtPrice = new xtcPrice($_POST['currencies'], $_POST['status']);
     $schema = 'Artikelnummer;Preis;Produktname;Kategorie;USt;EAN;ProduktURL;BildURL;Beschreibung' . "\n";
     $export_query = xtc_db_query("SELECT\n                             p.products_id,\n                             pd.products_name,\n                             pd.products_description,\n                             p.products_model,p.products_ean,\n                             p.products_image,\n                             p.products_shippingtime,\n                             p.products_price,\n                             p.products_status,\n                             p.products_discount_allowed,\n                             p.products_tax_class_id,\n                             p.products_date_added,\n                             m.manufacturers_name\n                         FROM\n                             " . TABLE_PRODUCTS . " p LEFT JOIN\n                             " . TABLE_MANUFACTURERS . " m\n                           ON p.manufacturers_id = m.manufacturers_id LEFT JOIN\n                             " . TABLE_PRODUCTS_DESCRIPTION . " pd\n                           ON p.products_id = pd.products_id AND\n                            pd.language_id = '" . $_SESSION['languages_id'] . "' LEFT JOIN\n                             " . TABLE_SPECIALS . " s\n                           ON p.products_id = s.products_id\n                         WHERE\n                           p.products_status = 1\n                         ORDER BY\n                            p.products_date_added DESC,\n                            pd.products_name");
     while ($products = xtc_db_fetch_array($export_query)) {
         $products_price = $xtPrice->xtcGetPrice($products['products_id'], $format = false, 1, $products['products_tax_class_id'], '');
         // remove trash
         $products_description = $products['products_description'];
         $products_description = str_replace("\n", " ", $products_description);
         $products_description = str_replace("<br>", " ", $products_description);
         $products_description = str_replace("<BR>", " ", $products_description);
         $products_description = str_replace("<br />", " ", $products_description);
         $products_description = str_replace("\r", " ", $products_description);
         $products_description = str_replace(";", " ", $products_description);
         $products_description = strip_tags($products_description);
         $products_description = str_replace('|', ' ', $products_description);
         $products_description = substr($products_description, 0, 1000) . " ... ";
         $categorie_query = xtc_db_query("SELECT\n                                            categories_id\n                                            FROM " . TABLE_PRODUCTS_TO_CATEGORIES . "\n                                            WHERE products_id='" . $products['products_id'] . "'");
         while ($categorie_data = xtc_db_fetch_array($categorie_query)) {
             $categories = $categorie_data['categories_id'];
         }
         $categorie_query = xtc_db_query("SELECT\n                                            categories_name\n                                            FROM " . TABLE_CATEGORIES_DESCRIPTION . "\n                                            WHERE categories_id='" . $categories . "'\n                                            and language_id='" . $_SESSION['languages_id'] . "'");
         $categorie_data = xtc_db_fetch_array($categorie_query);
         //create content
         if ($products['products_image'] == '') {
             $wein_image = "";
         } else {
             $wein_image = HTTP_CATALOG_SERVER . DIR_WS_CATALOG_THUMBNAIL_IMAGES . $products['products_image'];
         }
         //create content
         $schema .= $products['products_model'] . ';' . number_format($products_price, 2, '.', '') . ';' . $products['products_name'] . ';' . $categorie_data['categories_name'] . ';' . $xtPrice->TAX[$products['products_tax_class_id']] . ';' . $products['products_ean'] . ';' . HTTP_CATALOG_SERVER . DIR_WS_CATALOG . 'product_info.php?' . $_POST['campaign'] . xtc_product_link($products['products_id'], $products['products_name']) . ';' . $wein_image . ';' . $products_description . "\n";
     }
     // create File
     $fp = fopen(DIR_FS_DOCUMENT_ROOT . 'export/' . $file, "w+");
     fputs($fp, $schema);
     fclose($fp);
     switch ($_POST['export']) {
         case 'yes':
             // send File to Browser
             $extension = substr($file, -3);
             $fp = fopen(DIR_FS_DOCUMENT_ROOT . 'export/' . $file, "rb");
             $buffer = fread($fp, filesize(DIR_FS_DOCUMENT_ROOT . 'export/' . $file));
             fclose($fp);
             header('Content-type: application/x-octet-stream');
             header('Content-disposition: attachment; filename=' . $file);
             echo $buffer;
             exit;
             break;
     }
 }
예제 #4
0
 function process($file)
 {
     @xtc_set_time_limit(0);
     require DIR_FS_CATALOG . DIR_WS_CLASSES . 'xtcPrice.php';
     $xtPrice = new xtcPrice($_POST['currencies'], $_POST['status']);
     $schema = 'Artikelnummer|Produktbezeichnung|Produktbeschreibung|Preis inkl. Mwst.|URL|Produktfoto' . "\n";
     $export_query = xtc_db_query("SELECT\n                             p.products_id,\n                             pd.products_name,\n                             pd.products_description,\n                             p.products_model,\n                             p.products_image,\n                             p.products_shippingtime,\n                             p.products_price,\n                             p.products_status,\n                             p.products_discount_allowed,\n                             p.products_tax_class_id,\n                             p.products_date_added,\n                             m.manufacturers_name\n                         FROM\n                             " . TABLE_PRODUCTS . " p LEFT JOIN\n                             " . TABLE_MANUFACTURERS . " m\n                           ON p.manufacturers_id = m.manufacturers_id LEFT JOIN\n                             " . TABLE_PRODUCTS_DESCRIPTION . " pd\n                           ON p.products_id = pd.products_id AND\n                            pd.language_id = '" . $_SESSION['languages_id'] . "' LEFT JOIN\n                             " . TABLE_SPECIALS . " s\n                           ON p.products_id = s.products_id\n                         WHERE\n                           p.products_status = 1\n                         ORDER BY\n                            p.products_date_added DESC,\n                            pd.products_name");
     while ($products = xtc_db_fetch_array($export_query)) {
         $products_price = $xtPrice->xtcGetPrice($products['products_id'], $format = false, 1, $products['products_tax_class_id'], '');
         // remove trash
         $products_description = $products['products_description'];
         $products_description = str_replace("\n", " ", $products_description);
         $products_description = str_replace("<BR>", " ", $products_description);
         $products_description = str_replace("<br>", " ", $products_description);
         $products_description = str_replace("<br />", " ", $products_description);
         $products_description = str_replace("\r", " ", $products_description);
         $products_description = strip_tags($products_description);
         $products_description = str_replace('|', ' ', $products_description);
         $products_description = substr($products_description, 0, 1000) . " ... ";
         //-- SNAKELAB ----//
         require_once DIR_FS_INC . 'xtc_href_link_from_admin.inc.php';
         $link = xtc_href_link_from_admin('product_info.php', 'products_id=' . $products['products_id']);
         preg_match("/\\?/", $link) ? $link .= '&' : ($link .= '?');
         $link .= 'referer=' . $this->code;
         !empty($_POST['campaign']) ? $link .= '&' . $_POST['campaign'] : false;
         //-- SNAKELAB ----//
         //create content
         $schema .= $products['products_model'] . '|' . $products['products_name'] . '|' . $products_description . '|' . number_format($products_price, 2, '.', '') . '|' . $link . '|' . HTTP_CATALOG_SERVER . DIR_WS_CATALOG_THUMBNAIL_IMAGES . $products['products_image'] . "\n";
     }
     // create File
     $fp = fopen(DIR_FS_DOCUMENT_ROOT . 'export/' . $file, "w+");
     fputs($fp, $schema);
     fclose($fp);
     switch ($_POST['export']) {
         case 'yes':
             // send File to Browser
             $extension = substr($file, -3);
             $fp = fopen(DIR_FS_DOCUMENT_ROOT . 'export/' . $file, "rb");
             $buffer = fread($fp, filesize(DIR_FS_DOCUMENT_ROOT . 'export/' . $file));
             fclose($fp);
             header('Content-type: application/x-octet-stream');
             header('Content-disposition: attachment; filename=' . $file);
             echo $buffer;
             exit;
             break;
     }
 }
 function process($file)
 {
     @xtc_set_time_limit(0);
     require DIR_FS_CATALOG . DIR_WS_CLASSES . 'xtcPrice.php';
     $xtPrice = new xtcPrice($_POST['currencies'], $_POST['status']);
     $schema = 'Bezeichnung;Artikelnr;Preis;Beschreibung;Produktlink;FotoLink;Kategorie' . "\n";
     $export_query = xtc_db_query("SELECT\n                             p.products_id,\n                             pd.products_name,\n                             pd.products_description,\n                             p.products_model,\n                             p.products_shippingtime,\n                             p.products_image,\n                             p.products_price,\n                             p.products_status,\n                             p.products_discount_allowed,\n                             p.products_tax_class_id,\n                             IF(s.status, s.specials_new_products_price, NULL) AS specials_new_products_price,\n                             p.products_date_added,\n                             m.manufacturers_name\n                         FROM\n                             " . TABLE_PRODUCTS . " p LEFT JOIN\n                             " . TABLE_MANUFACTURERS . " m\n                           ON p.manufacturers_id = m.manufacturers_id LEFT JOIN\n                             " . TABLE_PRODUCTS_DESCRIPTION . " pd\n                           ON p.products_id = pd.products_id AND\n                            pd.language_id = '" . $_SESSION['languages_id'] . "' LEFT JOIN\n                             " . TABLE_SPECIALS . " s\n                           ON p.products_id = s.products_id\n                         WHERE\n                           p.products_status = 1\n                         ORDER BY\n                            p.products_date_added DESC,\n                            pd.products_name");
     while ($products = xtc_db_fetch_array($export_query)) {
         $products_price = $xtPrice->xtcGetPrice($products['products_id'], $format = false, 1, $products['products_tax_class_id'], '');
         // remove trash
         $products_description = strip_tags($products['products_description']);
         $products_description = substr($products_description, 0, 197) . '..';
         $products_description = str_replace(";", ", ", $products_description);
         $products_description = str_replace("'", ", ", $products_description);
         $products_description = str_replace("\n", " ", $products_description);
         $products_description = str_replace("\r", " ", $products_description);
         $products_description = str_replace("\t", " ", $products_description);
         $products_description = str_replace("\v", " ", $products_description);
         $products_description = str_replace("&quot,", " \"", $products_description);
         $products_description = str_replace("&qout,", " \"", $products_description);
         //create content
         $schema .= $products['products_name'] . ';' . $products['products_model'] . ';' . number_format($products_price, 2, '.', '') . ';' . $products_description . ';' . HTTP_CATALOG_SERVER . DIR_WS_CATALOG . 'product_info.php?' . $_POST['campaign'] . xtc_product_link($products['products_id'], $products['products_name']) . ';' . HTTP_CATALOG_SERVER . DIR_WS_CATALOG_THUMBNAIL_IMAGES . $products['products_image'] . ';' . $products['manufacturers_name'] . "\n";
     }
     // create File
     $fp = fopen(DIR_FS_DOCUMENT_ROOT . 'export/' . $file, "w+");
     fputs($fp, $schema);
     fclose($fp);
     switch ($_POST['export']) {
         case 'yes':
             // send File to Browser
             $extension = substr($file, -3);
             $fp = fopen(DIR_FS_DOCUMENT_ROOT . 'export/' . $file, "rb");
             $buffer = fread($fp, filesize(DIR_FS_DOCUMENT_ROOT . 'export/' . $file));
             fclose($fp);
             header('Content-type: application/x-octet-stream');
             header('Content-disposition: attachment; filename=' . $file);
             echo $buffer;
             exit;
             break;
     }
 }
 function process($file)
 {
     // include needed functions
     include 'includes/classes/' . FILENAME_IMAGEMANIPULATOR;
     @xtc_set_time_limit(0);
     // action
     // get images in original_images folder
     $files = array();
     if ($dir = opendir(DIR_FS_CATALOG_IMAGES . 'categories_org/')) {
         while ($file = readdir($dir)) {
             if (is_file(DIR_FS_CATALOG_IMAGES . 'categories_org/' . $file) and $file != "index.html" and strtolower($file) != "thumbs.db") {
                 $files[] = array('id' => $file, 'text' => $file);
             }
         }
         closedir($dir);
     }
     for ($i = 0; $n = sizeof($files), $i < $n; $i++) {
         $categories_image_name = $files[$i]['text'];
         if ($files[$i]['text'] != 'Thumbs.db' && $files[$i]['text'] != 'Index.html') {
             require DIR_WS_INCLUDES . 'category_image.php';
         }
     }
 }
예제 #7
0
 function process($file)
 {
     @xtc_set_time_limit(0);
     require DIR_FS_CATALOG . DIR_WS_CLASSES . 'xtcPrice.php';
     $xtPrice = new xtcPrice($_POST['currencies'], $_POST['status']);
     $schema = 'ProduktID|Gewicht|EAN|Hersteller|ProduktBezeichnung|ArtikelNroderHerstellerArtikelNr|Preis|ProduktLangBeschreibung|ProduktKurzBeschreibung|Lieferzeit|Produktlink|FotoLink|Kategoriename' . "\n";
     $export_query = xtc_db_query("SELECT\n                             p.products_id,\n                             pd.products_name,\n                             pd.products_description,\n                             pd.products_short_description,\n                             p.products_weight,\n                             p.products_ean,\n                             p.products_model,\n                             p.products_shippingtime,\n                             p.products_image,\n                             p.products_price,\n                             p.products_status,\n                             p.products_discount_allowed,\n                             p.products_tax_class_id,\n                             IF(s.status, s.specials_new_products_price, NULL) AS specials_new_products_price,\n                             p.products_date_added,\n                             m.manufacturers_name\n                         FROM\n                             " . TABLE_PRODUCTS . " p LEFT JOIN\n                             " . TABLE_MANUFACTURERS . " m\n                           ON p.manufacturers_id = m.manufacturers_id LEFT JOIN\n                             " . TABLE_PRODUCTS_DESCRIPTION . " pd\n                           ON p.products_id = pd.products_id AND\n                            pd.language_id = '" . $_SESSION['languages_id'] . "' LEFT JOIN\n                             " . TABLE_SPECIALS . " s\n                           ON p.products_id = s.products_id\n                         WHERE\n                           p.products_status = 1\n                         ORDER BY\n                            p.products_date_added DESC,\n                            pd.products_name");
     while ($products = xtc_db_fetch_array($export_query)) {
         $products_price = $xtPrice->xtcGetPrice($products['products_id'], $format = false, 1, $products['products_tax_class_id'], '');
         // get product categorie
         $categorie_query = xtc_db_query("SELECT\n                                            categories_id\n                                            FROM " . TABLE_PRODUCTS_TO_CATEGORIES . "\n                                            WHERE products_id='" . $products['products_id'] . "'");
         while ($categorie_data = xtc_db_fetch_array($categorie_query)) {
             $categories = $categorie_data['categories_id'];
         }
         // remove trash in $products_description
         $products_description = strip_tags($products['products_description']);
         $products_description = str_replace(";", ", ", $products_description);
         $products_description = str_replace("'", ", ", $products_description);
         $products_description = str_replace("\n", " ", $products_description);
         $products_description = str_replace("\r", " ", $products_description);
         $products_description = str_replace("\t", " ", $products_description);
         $products_description = str_replace("\v", " ", $products_description);
         $products_description = str_replace("&quot,", " \"", $products_description);
         $products_description = str_replace("&qout,", " \"", $products_description);
         $products_description = str_replace("|", ",", $products_description);
         $products_description = substr($products_description, 0, 253);
         // remove trash in $products_short_description
         $products_short_description = strip_tags($products['products_short_description']);
         $products_short_description = str_replace(";", ", ", $products_short_description);
         $products_short_description = str_replace("'", ", ", $products_short_description);
         $products_short_description = str_replace("\n", " ", $products_short_description);
         $products_short_description = str_replace("\r", " ", $products_short_description);
         $products_short_description = str_replace("\t", " ", $products_short_description);
         $products_short_description = str_replace("\v", " ", $products_short_description);
         $products_short_description = str_replace("&quot,", " \"", $products_short_description);
         $products_short_description = str_replace("&qout,", " \"", $products_short_description);
         $products_short_description = str_replace("|", ",", $products_short_description);
         $products_short_description = substr($products_short_description, 0, 253);
         $cat = $this->buildCAT($categories);
         // creates pathes of images, if images are integrated
         if ($products['products_image'] != '') {
             $image_if_available = HTTP_CATALOG_SERVER . DIR_WS_CATALOG_ORIGINAL_IMAGES . $products['products_image'];
         } else {
             $image_if_available = '';
         }
         //create content
         $schema .= $products['products_id'] . '|' . $products['products_weight'] . '|' . $products['products_ean'] . '|' . $products['manufacturers_name'] . '|' . $products['products_name'] . '|' . $products['products_model'] . '|' . number_format($products_price, 2, ',', '.') . '|' . $products_description . '|' . $products_short_description . '|' . xtc_get_shipping_status_name($products['products_shippingtime']) . '|' . HTTP_CATALOG_SERVER . DIR_WS_CATALOG . 'product_info.php?' . $_POST['campaign'] . xtc_product_link($products['products_id'], $products['products_name']) . '|' . $image_if_available . '|' . substr($cat, 0, strlen($cat) - 2) . "\n";
     }
     // create File
     $fp = fopen(DIR_FS_DOCUMENT_ROOT . 'export/' . $file, "w+");
     fputs($fp, $schema);
     fclose($fp);
     switch ($_POST['export']) {
         case 'yes':
             // send File to Browser
             $extension = substr($file, -3);
             $fp = fopen(DIR_FS_DOCUMENT_ROOT . 'export/' . $file, "rb");
             $buffer = fread($fp, filesize(DIR_FS_DOCUMENT_ROOT . 'export/' . $file));
             fclose($fp);
             header('Content-type: application/x-octet-stream');
             header('Content-disposition: attachment; filename=' . $file);
             echo $buffer;
             exit;
             break;
     }
 }
예제 #8
0
 function process($file)
 {
     @xtc_set_time_limit(0);
     require DIR_FS_CATALOG . DIR_WS_CLASSES . 'xtcPrice.php';
     $xtPrice = new xtcPrice($_POST['currencies'], $_POST['status']);
     $schema = '<?xml version="1.0" encoding="' . CHARSET . '"?>' . "\n" . '<doc>' . "\n";
     $export_query = xtc_db_query("SELECT\n                             p.products_id,\n                             pd.products_name,\n                             pd.products_description,\n                             p.products_model,\n                             p.products_image,\n                             p.products_price,\n                             p.products_status,\n                             p.products_quantity,\n                             p.products_shippingtime,\n                             p.products_discount_allowed,\n                             p.products_tax_class_id,\n                             p.products_date_added,\n                             m.manufacturers_name\n                         FROM\n                             " . TABLE_PRODUCTS . " p LEFT JOIN\n                             " . TABLE_MANUFACTURERS . " m\n                           ON p.manufacturers_id = m.manufacturers_id LEFT JOIN\n                             " . TABLE_PRODUCTS_DESCRIPTION . " pd\n                           ON p.products_id = pd.products_id AND\n                            pd.language_id = '" . $_SESSION['languages_id'] . "' LEFT JOIN\n                             " . TABLE_SPECIALS . " s\n                           ON p.products_id = s.products_id\n                         WHERE\n                           p.products_status = 1\n                         ORDER BY\n                            p.products_date_added DESC,\n                            pd.products_name");
     while ($products = xtc_db_fetch_array($export_query)) {
         $products_price = $xtPrice->xtcGetPrice($products['products_id'], $format = false, 1, $products['products_tax_class_id'], '');
         // remove trash
         $products_description = strip_tags($products['products_description']);
         $products_description = substr($products_description, 0, 197) . '..';
         $products_description = str_replace(";", ", ", $products_description);
         $products_description = str_replace("'", ", ", $products_description);
         $products_description = str_replace("\n", " ", $products_description);
         $products_description = str_replace("\r", " ", $products_description);
         $products_description = str_replace("\t", " ", $products_description);
         $products_description = str_replace("\v", " ", $products_description);
         $products_description = str_replace("&quot,", " \"", $products_description);
         $products_description = str_replace("&qout,", " \"", $products_description);
         // get product categorie
         $categorie_query = xtc_db_query("SELECT\n                                            categories_id\n                                            FROM " . TABLE_PRODUCTS_TO_CATEGORIES . "\n                                            WHERE products_id='" . $products['products_id'] . "'");
         while ($categorie_data = xtc_db_fetch_array($categorie_query)) {
             $categories = $categorie_data['categories_id'];
         }
         $categorie_query = xtc_db_query("SELECT\n                                            categories_name\n                                            FROM " . TABLE_CATEGORIES_DESCRIPTION . "\n                                            WHERE categories_id='" . $categories . "'\n                                            and language_id='" . $_SESSION['languages_id'] . "'");
         $categorie_data = xtc_db_fetch_array($categorie_query);
         $tax_rate = xtc_get_tax_rate($products['products_tax_class_id']);
         //create content
         $schema .= '<product>' . "\n";
         $schema .= '<group>' . $categorie_data['categories_name'] . '</group>' . "\n";
         $schema .= '<pid>' . $products['products_model'] . '</pid>' . "\n";
         $schema .= '<name>' . $products['products_name'] . '</name>' . "\n";
         $schema .= '<manufacturer>' . $products['manufacturers_name'] . '</manufacturer>' . "\n";
         $schema .= '<description>' . $products_description . '</description>' . "\n";
         $schema .= '<ean></ean>' . "\n";
         $schema .= '<prices>' . "\n";
         $schema .= '<price>' . "\n";
         $schema .= '<currency>' . $_POST['currencies'] . '</currency>' . "\n";
         $schema .= '<extax>' . number_format($products_price / ($tax_rate + 100) * 100, 2, '.', '') . '</extax>' . "\n";
         $schema .= '<inctax>' . number_format($products_price, 2, '.', '') . '</inctax>' . "\n";
         $schema .= '</price>' . "\n";
         $schema .= '</prices>' . "\n";
         $schema .= '<availability>' . $products['products_quantity'] . '</availability>' . "\n";
         $schema .= '<url>' . HTTP_CATALOG_SERVER . DIR_WS_CATALOG . 'product_info.php?' . $_POST['campaign'] . xtc_product_link($products['products_id'], $products['products_name']) . '</url>' . "\n";
         $schema .= '</product>' . "\n";
     }
     $schema .= '</doc>' . "\n";
     // create File
     $fp = fopen(DIR_FS_DOCUMENT_ROOT . 'export/' . $file, "w+");
     fputs($fp, $schema);
     fclose($fp);
     switch ($_POST['export']) {
         case 'yes':
             // send File to Browser
             $extension = substr($file, -3);
             $fp = fopen(DIR_FS_DOCUMENT_ROOT . 'export/' . $file, "rb");
             $buffer = fread($fp, filesize(DIR_FS_DOCUMENT_ROOT . 'export/' . $file));
             fclose($fp);
             header('Content-type: application/x-octet-stream');
             header('Content-disposition: attachment; filename=' . $file);
             echo $buffer;
             exit;
             break;
     }
 }
예제 #9
0
    public function process($file)
    {
        if ($this->saveSetting()) {
            @xtc_set_time_limit(0);
            $export_query = xtc_db_query(" SELECT count(*) FROM " . TABLE_PRODUCTS . ";");
            $articleCount = xtc_db_fetch_array($export_query);
            $articleCount = $articleCount['count(*)'];
            $tools = new idealo_csv_tools();
            $tools->AllNeeded();
            $schema = $tools->createHeader();
            $tools->createFile($schema);
            $begin = 0;
            $step = 10;
            do {
                $schema = $tools->exportArticle($begin, $step);
                $tools->openCSVFile($schema);
                $begin += $step;
            } while ($begin < $articleCount + $step);
            if ($tools->separatorWarning) {
                $separatorInt = false;
                foreach ($tools->separatorArray as $separ) {
                    if ($separ['comes'] == 0) {
                        $separatorInt = true;
                    }
                }
                $javaSK = '<script type="text/javascript">
						alert("Der eingestellte Spaltentrenner \\"' . IDEALO_CSV_SEPARATOR . '\\" kommt in Ihren Texten ' . $tools->separatorInt . ' mal vor!\\n\\n' . '\\Dies kann zur Spaltenverschiebungen in Ihrer Datei fuehren\\n\\n' . '\\Alternativ sollten Sie einen der folgenden Spaltentrenner verwenden:\\n\\n';
                if (!$separatorInt) {
                    $javaSK .= '\\Leider kann Ihnen das Modul keinen Vorschlag machen. Wenden Sie sich bitte an csv@idealo.de';
                } else {
                    foreach ($tools->separatorArray as $separ) {
                        if ($separ['comes'] == 0) {
                            $javaSK .= '\\ ' . $separ['separator'] . '\\n';
                        }
                    }
                }
                $javaSK .= '\\ ");</script>';
                echo $javaSK;
            }
            $this->backToBackend(substr($_SERVER['PHP_SELF'], 0, -24));
        } else {
            die;
        }
    }
require 'includes/application_top.php';
require DIR_WS_CLASSES . 'currencies.php';
$currencies = new currencies();
require_once DIR_FS_CATALOG . DIR_WS_CLASSES . 'class.phpmailer.php';
require_once DIR_FS_INC . 'xtc_php_mail.inc.php';
$payments_statuses = array();
$payments_status_array = array();
$payments_status_query = xtc_db_query("select affiliate_payment_status_id, affiliate_payment_status_name from " . TABLE_AFFILIATE_PAYMENT_STATUS . " where affiliate_language_id = '" . $_SESSION['languages_id'] . "'");
while ($payments_status = xtc_db_fetch_array($payments_status_query)) {
    $payments_statuses[] = array('id' => $payments_status['affiliate_payment_status_id'], 'text' => $payments_status['affiliate_payment_status_name']);
    $payments_status_array[$payments_status['affiliate_payment_status_id']] = $payments_status['affiliate_payment_status_name'];
}
switch ($_GET['action']) {
    case 'start_billing':
        // Billing can be a lengthy process
        xtc_set_time_limit(0);
        // We are only billing orders which are AFFILIATE_BILLING_TIME days old
        $time = mktime(1, 1, 1, date("m"), date("d") - AFFILIATE_BILLING_TIME, date("Y"));
        $oldday = date("Y-m-d", $time);
        // Select all affiliates who earned enough money since last payment
        $sql = "\n        SELECT a.affiliate_id, sum(a.affiliate_payment) \n          FROM " . TABLE_AFFILIATE_SALES . " a, " . TABLE_ORDERS . " o \n          WHERE a.affiliate_billing_status != 1 and a.affiliate_orders_id = o.orders_id and o.orders_status >= " . AFFILIATE_PAYMENT_ORDER_MIN_STATUS . " and a.affiliate_date <= '" . $oldday . "' \n          GROUP by a.affiliate_id \n          having sum(a.affiliate_payment) >= '" . AFFILIATE_THRESHOLD . "'\n        ";
        $affiliate_payment_query = xtc_db_query($sql);
        // Start Billing:
        while ($affiliate_payment = xtc_db_fetch_array($affiliate_payment_query)) {
            // mysql does not support joins in update (planned in 4.x)
            // Get all orders which are AFFILIATE_BILLING_TIME days old
            $sql = "\n        SELECT a.affiliate_orders_id \n          FROM " . TABLE_AFFILIATE_SALES . " a, " . TABLE_ORDERS . " o \n          WHERE a.affiliate_billing_status!=1 and a.affiliate_orders_id=o.orders_id and o.orders_status>=" . AFFILIATE_PAYMENT_ORDER_MIN_STATUS . " and a.affiliate_id='" . $affiliate_payment['affiliate_id'] . "' and a.affiliate_date <= '" . $oldday . "'\n        ";
            $affiliate_orders_query = xtc_db_query($sql);
            $orders_id = "(";
            while ($affiliate_orders = xtc_db_fetch_array($affiliate_orders_query)) {
                $orders_id .= $affiliate_orders['affiliate_orders_id'] . ",";
 function process($file, $offset)
 {
     global $limit, $selbstaufruf, $infotext, $count;
     include 'includes/classes/' . FILENAME_IMAGEMANIPULATOR;
     $ext_array = array('gif', 'jpg', 'jpeg', 'png');
     //Gültige Dateiendungen
     @xtc_set_time_limit(0);
     $files = array();
     if ($dir = opendir(DIR_FS_CATALOG_ORIGINAL_IMAGES)) {
         while ($file = readdir($dir)) {
             $tmp = explode('.', $file);
             if (is_array($tmp)) {
                 $ext = strtolower($tmp[count($tmp) - 1]);
                 if (is_file(DIR_FS_CATALOG_ORIGINAL_IMAGES . $file) && in_array($ext, $ext_array)) {
                     $files[] = array('id' => $file, 'text' => $file);
                 }
             }
         }
         closedir($dir);
     }
     $max_files = sizeof($files);
     $step = $_GET['max'];
     $count = $_GET['count'];
     $limit = $offset + $step;
     for ($i = $offset; $i < $limit; $i++) {
         if ($i >= $max_files) {
             // FERTIG
             $infotext = urlencode(strip_tags(IMAGE_STEP_INFO) . $count . strip_tags(IMAGE_STEP_INFO_READY));
             xtc_redirect(xtc_href_link(FILENAME_MODULE_EXPORT, 'set=' . $_GET['set'] . '&module=' . $this->code . '&infotext=' . $infotext . '&max=' . $_GET['max']));
             //FERTIG
         }
         $products_image_name = $files[$i]['text'];
         if ($_GET['miss'] == 1) {
             $flag = false;
             if (!is_file(DIR_FS_CATALOG_THUMBNAIL_IMAGES . $files[$i]['text'])) {
                 require DIR_WS_INCLUDES . 'product_thumbnail_images.php';
                 $flag = true;
             }
             if (!is_file(DIR_FS_CATALOG_INFO_IMAGES . $files[$i]['text'])) {
                 require DIR_WS_INCLUDES . 'product_info_images.php';
                 $flag = true;
             }
             if (!is_file(DIR_FS_CATALOG_POPUP_IMAGES . $files[$i]['text'])) {
                 require DIR_WS_INCLUDES . 'product_popup_images.php';
                 $flag = true;
             }
             if ($flag) {
                 $count += 1;
             }
         } else {
             require DIR_WS_INCLUDES . 'product_thumbnail_images.php';
             require DIR_WS_INCLUDES . 'product_info_images.php';
             require DIR_WS_INCLUDES . 'product_popup_images.php';
             $count += 1;
         }
     }
     //xtc_redirect(xtc_href_link(FILENAME_MODULE_EXPORT, 'set=' . $_GET['set'] . '&action=save&module=image_processing_new_step&start=' . $limit));
     //Animierte Gif-Datei und Hinweistext
     $info_wait = '<img src="images/loading.gif"> ';
     $infotext = '<div style="margin:10px; font-family:Verdana; font-size:15px; text-align:center;">' . $info_wait . IMAGE_STEP_INFO . $count . '</div>';
     $selbstaufruf = '<script language="javascript" type="text/javascript">setTimeout("document.modul_continue.submit()", 3000);</script>';
 }
예제 #12
0
 function process($file)
 {
     @xtc_set_time_limit(0);
     require DIR_FS_CATALOG . DIR_WS_CLASSES . 'xtcPrice.php';
     $xtPrice = new xtcPrice($_POST['currencies'], $_POST['status']);
     $schema = '#country=de' . "\n" . '#type=basic' . "\n" . '#currency=' . $_POST['currencies'] . "\n";
     $schema .= 'url' . "\t" . 'title' . "\t" . 'description' . "\t" . 'price' . "\t" . 'offerid' . "\t" . 'category' . "\t" . 'image' . "\t" . 'availability' . "\t" . 'deliverycost' . "\n";
     $export_query = xtc_db_query("SELECT\n                             p.products_id,\n                             pd.products_name,\n                             pd.products_description,\n                             p.products_model,\n                             p.products_shippingtime,\n                             p.products_image,\n                             p.products_price,\n                             p.products_status,\n                             p.products_discount_allowed,\n                             p.products_tax_class_id,\n                             p.products_date_added,\n                             m.manufacturers_name\n                         FROM\n                             " . TABLE_PRODUCTS . " p LEFT JOIN\n                             " . TABLE_MANUFACTURERS . " m\n                           ON p.manufacturers_id = m.manufacturers_id LEFT JOIN\n                             " . TABLE_PRODUCTS_DESCRIPTION . " pd\n                           ON p.products_id = pd.products_id AND\n                            pd.language_id = '" . $_SESSION['languages_id'] . "' LEFT JOIN\n                             " . TABLE_SPECIALS . " s\n                           ON p.products_id = s.products_id\n                         WHERE\n                           p.products_status = 1\n                         ORDER BY\n                            p.products_date_added DESC,\n                            pd.products_name");
     while ($products = xtc_db_fetch_array($export_query)) {
         $products_price = $xtPrice->xtcGetPrice($products['products_id'], $format = false, 1, $products['products_tax_class_id'], '');
         // remove trash
         $products_description = strip_tags($products['products_description']);
         $products_description = str_replace(";", ", ", $products_description);
         $products_description = str_replace("'", ", ", $products_description);
         $products_description = str_replace("\n", " ", $products_description);
         $products_description = str_replace("\r", " ", $products_description);
         $products_description = str_replace("\t", " ", $products_description);
         $products_description = str_replace("\v", " ", $products_description);
         $products_description = str_replace("&quot,", " \"", $products_description);
         $products_description = str_replace("&qout,", " \"", $products_description);
         $length = 160;
         if ($_POST['account'] != 'normal') {
             $length = 400;
         }
         $products_description = substr($products_description, 0, $length - 4) . '...';
         // get product categorie
         $categorie_query = xtc_db_query("SELECT\n                                            categories_id\n                                            FROM " . TABLE_PRODUCTS_TO_CATEGORIES . "\n                                            WHERE products_id='" . $products['products_id'] . "'");
         while ($categorie_data = xtc_db_fetch_array($categorie_query)) {
             $categories = $categorie_data['categories_id'];
         }
         $categorie_query = xtc_db_query("SELECT\n                                            categories_name\n                                            FROM " . TABLE_CATEGORIES_DESCRIPTION . "\n                                            WHERE categories_id='" . $categories . "'\n                                            and language_id='" . $_SESSION['languages_id'] . "'");
         $categorie_data = xtc_db_fetch_array($categorie_query);
         //create content
         //create content
         if ($products['products_image'] == '') {
             $kelkoo_image = "";
         } else {
             $kelkoo_image = HTTP_CATALOG_SERVER . DIR_WS_CATALOG_THUMBNAIL_IMAGES . $products['products_image'];
         }
         //-- SNAKELAB ----//
         require_once DIR_FS_INC . 'xtc_href_link_from_admin.inc.php';
         $link = xtc_href_link_from_admin('product_info.php', 'products_id=' . $products['products_id']);
         preg_match("/\\?/", $link) ? $link .= '&' : ($link .= '?');
         $link .= 'referer=' . $this->code;
         !empty($_POST['campaign']) ? $link .= '&' . $_POST['campaign'] : false;
         //-- SNAKELAB ----//
         $schema .= $link . "\t" . $products['products_name'] . "\t" . $products_description . "\t" . number_format($products_price, 2, '.', '') . "\t" . $products['products_id'] . "\t" . $categorie_data['categories_name'] . "\t" . $kelkoo_image . "\t" . '001' . "\t" . 'EUR 4,00' . "\n";
     }
     // create File
     $fp = fopen(DIR_FS_DOCUMENT_ROOT . 'export/' . $file, "w+");
     fputs($fp, $schema);
     fclose($fp);
     switch ($_POST['export']) {
         case 'yes':
             // send File to Browser
             $extension = substr($file, -3);
             $fp = fopen(DIR_FS_DOCUMENT_ROOT . 'export/' . $file, "rb");
             $buffer = fread($fp, filesize(DIR_FS_DOCUMENT_ROOT . 'export/' . $file));
             fclose($fp);
             header('Content-type: application/x-octet-stream');
             header('Content-disposition: attachment; filename=' . $file);
             echo $buffer;
             exit;
             break;
     }
 }
예제 #13
0
 public function process($file)
 {
     if (isset($_POST['sendIdealoMail'])) {
         $this->sendMail();
     }
     $tools = new tools();
     $this->login = $tools->getLogin();
     $communication = new Communication($this->login);
     if ($this->saveSetting()) {
         @xtc_set_time_limit(0);
         $tools->cleanTableIdealoRealtimeUpdate();
         $tools->cleanTableIdealoRealtimeFailedRequest();
         $tools->cleanTestFile();
         $tools->AllNeeded();
         $this->login = $tools->getLogin();
         $xml = '';
         try {
             if ($this->login['testmode'] != '1') {
                 if (isset($_POST['hardReset'])) {
                     if ($_POST['hardReset'] == 'on') {
                         $communication->deleteAllFromIdealo();
                     } else {
                         $this->cleanIdealo();
                     }
                 } else {
                     $this->cleanIdealo();
                 }
             }
         } catch (Exception $e) {
         }
         if ($this->login['status'] == 'True') {
             $xml = '';
             $tools->newTimestamp();
             $communication = new Communication($this->login);
             $artikel_start = 0;
             $article_count = xtc_db_query("SELECT count(*) FROM `products`;");
             $article_count = xtc_db_fetch_array($article_count);
             $article_count = $article_count['count(*)'];
             $repetition = 0;
             if ($article_count > 0) {
                 if ($article_count <= $this->login['pagesize']) {
                     $repetition = 1;
                 } else {
                     $repetition = ceil($article_count / $this->login['pagesize']);
                 }
             }
             for ($i = 1; $i <= $repetition; $i++) {
                 $artikel = $this->getArtikelID($artikel_start, $this->login['pagesize']);
                 $xml = $tools->getXMLBegin($this->login['testmode']);
                 foreach ($artikel as $art) {
                     $xml .= $tools->getXML($art);
                 }
                 $xml .= $tools->getXMLEnd();
                 if (strpos($xml, '<offer>') !== false) {
                     @$communication->sendRequest($xml);
                 }
                 $artikel_start = $artikel_start + $this->login['pagesize'];
             }
             if ($this->login['testmode'] == '1') {
                 $this->backToBackend(substr($_SERVER['PHP_SELF'], 0, -24));
                 die;
             }
         }
     } else {
         $this->backToBackendFailed();
         die;
     }
 }
 function process($file)
 {
     global $UseGoogle;
     @xtc_set_time_limit(0);
     require DIR_FS_CATALOG . DIR_WS_CLASSES . 'xtcPrice.php';
     $xtPrice = new xtcPrice("EUR", 1);
     $UseGoogle ? $psmgoogle_link = "utm_source=preissuchmaschine&utm_medium=cpc&utm_campaign=preissuchmaschine&" : ($psmgoogle_link = "");
     $schema = 'ProduktID|Gewicht|EAN|Lagerbestand|Hersteller|ProduktBezeichnung|ArtikelNroderHerstellerArtikelNr|Preis|ProduktLangBeschreibung|ProduktKurzBeschreibung|Lieferzeit|Produktlink|FotoLink|Kategoriename|';
     // run through the payment method titles to display them in the header
     foreach ($this->payment as $payment => $options) {
         // display only the payment methods that are active (if this is desired)
         $schema .= $options['title'] . "|";
     }
     $schema .= "\n";
     $export_query = xtc_db_query("SELECT\r\n                             p.products_id,\r\n                             pd.products_name,\r\n                             pd.products_description,\r\n                             pd.products_short_description,\r\n                             p.products_weight,\r\n                             p.products_ean,\r\n                             p.products_quantity,\r\n                             p.products_model,\r\n                             p.products_shippingtime,\r\n                             p.products_image,\r\n                             p.products_price,\r\n                             p.products_status,\r\n                             p.products_discount_allowed,\r\n                             p.products_tax_class_id,\r\n                             IF(s.status, s.specials_new_products_price, NULL) AS specials_new_products_price,\r\n                             p.products_date_added,\r\n                             m.manufacturers_name\r\n                         FROM\r\n                             " . TABLE_PRODUCTS . " p LEFT JOIN\r\n                             " . TABLE_MANUFACTURERS . " m\r\n                           ON p.manufacturers_id = m.manufacturers_id LEFT JOIN\r\n                             " . TABLE_PRODUCTS_DESCRIPTION . " pd\r\n                           ON p.products_id = pd.products_id AND\r\n                            pd.language_id = '" . $_SESSION['languages_id'] . "' LEFT JOIN\r\n                             " . TABLE_SPECIALS . " s\r\n                           ON p.products_id = s.products_id\r\n                         WHERE\r\n                           p.products_status = 1\r\n                         ORDER BY\r\n                            p.products_date_added DESC,\r\n                            pd.products_name");
     while ($products = xtc_db_fetch_array($export_query)) {
         $products_price = $xtPrice->xtcGetPrice($products['products_id'], $format = false, 1, $products['products_tax_class_id'], '');
         // get product categorie
         $categorie_query = xtc_db_query("SELECT\r\n                                            categories_id\r\n                                            FROM " . TABLE_PRODUCTS_TO_CATEGORIES . "\r\n                                            WHERE products_id='" . $products['products_id'] . "'");
         while ($categorie_data = xtc_db_fetch_array($categorie_query)) {
             $categories = $categorie_data['categories_id'];
         }
         // remove trash in $products_description
         $products_description = strip_tags($products['products_description']);
         $products_description = str_replace(";", ", ", $products_description);
         $products_description = str_replace("'", ", ", $products_description);
         $products_description = str_replace("\n", " ", $products_description);
         $products_description = str_replace("\r", " ", $products_description);
         $products_description = str_replace("\t", " ", $products_description);
         $products_description = str_replace("\v", " ", $products_description);
         $products_description = str_replace("&quot,", " \"", $products_description);
         $products_description = str_replace("&qout,", " \"", $products_description);
         $products_description = str_replace("|", ",", $products_description);
         $products_description = substr($products_description, 0, 253);
         // remove trash in $products_short_description
         $products_short_description = strip_tags($products['products_short_description']);
         $products_short_description = str_replace(";", ", ", $products_short_description);
         $products_short_description = str_replace("'", ", ", $products_short_description);
         $products_short_description = str_replace("\n", " ", $products_short_description);
         $products_short_description = str_replace("\r", " ", $products_short_description);
         $products_short_description = str_replace("\t", " ", $products_short_description);
         $products_short_description = str_replace("\v", " ", $products_short_description);
         $products_short_description = str_replace("&quot,", " \"", $products_short_description);
         $products_short_description = str_replace("&qout,", " \"", $products_short_description);
         $products_short_description = str_replace("|", ",", $products_short_description);
         $products_short_description = substr($products_short_description, 0, 253);
         $cat = $this->buildCAT($categories);
         // creates pathes of images, if images are integrated
         if ($products['products_image'] != '') {
             $image_if_available = HTTP_CATALOG_SERVER . DIR_WS_CATALOG_POPUP_IMAGES . $products['products_image'];
         } else {
             $image_if_available = '';
         }
         //create content
         $schema .= $products['products_id'] . '|' . number_format($products['products_weight'], 2, ',', '.') . '|' . $products['products_ean'] . '|' . $products['products_quantity'] . '|' . $products['manufacturers_name'] . '|' . $products['products_name'] . '|' . $products['products_model'] . '|' . number_format($products_price, 2, ',', '.') . '|' . $products_description . '|' . $products_short_description . '|' . xtc_get_shipping_status_name($products['products_shippingtime']) . '|' . HTTP_CATALOG_SERVER . DIR_WS_CATALOG . 'product_info.php?' . $_POST['campaign'] . $psmgoogle_link . xtc_product_link($products['products_id'], $products['products_name']) . '|' . $image_if_available . '|' . substr($cat, 0, strlen($cat) - 2) . "|";
         foreach ($this->payment as $singlePayment => $options) {
             // display only the payment fee that is active (if this is desired)
             $sc = $this->getShippingCosts($singlePayment, $products_price, $products['products_weight'], $products['products_tax_class_id']);
             $schema .= $sc . "|";
             // if there's one payment with sc > 0.00, display the sc free comment
             // exception: cash on delivery
             if ($singlePayment != 'COD' && $sc > 0.0) {
                 $showScFreeComment = true;
             }
         }
         $schema .= "\n";
     }
     // create File
     $fp = fopen(DIR_FS_DOCUMENT_ROOT . 'export/' . $file, "w+");
     fputs($fp, $schema);
     fclose($fp);
     switch ($_POST['export']) {
         case 'yes':
             // send File to Browser
             $extension = substr($file, -3);
             $fp = fopen(DIR_FS_DOCUMENT_ROOT . 'export/' . $file, "rb");
             $buffer = fread($fp, filesize(DIR_FS_DOCUMENT_ROOT . 'export/' . $file));
             fclose($fp);
             header('Content-type: application/x-octet-stream');
             header('Content-disposition: attachment; filename=' . $file);
             echo $buffer;
             exit;
             break;
     }
 }
예제 #15
0
 function process($file)
 {
     @xtc_set_time_limit(0);
     $file = $_POST['configuration']['MODULE_BILLIGER_FILE'];
     #$config_query = xtc_db_query("UPDATE " . TABLE_CONFIGURATION . " SET configuration_value = ".$_POST['configuration']['MODULE_BILLIGER_SHIPPING_COST']." WHERE configuration_key = 'MODULE_BILLIGER_SHIPPING_METHOD'");
     require DIR_FS_CATALOG . DIR_WS_CLASSES . 'xtcPrice.php';
     $xtPrice = new xtcPrice($_POST['currencies'], $_POST['status']);
     // query
     //BOF - DokuMan - 2011-06-24 - fix sql query (thx to franky_n)
     /*
             $export_query = xtc_db_query("SELECT
                      p.products_id,
                      p.products_model,
                      p.products_ean,
                      p.products_image,
                      p.products_price,
                      p.products_status,
                      p.products_date_available,
                      p.products_shippingtime,
                      p.products_discount_allowed,
                      p.products_tax_class_id,
                      p.products_date_added,
                      p.products_weight,
                      pd.products_name,
                      pd.products_description,
                      pd.products_short_description,
                      pd.products_meta_keywords,
                      m.manufacturers_name,
                      lng.code
                  FROM
                      " . TABLE_PRODUCTS . " p LEFT JOIN
                      " . TABLE_MANUFACTURERS . " m
                    ON p.manufacturers_id = m.manufacturers_id LEFT JOIN
                      " . TABLE_PRODUCTS_DESCRIPTION . " pd
                    ON p.products_id = pd.products_id LEFT JOIN
                      " . TABLE_SPECIALS . " s
                    ON p.products_id = s.products_id LEFT JOIN
                      " . TABLE_LANGUAGES . " as lng
                    ON lng.languages_id = '" . (int) $_POST['languages_id'] . "'
                  WHERE
                    p.products_status = 1 AND
                    lng.languages_id = pd.language_id
                  ORDER BY
                     p.products_date_added DESC,
                     pd.products_name");
     */
     $export_query = xtc_db_query("SELECT\n                     p.products_id,\n                     pd.products_name,\n                     pd.products_description,\n                     pd.products_short_description,\n                     p.products_model,\n                     p.products_ean,\n                     p.products_image,\n                     p.products_price,\n                     p.products_status,\n                     p.products_date_available,\n                     p.products_shippingtime,\n                     p.products_discount_allowed,\n                     pd.products_meta_keywords,\n                     p.products_tax_class_id,\n                     p.products_date_added,\n                     p.products_weight,\n                     m.manufacturers_name\n                 FROM\n                     " . TABLE_PRODUCTS . " p LEFT JOIN\n                     " . TABLE_MANUFACTURERS . " m\n                   ON p.manufacturers_id = m.manufacturers_id LEFT JOIN\n                     " . TABLE_PRODUCTS_DESCRIPTION . " pd\n                   ON p.products_id = pd.products_id AND\n                    pd.language_id = '" . (int) $_SESSION['languages_id'] . "' LEFT JOIN\n                     " . TABLE_SPECIALS . " s\n                   ON p.products_id = s.products_id\n                 WHERE\n                   p.products_status = 1\n                 ORDER BY\n                    p.products_date_added DESC,\n                    pd.products_name");
     //BOF - DokuMan - 2011-06-24 - fix sql query (thx to franky_n)
     // csv schema / headline
     $schema = 'id;hersteller;modell_nr;name;kategorie;beschreibung;bild_klein;bild_gross;link;lieferzeit;lieferkosten;preis;waehrung;aufbauservice;24_Std_service;EAN;ASIN;ISBN;PZN;ISMN;EPC;VIN';
     $schema .= "\n";
     // parse data
     while ($products = xtc_db_fetch_array($export_query)) {
         $id = $products['products_id'];
         $hersteller = $products['manufacturers_name'];
         $modell_nr = '';
         $name = $this->cleanVars($products['products_name']);
         $kategorie = $this->buildCAT($this->getCategoriesID($products['products_id']));
         $beschreibung = substr($this->cleanVars($products['products_short_description']), 0, 255);
         $bild_klein = $products['products_image'] != '' ? HTTP_CATALOG_SERVER . DIR_WS_CATALOG_THUMBNAIL_IMAGES . $products['products_image'] : '';
         $bild_gross = $products['products_image'] != '' ? HTTP_CATALOG_SERVER . DIR_WS_CATALOG_POPUP_IMAGES . $products['products_image'] : '';
         $lang_param = $products['code'] != DEFAULT_LANGUAGE ? '&language=' . $products['code'] : '';
         $link = xtc_catalog_href_link('product_info.php', xtc_product_link($products['products_id'], $products['products_name']) . (!empty($_POST['campaign']) ? '&' . $_POST['campaign'] : ''));
         $lieferzeit = $this->getShippingtimeName($products['products_shippingtime']);
         $lieferkosten = number_format($this->getShippingCost($products['products_price'], $products['products_weight']), 2, ',', '');
         $preis = $xtPrice->xtcGetPrice($products['products_id'], $format = false, 1, $products['products_tax_class_id'], '');
         $waehrung = $_POST['currencies'];
         $aufbauservice = '';
         $x24_Std_service = '';
         $EAN = $products['products_ean'];
         $ASIN = '';
         $ISBN = '';
         $PZN = '';
         $ISMN = '';
         $EPC = '';
         $VIN = '';
         // add line
         $schema .= $id . ";" . $hersteller . ";" . $modell_nr . ";" . $name . ";" . substr($kategorie, 0, strlen($kategorie) - 2) . ";" . $beschreibung . ";" . $bild_klein . ";" . $bild_gross . ";" . $link . ";" . $lieferzeit . ";" . $lieferkosten . ";" . number_format($preis, 2, ',', '') . ";" . $waehrung . ";" . $aufbauservice . ";" . $x24_Std_service . ";" . $EAN . ";" . $ASIN . ";" . $ISBN . ";" . $PZN . ";" . $ISMN . ";" . $EPC . ";" . $VIN . "" . "\n";
     }
     $filename = DIR_FS_DOCUMENT_ROOT . 'export/' . $file;
     if ($_POST['export'] == 'yes') {
         $filename = $filename . '.tmp_' . time();
     }
     // create File
     $fp = fopen($filename, "w+");
     fputs($fp, $schema);
     fclose($fp);
     // send File to Browser
     switch ($_POST['export']) {
         case 'yes':
             header('Content-type: application/x-octet-stream');
             header('Content-disposition: attachment; filename=' . $file);
             readfile($filename);
             unlink($filename);
             exit;
             break;
     }
 }
예제 #16
0
 function process($file)
 {
     @xtc_set_time_limit(0);
     require DIR_FS_CATALOG . DIR_WS_CLASSES . 'xtcPrice.php';
     $xtPrice = new xtcPrice($_POST['currencies'], $_POST['status']);
     $VPE = array();
     $res = xtc_db_query("SELECT products_vpe_id id,products_vpe_name name FROM " . TABLE_PRODUCTS_VPE . " WHERE language_id='" . $_SESSION['languages_id'] . "'");
     while ($vpe = xtc_db_fetch_array($res)) {
         $VPE[$vpe[id]] = $vpe[name];
     }
     $schema = '<?xml version="1.0" encoding="' . CHARSET . '"?>' . "\n<WEINCCEXPORT xmlns=\"http://technik.wein.cc/\" version=\"" . MODULE_WEIN2_TEXT_TITLE . "\" currency=\"" . $_POST['currencies'] . "\" shopversion=\"" . PROJECT_VERSION . "\">\n";
     $export_query = xtc_db_query("SELECT\n                                          p.products_id,\n                                          pd.products_name,\n                                          pd.products_description,\n                                          p.products_model,\n                                          p.products_ean,\n                                          p.products_image,\n                                          p.products_shippingtime,\n                                          p.products_price,\n                                          p.products_status,\n                                          p.products_discount_allowed,\n                                          p.products_tax_class_id,\n                                          p.products_date_added,\n                                          m.manufacturers_name,\n                                          p.products_quantity,\n                                          p.products_last_modified,\n                                          p.products_vpe_status,\n                                          p.products_vpe,\n                                          p.products_vpe_value\n                                    FROM\n                                          " . TABLE_PRODUCTS . " p LEFT JOIN\n                                          " . TABLE_MANUFACTURERS . " m\n                                       ON p.manufacturers_id = m.manufacturers_id LEFT JOIN\n                                          " . TABLE_PRODUCTS_DESCRIPTION . " pd\n                                       ON p.products_id = pd.products_id AND\n                                          pd.language_id = '" . $_SESSION['languages_id'] . "' LEFT JOIN\n                                          " . TABLE_SPECIALS . " s\n                                       ON p.products_id = s.products_id\n                                    WHERE\n                                          p.products_status = 1\n                                 ORDER BY\n                                          p.products_date_added DESC,\n                                          pd.products_name");
     while ($products = xtc_db_fetch_array($export_query)) {
         $products_price = $xtPrice->xtcGetPrice($products['products_id'], $format = false, 1, $products['products_tax_class_id'], '');
         // remove trash
         $products_description = $products['products_description'];
         $products_description = str_replace("\n", " ", $products_description);
         $products_description = str_replace("\r", " ", $products_description);
         $products_description = str_replace("\t", " ", $products_description);
         $products_description = substr($products_description, 0, 65536);
         $categorie_query = xtc_db_query("SELECT\n                                              categories_id\n                                         FROM " . TABLE_PRODUCTS_TO_CATEGORIES . "\n                                        WHERE products_id='" . $products['products_id'] . "'");
         while ($categorie_data = xtc_db_fetch_array($categorie_query)) {
             $categories = $categorie_data['categories_id'];
         }
         $categorie_query = xtc_db_query("SELECT\n                                              categories_name\n                                         FROM " . TABLE_CATEGORIES_DESCRIPTION . "\n                                        WHERE categories_id='" . $categories . "'\n                                          AND language_id='" . $_SESSION['languages_id'] . "'");
         $categorie_data = xtc_db_fetch_array($categorie_query);
         //create content
         if ($products['products_image'] == '') {
             $wein_image = "";
         } else {
             $wein_image = HTTP_CATALOG_SERVER . DIR_WS_CATALOG_ORIGINAL_IMAGES . $products['products_image'];
         }
         $tax = $xtPrice->TAX[$products['products_tax_class_id']];
         if (!$tax) {
             $tax = 19;
         }
         $produkturl = HTTP_CATALOG_SERVER . DIR_WS_CATALOG . 'product_info.php?' . $_POST['campaign'] . xtc_product_link($products['products_id']);
         $schema .= "<PRODUKT>\n" . '<products_id>' . $products['products_id'] . "</products_id>\n" . '<ARTIKELNUMMER>' . $products['products_model'] . "</ARTIKELNUMMER>\n" . '<PREIS>' . number_format($products_price, 2, '.', '') . "</PREIS>\n" . '<PRODUKTNAME>' . $this->xmlescape($products['products_name']) . "</PRODUKTNAME>\n" . '<PRODUZENT>' . $this->xmlescape($products['manufacturers_name']) . "</PRODUZENT>\n" . '<KATEGORIE>' . $this->xmlescape($categorie_data['categories_name']) . "</KATEGORIE>\n" . "<TAX>{$tax}</TAX>\n" . '<EAN>' . $products['products_ean'] . "</EAN>\n" . "<PRODUKTURL>" . $this->xmlescape($produkturl) . "</PRODUKTURL>\n" . "<BILDURL>" . $this->xmlescape($wein_image) . "</BILDURL>\n" . '<BESCHREIBUNG>' . $this->xmlescape($products_description) . "</BESCHREIBUNG>\n" . '<LAGERSTAND>' . $products['products_quantity'] . "</LAGERSTAND>\n" . "<QUANTITY>1</QUANTITY>\n" . '<LASTMODIFIED>' . ($products['products_last_modified'] ? $products['products_last_modified'] : $products['products_date_added']) . "</LASTMODIFIED>\n" . '<DATEADDED>' . $products['products_date_added'] . "</DATEADDED>\n" . '<VPE_NAME>' . $VPE[$products['products_vpe']] . "</VPE_NAME>\n" . '<VPE_STATUS>' . $products['products_vpe_status'] . "</VPE_STATUS>\n" . '<VPE_VALUE>' . $products['products_vpe_value'] . "</VPE_VALUE>\n" . "</PRODUKT>\n";
         $query = "SELECT quantity, personal_offer*(1+{$tax}/100) staffelpreis \n                  FROM " . TABLE_PERSONAL_OFFERS_BY . $_POST['status'] . " \n                    WHERE products_id=" . $products['products_id'] . " AND quantity>1";
         $res = xtc_db_query($query);
         while ($r = xtc_db_fetch_array($res)) {
             $schema .= "<PRODUKT>\n" . '<products_id>' . $products['products_id'] . "</products_id>\n" . '<ARTIKELNUMMER>' . $products['products_model'] . "</ARTIKELNUMMER>\n" . '<PREIS>' . number_format($r[staffelpreis], 2, '.', '') . "</PREIS>\n" . '<PRODUKTNAME>' . $this->xmlescape($products['products_name']) . "</PRODUKTNAME>\n" . '<PRODUZENT>' . $this->xmlescape($products['manufacturers_name']) . "</PRODUZENT>\n" . '<KATEGORIE>' . $this->xmlescape($categorie_data['categories_name']) . "</KATEGORIE>\n" . "<TAX>{$tax}</TAX>\n" . '<EAN>' . $products['products_ean'] . "</EAN>\n" . "<PRODUKTURL>" . $this->xmlescape($produkturl) . "</PRODUKTURL>\n" . "<BILDURL>" . $this->xmlescape($wein_image) . "</BILDURL>\n" . '<BESCHREIBUNG>' . $this->xmlescape($products_description) . "</BESCHREIBUNG>\n" . '<LAGERSTAND>' . $products['products_quantity'] . "</LAGERSTAND>\n" . "<QUANTITY>" . $r[quantity] . "</QUANTITY>\n" . '<LASTMODIFIED>' . ($products['products_last_modified'] ? $products['products_last_modified'] : $products['products_date_added']) . "</LASTMODIFIED>\n" . '<DATEADDED>' . $products['products_date_added'] . "</DATEADDED>\n" . '<VPE_NAME>' . $VPE[$products['products_vpe']] . "</VPE_NAME>\n" . '<VPE_STATUS>' . $products['products_vpe_status'] . "</VPE_STATUS>\n" . '<VPE_VALUE>' . $products['products_vpe_value'] . "</VPE_VALUE>\n" . "</PRODUKT>\n";
         }
     }
     $schema .= "</WEINCCEXPORT>\n";
     // create File
     $fp = fopen(DIR_FS_DOCUMENT_ROOT . 'export/' . $file, "w+");
     fputs($fp, $schema);
     fclose($fp);
     //ping wein.cc
     $exporturl = "http://" . $_SERVER[HTTP_HOST] . array_shift(explode('/admin/', $_SERVER[SCRIPT_NAME], 2)) . "/export/" . $file . "\n";
     file("http://api.wein.cc/updateping.php?exporturl=" . urlencode($exporturl) . "&version=" . urlencode(MODULE_WEIN2_TEXT_TITLE));
     switch ($_POST['export']) {
         case 'yes':
             // send File to Browser
             $extension = substr($file, -3);
             $fp = fopen(DIR_FS_DOCUMENT_ROOT . 'export/' . $file, "rb");
             $buffer = fread($fp, filesize(DIR_FS_DOCUMENT_ROOT . 'export/' . $file));
             fclose($fp);
             header('Content-type: application/x-octet-stream');
             header('Content-disposition: attachment; filename=' . $file);
             echo $buffer;
             exit;
             break;
     }
 }
예제 #17
0
 function process($file)
 {
     @xtc_set_time_limit(0);
     require DIR_FS_CATALOG . DIR_WS_CLASSES . 'xtcPrice.php';
     $xtPrice = new xtcPrice($_POST['currencies'], $_POST['status']);
     $schema = 'artikelid;hersteller;herstellernummer;bezeichnung;kategorie;beschreibung_kurz;beschreibung_lang;bild_klein;deeplink;preis_val;product_ean;' . 'lagerstand;lieferzeit;vkat;vkat_ausland1a;vkde;vkde_ausland1;freeamount' . "\n";
     # added new fields by geizhals
     $export_query = xtc_db_query("SELECT\n                                           p.products_id,\n                                           pd.products_name,\n                                           pd.products_description,pd.products_short_description,\n                                           p.products_model,p.products_ean,\n                                           p.products_image,\n                                           p.products_price,\n                                           p.products_status,\n                                           p.products_date_available,\n                                           p.products_shippingtime,\n                                           p.products_discount_allowed,\n                                           pd.products_meta_keywords,\n                                           p.products_tax_class_id,\n                                           p.products_date_added,\n                                           m.manufacturers_name,\n                                           p.products_quantity,\n                                           p.products_weight\n                                    FROM\n                                           " . TABLE_PRODUCTS . " p LEFT JOIN\n                                           " . TABLE_MANUFACTURERS . " m\n                                        ON p.manufacturers_id = m.manufacturers_id LEFT JOIN\n                                           " . TABLE_PRODUCTS_DESCRIPTION . " pd\n                                        ON p.products_id = pd.products_id AND\n                                           pd.language_id = '" . $_SESSION['languages_id'] . "' LEFT JOIN\n                                           " . TABLE_SPECIALS . " s\n                                        ON p.products_id = s.products_id\n                                     WHERE p.products_status = 1\n                                     ORDER BY\n                                           p.products_date_added DESC,\n                                           pd.products_name");
     # added p.products_quantity, p.products_weight to select by geizhals
     while ($products = xtc_db_fetch_array($export_query)) {
         $products_price = $xtPrice->xtcGetPrice($products['products_id'], $format = false, 1, $products['products_tax_class_id'], '');
         // get product categorie
         $categorie_query = xtc_db_query("SELECT\n                                              categories_id\n                                         FROM " . TABLE_PRODUCTS_TO_CATEGORIES . "\n                                        WHERE products_id='" . $products['products_id'] . "'");
         while ($categorie_data = xtc_db_fetch_array($categorie_query)) {
             $categories = $categorie_data['categories_id'];
         }
         ################## added by geizhals
         $shipping_query = xtc_db_query("SELECT\n                                             shipping_status_name\n                                        FROM " . TABLE_SHIPPING_STATUS . "\n                                       WHERE shipping_status_id=" . $products['products_shippingtime'] . " AND language_id=" . $_SESSION['languages_id']);
         $shipping_data = xtc_db_fetch_array($shipping_query);
         $shipping[] = $shipping_data['shipping_status_name'];
         $vkat_query = xtc_db_query("select configuration_value as vkat from configuration where configuration_key='MODULE_SHIPPING_AP_COST_8'");
         $vkat_data = xtc_db_fetch_array($vkat_query);
         $vkat[] = $vkat_data['vkat'];
         $vkat_ausland_query = xtc_db_query("select configuration_value as vkat from configuration where configuration_key='MODULE_SHIPPING_AP_COST_1'");
         $vkat_ausland_data = xtc_db_fetch_array($vkat_ausland_query);
         $vkat_ausland[] = $vkat_ausland_data['vkat'];
         $vkde_query = xtc_db_query("select configuration_value as vkde from configuration where configuration_key='MODULE_SHIPPING_DP_COST_6'");
         $vkde_data = xtc_db_fetch_array($vkde_query);
         $vkde[] = $vkde_data['vkde'];
         $vkde_ausland_query = xtc_db_query("select configuration_value as vkde from configuration where configuration_key='MODULE_SHIPPING_DP_COST_1'");
         $vkde_ausland_data = xtc_db_fetch_array($vkde_ausland_query);
         $vkde_ausland[] = $vkde_ausland_data['vkde'];
         $free_query = xtc_db_query("select configuration_value as freeamount from configuration where configuration_key='MODULE_SHIPPING_FREEAMOUNT_AMOUNT'");
         $free_data = xtc_db_fetch_array($free_query);
         $free[] = $free_data['freeamount'];
         ################## end added by geizhals
         // remove trash
         $products_description = strip_tags($products['products_description']);
         $products_description = str_replace("<br>", " ", $products_description);
         $products_description = str_replace("<br />", " ", $products_description);
         $products_description = str_replace(";", ", ", $products_description);
         $products_description = str_replace("'", ", ", $products_description);
         $products_description = str_replace("\n", " ", $products_description);
         $products_description = str_replace("\r", " ", $products_description);
         $products_description = str_replace("\t", " ", $products_description);
         $products_description = str_replace("\v", " ", $products_description);
         $products_description = str_replace("&quot,", " \"", $products_description);
         $products_description = str_replace("&qout,", " \"", $products_description);
         $products_description = str_replace(chr(13), " ", $products_description);
         $products_short_description = strip_tags($products['products_short_description']);
         $products_short_description = str_replace("<br>", " ", $products_short_description);
         $products_short_description = str_replace("<br />", " ", $products_short_description);
         $products_short_description = str_replace(";", ", ", $products_short_description);
         $products_short_description = str_replace("'", ", ", $products_short_description);
         $products_short_description = str_replace("\n", " ", $products_short_description);
         $products_short_description = str_replace("\r", " ", $products_short_description);
         $products_short_description = str_replace("\t", " ", $products_short_description);
         $products_short_description = str_replace("\v", " ", $products_short_description);
         $products_short_description = str_replace("&quot,", " \"", $products_short_description);
         $products_short_description = str_replace("&qout,", " \"", $products_short_description);
         $products_short_description = str_replace(chr(13), " ", $products_short_description);
         $products_short_description = substr($products_short_description, 0, 255);
         $products_description = substr($products_description, 0, 65536);
         $cat = $this->buildCAT($categories);
         if ($products['products_image'] != '') {
             $image = HTTP_CATALOG_SERVER . DIR_WS_CATALOG_THUMBNAIL_IMAGES . $products['products_image'];
         } else {
             $image = '';
         }
         //create content
         $schema .= $products['products_id'] . ";" . $products['manufacturers_name'] . ";" . $products['products_model'] . ";" . $products['products_name'] . ";" . substr($cat, 0, strlen($cat) - 2) . ";" . $products_short_description . ";" . $products_description . ";" . $image . ";" . HTTP_CATALOG_SERVER . DIR_WS_CATALOG . 'product_info.php?' . $_POST['campaign'] . xtc_product_link($products['products_id'], $products['products_name']) . ";" . number_format($products_price, 2, '.', '') . ";" . $products['products_ean'] . ";" . $products['products_quantity'] . ";" . xtc_get_shipping_status_name($products['products_shippingtime']) . ";" . $this->getShipCost($vkat[0], $products['products_weight']) . ";" . $this->getShipCost($vkat_ausland[0], $products['products_weight']) . ";" . $this->getShipCost($vkde[0], $products['products_weight']) . ";" . $this->getShipCost($vkde_ausland[0], $products['products_weight']) . ";" . $free[0] . "\n";
     }
     // create File
     $fp = fopen(DIR_FS_DOCUMENT_ROOT . 'export/' . $file, "w+");
     fputs($fp, $schema);
     fclose($fp);
     ################## added by geizhals
     // zip file
     $zipfile = new zipfile();
     $filedata = implode("", file(DIR_FS_DOCUMENT_ROOT . 'export/' . $file));
     $zipfile->add_file($filedata, $file);
     header("Content-type: application/octet-stream");
     header("Content-disposition: attachment; filename=zipfile.zip");
     $fp = fopen(DIR_FS_DOCUMENT_ROOT . 'export/' . $file . '.zip', "w+");
     fputs($fp, $zipfile->file());
     fclose($fp);
     ################## end added by geizhals
     switch ($_POST['export']) {
         case 'yes':
             // send File to Browser
             $extension = substr($file, -3);
             $fp = fopen(DIR_FS_DOCUMENT_ROOT . 'export/' . $file, "rb");
             $buffer = fread($fp, filesize(DIR_FS_DOCUMENT_ROOT . 'export/' . $file));
             fclose($fp);
             header('Content-type: application/x-octet-stream');
             header('Content-disposition: attachment; filename=' . $file);
             echo $buffer;
             exit;
             break;
     }
 }