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ährung;Kategorie;Gültig bis;Gü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;
     }
 }
Example #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 = '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;
     }
 }
 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 product_to_EMOSItem($product, $lang, $quant, $cedit_id = 0)
{
    require_once DIR_FS_INC . 'xtc_get_tax_rate.inc.php';
    require_once DIR_FS_CATALOG . 'includes/classes/xtcPrice.php';
    $product_to_emos_query = xtc_db_query("select p.products_id, pd.products_name, p.products_model, p.products_price, p.products_tax_class_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int) $product . "' and pd.products_id = p.products_id and pd.language_id = '" . (int) $lang . "'");
    $product_to_emos = xtc_db_fetch_array($product_to_emos_query);
    $emos_xtPrice = new xtcPrice(DEFAULT_CURRENCY, $_SESSION['customers_status']['customers_status_id']);
    $product_to_emos_price = $emos_xtPrice->xtcGetPrice($product_to_emos['products_id'], false, $quant, $product_to_emos['products_tax_class_id'], $product_to_emos['products_price'], '', $cedit_id);
    if (ECONDA_PRICE_IS_BRUTTO == 'false') {
        $product_to_emos_price = sprintf("%0.2f", $product_to_emos_price / ((xtc_get_tax_rate($product_to_emos['products_tax_class_id']) + 100) / 100));
    }
    $item = new EMOS_Item();
    $item->productID = $product_to_emos['products_id'];
    $item->productName = $product_to_emos['products_name'];
    $item->price = $product_to_emos_price;
    $item->productGroup = product_path_by_name((int) $product, (int) $lang) . "/" . $product_to_emos['products_name'];
    $item->quantity = (int) $quant;
    return $item;
}
function attributes_price($products_id, $session)
{
    $attributes_price = 0;
    //DokuMan - 2010-11-13 - set default value
    $xtPrice = new xtcPrice($session['currency'], $session['customers_status']['customers_status_id']);
    if (isset($session['contents'][$products_id]['attributes'])) {
        reset($session['contents'][$products_id]['attributes']);
        while (list($option, $value) = each($session['contents'][$products_id]['attributes'])) {
            $attribute_price_query = xtc_db_query("select pd.products_tax_class_id, p.options_values_price, p.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " p, " . TABLE_PRODUCTS . " pd where p.products_id = '" . xtc_db_input((int) $products_id) . "' and p.options_id = '" . xtc_db_input((int) $option) . "' and pd.products_id = p.products_id and p.options_values_id = '" . xtc_db_input((int) $value) . "'");
            $attribute_price = xtc_db_fetch_array($attribute_price_query);
            if ($attribute_price['price_prefix'] == '+') {
                $attributes_price += $xtPrice->xtcFormat($attribute_price['options_values_price'], false, $attribute_price['products_tax_class_id']);
            } else {
                $attributes_price -= $xtPrice->xtcFormat($attribute_price['options_values_price'], false, $attribute_price['products_tax_class_id']);
            }
        }
    }
    return $attributes_price;
}
 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;
     }
 }
            $final_price = $xtPrice->xtcGetPrice($order_products['products_id'], $format = false, '', '', $f_price, '', $order->customer['ID']);
        }
        $sql_data_array = array('products_price' => xtc_db_prepare_input($products_price), 'final_price' => xtc_db_prepare_input($final_price));
        xtc_db_perform(TABLE_ORDERS_PRODUCTS, $sql_data_array, 'update', 'orders_products_id  = \'' . (int) $order_products['orders_products_id'] . '\'');
    }
    // Produkte Ende
    // OT
    $order_total_query = xtc_db_query("select orders_total_id, value from " . TABLE_ORDERS_TOTAL . " where orders_id = '" . (int) $_POST['oID'] . "'");
    while ($order_total = xtc_db_fetch_array($order_total_query)) {
        if ($old_curr['code'] == DEFAULT_CURRENCY) {
            $xtPrice = new xtcPrice($curr['code'], $order->info['status']);
            $value = $xtPrice->xtcGetPrice('', $format = false, '', '', $order_total['value'], '', $order->customer['ID']);
        } else {
            $xtPrice = new xtcPrice($old_curr['code'], $order->info['status']);
            $nvalue = $xtPrice->xtcRemoveCurr($order_total['value']);
            $xtPrice = new xtcPrice($curr['code'], $order->info['status']);
            $value = $xtPrice->xtcGetPrice('', $format = false, '', '', $nvalue, '', $order->customer['ID']);
        }
        $text = $xtPrice->xtcFormat($value, true);
        $sql_data_array = array('text' => $text, 'value' => xtc_db_prepare_input($value));
        xtc_db_perform(TABLE_ORDERS_TOTAL, $sql_data_array, 'update', 'orders_total_id  = \'' . (int) $order_total['orders_total_id'] . '\'');
    }
    // OT Ende
    xtc_redirect(xtc_href_link(FILENAME_ORDERS_EDIT, 'edit_action=other&oID=' . (int) $_POST['oID']));
}
// Währungswechsel Ende
// Löschfunktionen Anfang:
// Löschen eines Artikels aus der Bestellung Anfang:
if ($action == 'product_delete') {
    xtc_db_query("delete from " . TABLE_ORDERS_PRODUCTS_ATTRIBUTES . " where orders_products_id = '" . (int) $_POST['opID'] . "'");
    xtc_db_query("delete from " . TABLE_ORDERS_PRODUCTS . " where orders_id = '" . (int) $_POST['oID'] . "' and orders_products_id = '" . (int) $_POST['opID'] . "'");
Example #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;
     }
 }
 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;
     }
 }
 public function createDocument($bill_nr = '', $save = false, $download = false)
 {
     require_once DIR_FS_INC . 'xtc_get_vpe_name.inc.php';
     require_once DIR_FS_INC . 'xtc_get_tax_rate.inc.php';
     if ($this->connection != true) {
         $this->makeConnection();
     }
     if (!is_object($xtPrice)) {
         require_once DIR_FS_CATALOG . 'includes/classes/xtcPrice.php';
         $xtPrice = new xtcPrice($this->info['currency'], $this->info['status']);
     }
     $this->setCustomersTaxRate();
     if (!is_object($document)) {
         $document = new stdClass();
     }
     $document->documentID = $this->getDocumentID($bill_nr);
     $document->customerID = $this->customers->customerID;
     $document->currency = $this->info['currency'];
     $document->documentNumber = $bill_nr;
     $positions = array();
     for ($i = 0, $n = sizeof($this->products); $i < $n; $i++) {
         $attributes = '';
         $attributes_total = 0;
         if (isset($this->products[$i]['attributes']) && sizeof($this->products[$i]['attributes']) > 0) {
             for ($j = 0, $n2 = sizeof($this->products[$i]['attributes']); $j < $n2; $j++) {
                 $attributes_value = trim($this->products[$i]['attributes'][$j]['value']);
                 //$products_array attributes output adjustments (overrides)
                 $products_array[$i]['attributes'][$j]['value'] = $attributes_value;
                 $products_array[$i]['attributes'][$j]['price'] = $attributes_price;
                 if ($attributes_value != '') {
                     $attributes .= ' ' . $this->products[$i]['attributes'][$j]['option'] . ': ' . $attributes_value;
                     $attributes_total += $this->products[$i]['attributes'][$j]['price'];
                 }
             }
         }
         $positions[$i]->positionType = 'POSITION';
         $positions[$i]->itemNumber = xtc_not_null($this->products[$i]['model']) ? $this->products[$i]['model'] : $this->products[$i]['id'];
         $positions[$i]->companyPositionID = $this->products[$i]['id'];
         $positions[$i]->itemDescription = utf8_encode($this->products[$i]['name'] . $attributes);
         $positions[$i]->count = $this->products[$i]['qty'];
         $positions[$i]->unit = utf8_encode(xtc_not_null($this->products[$i]['vpe']) && $this->products[$i]['vpe'] != '0' ? xtc_get_vpe_name($this->products[$i]['vpe']) : EASYBILL_UNIT);
         $positions[$i]->ustPercent = $this->products[$i]['tax'];
         if ($this->products[$i]['allow_tax'] == 1) {
             $this->customer['allow_tax'] = 1;
             $positions[$i]->singlePriceNetto = floatval($xtPrice->xtcRemoveTax($this->products[$i]['price'], $positions[$i]->ustPercent) * 100);
         } else {
             $positions[$i]->singlePriceNetto = floatval($this->products[$i]['price'] * 100);
         }
     }
     for ($t = 0, $n = sizeof($this->totals); $t < $n; $t++) {
         switch ($this->totals[$t]['class']) {
             case 'ot_subtotal':
             case 'ot_tax':
             case 'ot_subtotal_no_tax':
             case 'ot_total':
                 // muss nicht übergeben werden
                 break;
             case 'ot_shipping':
                 $positions[$i]->positionType = 'POSITION';
                 $positions[$i]->count = 1;
                 $positions[$i]->unit = utf8_encode(EASYBILL_UNIT);
                 $positions[$i]->itemDescription = utf8_encode(rtrim(strip_tags($this->totals[$t]['title']), ':'));
                 $positions[$i]->ustPercent = $this->getShippingTax();
                 if ($this->customer['allow_tax'] == 1) {
                     $positions[$i]->singlePriceNetto = floatval($xtPrice->xtcRemoveTax($this->totals[$t]['value'], $positions[$i]->ustPercent) * 100);
                 } else {
                     $positions[$i]->singlePriceNetto = floatval($this->totals[$t]['value'] * 100);
                 }
                 // BOC - Hack for wolf-online-shop.de - delete Shipping if cost = 0
                 if ($positions[$i]->singlePriceNetto == 0) {
                     unset($positions[$i]);
                     $i--;
                 }
                 // EOC - Hack for wolf-online-shop.de - delete Shipping if cost = 0
                 $i++;
                 break;
             case 'ot_payment':
                 $positions[$i]->positionType = 'POSITION';
                 $positions[$i]->count = 1;
                 $positions[$i]->unit = utf8_encode(EASYBILL_UNIT);
                 $positions[$i]->itemDescription = utf8_encode(rtrim(strip_tags($this->totals[$t]['title']), ':'));
                 $positions[$i]->ustPercent = 0;
                 $positions[$i]->singlePriceNetto = floatval($this->totals[$t]['value'] * 100);
                 $i++;
                 break;
             case 'ot_billpay_fee':
             case 'ot_billpaybusiness_fee':
             case 'ot_billpaydebit_fee':
             case 'ot_billpaytc_surcharge':
             case 'ot_coupon':
             case 'ot_discount':
             case 'ot_gv':
             case 'ot_ps_fee':
             case 'ot_loworderfee':
             case 'ot_cod_fee':
             case 'ot_shippingfee':
                 $positions[$i]->positionType = 'POSITION';
                 $positions[$i]->count = 1;
                 $positions[$i]->unit = utf8_encode(EASYBILL_UNIT);
                 $positions[$i]->itemDescription = utf8_encode(rtrim(strip_tags($this->totals[$t]['title']), ':'));
                 $positions[$i]->ustPercent = $this->getOrderTotalTax($this->totals[$t]['class']);
                 if ($this->customer['allow_tax'] == 1) {
                     $positions[$i]->singlePriceNetto = floatval($xtPrice->xtcRemoveTax($this->totals[$t]['value'], $positions[$i]->ustPercent) * 100);
                 } else {
                     $positions[$i]->singlePriceNetto = floatval($this->totals[$t]['value'] * 100);
                 }
                 $i++;
                 break;
             default:
                 $positions[$i]->positionType = 'POSITION';
                 $positions[$i]->count = 1;
                 $positions[$i]->unit = utf8_encode(EASYBILL_UNIT);
                 $positions[$i]->itemDescription = utf8_encode(rtrim(strip_tags($this->totals[$t]['title']), ':'));
                 $positions[$i]->ustPercent = xtc_get_tax_rate(MODULE_EASYBILL_STANDARD_TAX_CLASS, $this->customer['country_id'], $this->customer['zone_id']);
                 if ($this->customer['allow_tax'] == 1) {
                     $positions[$i]->singlePriceNetto = floatval($xtPrice->xtcRemoveTax($this->totals[$t]['value'], $positions[$i]->ustPercent) * 100);
                 } else {
                     $positions[$i]->singlePriceNetto = floatval($this->totals[$t]['value'] * 100);
                 }
                 $i++;
                 break;
         }
     }
     $document->documentPosition = $positions;
     // Text before Positions
     $textPrefix = EASYBILL_PAYMENT_HEADING . $this->getPaymentMethod();
     $textPrefix .= EASYBILL_EOL;
     $textPrefix .= EASYBILL_PAYMENT_HEADING_II . $this->info['order_id'];
     $document->textPrefix = utf8_encode($textPrefix);
     // Text after Positions
     $document->text = utf8_encode(constant(strtoupper('MODULE_EASYBILL_PAYMENT_TEXT_' . $this->info['payment_method'])));
     if ($this->info['payment_method'] == 'billpay') {
         $document->text .= $this->getBankData();
     }
     //SOAP Call
     try {
         $this->document = $this->client->CreateDocument($document);
     } catch (SoapFault $e) {
         $this->error[] = $e;
     }
     if ($save == true) {
         $this->saveDocument($this->document->document->documentID, $download);
     } elseif ($download == true) {
         $this->downloadDocument($this->document->document->documentID);
     }
     // After Process
     $this->after_process();
     if (MODULE_EASYBILL_DO_AUTO_PAYMENT == 'True') {
         $check = explode(';', MODULE_EASYBILL_NO_AUTO_PAYMENT);
         if (!in_array($this->info['payment_method'], $check)) {
             $this->setPayment($this->document->document->documentID);
         }
     }
 }
 //EOF - web28 - 2010-03-20 - Send Order by Admin
 $order = new order($insert_id);
 // BOF - Tomcraft - 2009-10-03 - Paypal Express Modul
 if (isset($_SESSION['paypal_express_new_customer']) && $_SESSION['paypal_express_new_customer'] == 'true' && isset($_SESSION['ACCOUNT_PASSWORD']) && $_SESSION['ACCOUNT_PASSWORD'] == 'true') {
     require_once DIR_FS_INC . 'xtc_create_password.inc.php';
     require_once DIR_FS_INC . 'xtc_encrypt_password.inc.php';
     $password_encrypted = xtc_RandomString(10);
     $password = xtc_encrypt_password($password_encrypted);
     xtc_db_query("update " . TABLE_CUSTOMERS . " set customers_password = '******' where customers_id = '" . (int) $_SESSION['customer_id'] . "'");
     $smarty->assign('NEW_PASSWORD', $password_encrypted);
 }
 // EOF - Tomcraft - 2009-10-03 - Paypal Express Modul
 //BOF - web28 - 2010-03-20 - Send Order by Admin
 if (isset($send_by_admin)) {
     //DokuMan - 2010-09-18 - Undefined variable: send_by_admin
     $xtPrice = new xtcPrice($order->info['currency'], $order->info['status']);
 }
 //EOF - web28 - 2010-03-20 - Send Order by Admin
 $smarty->assign('address_label_customer', xtc_address_format($order->customer['format_id'], $order->customer, 1, '', '<br />'));
 $smarty->assign('address_label_shipping', xtc_address_format($order->delivery['format_id'], $order->delivery, 1, '', '<br />'));
 $smarty->assign('address_label_payment', xtc_address_format($order->billing['format_id'], $order->billing, 1, '', '<br />'));
 $smarty->assign('csID', $order->customer['csID']);
 $order_total = $order->getTotalData($insert_id);
 //ACHTUNG für Bestellbestätigung  aus Admin Funktion in admin/includes/classes/order.php
 $smarty->assign('order_data', $order->getOrderData($insert_id));
 //ACHTUNG für Bestellbestätigung  aus Admin Funktion in admin/includes/classes/order.php
 $smarty->assign('order_total', $order_total['data']);
 $smarty->assign('agree_download', $_SESSION['agree_download']);
 // assign language to template for caching Web28 2012-04-25 - change all $_SESSION['language'] to $order->info['language']
 $smarty->assign('language', $order->info['language']);
 $smarty->assign('tpl_path', 'templates/' . CURRENT_TEMPLATE . '/');
 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;
     }
 }
   XT-Commerce - community made shopping
   http://www.xt-commerce.com

   Copyright (c) 2003 XT-Commerce
   --------------------------------------------------------------
   based on: 
   (c) 2000-2001 The Exchange Project  (earlier name of osCommerce)
   (c) 2002-2003 osCommerce(specials.php,v 1.38 2002/05/16); www.oscommerce.com 
   (c) 2003	 nextcommerce (specials.php,v 1.9 2003/08/18); www.nextcommerce.org

   Released under the GNU General Public License 
   --------------------------------------------------------------*/
require 'includes/application_top.php';
require DIR_FS_CATALOG . DIR_WS_CLASSES . 'xtcPrice.php';
$xtPrice = new xtcPrice(DEFAULT_CURRENCY, $_SESSION['customers_status']['customers_status_id']);
require_once DIR_FS_INC . 'xtc_get_tax_rate.inc.php';
switch ($_GET['action']) {
    case 'setflag':
        xtc_set_specials_status($_GET['id'], $_GET['flag']);
        xtc_redirect(xtc_href_link(FILENAME_SPECIALS, '', 'NONSSL'));
        break;
    case 'insert':
        // insert a product on special
        if (PRICE_IS_BRUTTO == 'true' && substr($_POST['specials_price'], -1) != '%') {
            //BOF - Dokuman - 2009-08-19 - BUGFIX: #0000264 specials are no longer deactivated when stock check = false
            //$sql="select tr.tax_rate from " . TABLE_TAX_RATES . " tr, " . TABLE_PRODUCTS . " p  where tr.tax_class_id = p. products_tax_class_id  and p.products_id = '". $_POST['products_up_id'] . "' ";
            $sql = "select tr.tax_rate from " . TABLE_TAX_RATES . " tr, " . TABLE_PRODUCTS . " p  where tr.tax_class_id = p. products_tax_class_id  and p.products_id = '" . $_POST['products_id'] . "' ";
            //EOF - Dokuman - 2009-08-19 - BUGFIX: #0000264 specials are no longer deactivated when stock check = false
            $tax_query = xtc_db_query($sql);
            $tax = xtc_db_fetch_array($tax_query);
 function proceed()
 {
     global $cPath, $current_category_id, $product;
     parent::proceed();
     if (defined('MODULE_EM_STATUS') && MODULE_EM_STATUS == 'True') {
         // BOF GM_MOD
         $t_script_name = '';
         if (strpos($_SERVER['SCRIPT_NAME'], '.php') !== false && strpos($_SERVER['SCRIPT_NAME'], DIR_WS_CATALOG) !== false) {
             $t_script_name = $_SERVER['SCRIPT_NAME'];
         } elseif (strpos($_SERVER["PHP_SELF"], '.php') !== false && strpos($_SERVER['PHP_SELF'], DIR_WS_CATALOG) !== false) {
             $t_script_name = $_SERVER["PHP_SELF"];
         } elseif (strpos($_SERVER["SCRIPT_FILENAME"], '.php') !== false && strpos($_SERVER['SCRIPT_FILENAME'], DIR_WS_CATALOG) !== false) {
             $t_script_name = $_SERVER['SCRIPT_FILENAME'];
         } else {
             $t_script_name = $PHP_SELF;
         }
         $t_page = $this->get_page();
         $isContactPage = isset($_GET['coID']) && $_GET['coID'] == 7 && $_GET['action'] == 'success' ? true : false;
         if ($t_page == 'Cart' || $isContactPage) {
             $t_amount = !$isContactPage ? number_format(floatval($_SESSION['cart']->show_total()), 2, '.', '') : false;
             if (MODULE_EM_ACTIVATE_GOOGLE_TRACKING == 'True' && MODULE_EM_GOOGLE_LEAD_TRACKING_CODE != '') {
                 $output = MODULE_EM_GOOGLE_LEAD_TRACKING_CODE;
                 if ($t_amount) {
                     $output = preg_replace('/google_conversion_value*\\s=*\\s(\\d.*\\d|\\d)/', 'google_conversion_value = ' . $t_amount, $output);
                     $output = preg_replace('/value=(\\d.*\\d|\\d)&/', 'value=' . $t_amount . '&', $output);
                 }
                 $this->v_output_buffer['EasymarketingApplicationBottomExtender'] .= $output;
             }
             if (MODULE_EM_ACTIVATE_FACEBOOK_TRACKING == 'True' && MODULE_EM_FACEBOOK_LEAD_TRACKING_CODE != '') {
                 $output = MODULE_EM_FACEBOOK_LEAD_TRACKING_CODE;
                 if ($t_amount) {
                     $output = preg_replace("/\\'value\\':\\'(\\d.*\\d|\\d)\\'/", "'value':'" . $t_amount . "'", $output);
                     $output = preg_replace("/cd\\[value\\]=(\\d.*\\d|\\d)&/", "cd[value]=" . $t_amount . "&", $output);
                 }
                 $this->v_output_buffer['EasymarketingApplicationBottomExtender'] .= $output;
             }
         }
         if (MODULE_EM_REMARKETING_STATUS == 'True' && MODULE_EM_REMARKETING_CODE != '') {
             $ecomm_prodid = '';
             $ecomm_pagetype = '';
             $ecomm_totalvalue = '';
             $t_additional_parameters = array();
             $t_amount = 0.0;
             if (!empty($cPath)) {
                 $_categoryIds = explode('_', $cPath);
                 $category_data_query = xtc_db_query("SELECT cd.categories_name FROM categories_description cd WHERE cd.categories_id = '" . end($_categoryIds) . "' AND cd.language_id = '" . $_SESSION['languages_id'] . "'");
                 $category_data_result = xtc_db_fetch_array($category_data_query);
                 $t_additional_parameters[] = "ecomm_category: '" . $category_data_result['categories_name'] . "'";
             }
             if ($t_page == 'Index') {
                 $ecomm_pagetype = 'home';
             } elseif ($t_page == 'Cat' && substr_count($t_script_name, 'advanced_search_result.php') == 0) {
                 $ecomm_pagetype = 'category';
             } elseif ($t_page == 'Cat' && substr_count($t_script_name, 'advanced_search_result.php') > 0) {
                 $ecomm_pagetype = 'searchresults';
             } elseif ($t_page == 'ProductInfo') {
                 $ecomm_pagetype = 'product';
                 $ecomm_prodid = $product->data['products_id'];
                 $t_xtPrice = new xtcPrice(DEFAULT_CURRENCY, DEFAULT_CUSTOMERS_STATUS_ID);
                 $products_price = $t_xtPrice->xtcGetPrice($product->data['products_id'], true, 1, $product->data['products_tax_class_id'], '', 1, 0, true, false, 0);
                 $ecomm_totalvalue = number_format(floatval($products_price['plain']), 2, '.', '');
             } elseif ($t_page == 'Cart') {
                 $ecomm_pagetype = 'cart';
                 $t_productIds = array();
                 $t_productQtys = array();
                 if ($_SESSION['cart']->count_contents() > 0) {
                     $products = $_SESSION['cart']->get_products();
                     foreach ($products as $product) {
                         $t_productIds[] = (int) $product['id'];
                         $t_productQtys[] = $product['quantity'];
                     }
                 }
                 if (floatval($_SESSION['cart']->show_total()) > 0) {
                     $t_amount = number_format(floatval($_SESSION['cart']->show_total()), 2, '.', '');
                 }
                 $ecomm_prodid = implode(',', $t_productIds);
                 $ecomm_totalvalue = number_format($t_amount, 2, '.', '');
                 $t_additional_parameters[] = "ecomm_quantity: [" . implode(',', $t_productQtys) . "]";
             }
             if (!empty($ecomm_pagetype)) {
                 $remarketing_code = MODULE_EM_REMARKETING_CODE;
                 $remarketing_code = str_replace("ecomm_prodid: 'REPLACE_WITH_VALUE'", "ecomm_prodid: [" . $ecomm_prodid . "]", $remarketing_code);
                 $remarketing_code = str_replace("ecomm_pagetype: 'REPLACE_WITH_VALUE'", "ecomm_pagetype: '" . $ecomm_pagetype . "'", $remarketing_code);
                 $remarketing_code = str_replace("ecomm_totalvalue: 'REPLACE_WITH_VALUE'", "ecomm_totalvalue: '" . $ecomm_totalvalue . "'", $remarketing_code);
                 $remarketing_code = str_replace("value=0", "value=" . $t_amount, $remarketing_code);
                 if (count($t_additional_parameters) > 0) {
                     $remarketing_code = str_replace('};', implode(',', $t_additional_parameters) . ',};', $remarketing_code);
                 }
                 $this->v_output_buffer['EasymarketingApplicationBottomExtender'] .= $remarketing_code;
             }
         }
     }
 }
   (c) 2003 nextcommerce (new_attributes_include.php,v 1.11 2003/08/21); www.nextcommerce.org
   (c) 2006 XT-Commerce

   Released under the GNU General Public License
   --------------------------------------------------------------
   Third Party contributions:
   New Attribute Manager v4b        Autor: Mike G | mp3man@internetwork.net | http://downloads.ephing.com

   Released under the GNU General Public License
   --------------------------------------------------------------*/
defined('_VALID_XTC') or die('Direct Access to this location is not allowed.');
// include needed functions
require_once DIR_FS_INC . 'xtc_get_tax_rate.inc.php';
require_once DIR_FS_INC . 'xtc_get_tax_class_id.inc.php';
require DIR_FS_CATALOG . DIR_WS_CLASSES . 'xtcPrice.php';
$xtPrice = new xtcPrice(DEFAULT_CURRENCY, $_SESSION['customers_status']['customers_status_id']);
//NEW SORT SELECTION
if (isset($_GET['option_order_by']) && $_GET['option_order_by']) {
    $option_order_by = $_GET['option_order_by'];
    $_POST['current_product_id'] = $_GET['current_product_id'];
} else {
    $option_order_by = 'products_options_id';
}
$options = array();
$options[] = array('id' => 'products_options_id', 'text' => TEXT_OPTION_ID);
$options[] = array('id' => 'products_options_name', 'text' => TEXT_OPTION_NAME);
$options[] = array('id' => 'products_options_sortorder', 'text' => TEXT_SORTORDER);
$options_dropdown_order = xtc_draw_pull_down_menu('selected', $options, $option_order_by, 'onchange="go_option()" ') . "\n";
//Anzahl Spalten
$colspan = 9;
?>
Example #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;
     }
 }
Example #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 = '#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;
     }
 }
 function get_html($p_products_array)
 {
     $coo_properties_control = MainFactory::create_object('PropertiesControl');
     $coo_properties_view = MainFactory::create_object('PropertiesView');
     $t_content_array = array();
     $module_content = array();
     $any_out_of_stock = '';
     $mark_stock = '';
     $coo_seo_boost = MainFactory::create_object('GMSEOBoost');
     $coo_main = new main();
     $xtPrice = new xtcPrice($_SESSION['currency'], $_SESSION['customers_status']['customers_status_id']);
     for ($i = 0, $n = sizeof($p_products_array); $i < $n; $i++) {
         $t_combis_id = $coo_properties_control->extract_combis_id($p_products_array[$i]['id']);
         // check if combis_id is empty
         if ($t_combis_id == '') {
             // combis_id is empty = article without properties
             if (STOCK_CHECK == 'true') {
                 $mark_stock = xtc_check_stock($p_products_array[$i]['id'], $p_products_array[$i]['quantity']);
                 if ($mark_stock) {
                     $_SESSION['any_out_of_stock'] = 1;
                 }
             }
         }
         $image = '';
         if ($p_products_array[$i]['image'] != '') {
             $image = DIR_WS_THUMBNAIL_IMAGES . $p_products_array[$i]['image'];
         }
         //bof gm
         $gm_products_id = $p_products_array[$i]['id'];
         $gm_products_id = str_replace('{', '_', $gm_products_id);
         $gm_products_id = str_replace('}', '_', $gm_products_id);
         $gm_query = xtc_db_query("SELECT gm_show_weight FROM products WHERE products_id='" . $p_products_array[$i]['id'] . "'");
         $gm_array = xtc_db_fetch_array($gm_query);
         if (empty($gm_array['gm_show_weight'])) {
             $p_products_array[$i]['gm_weight'] = 0;
         }
         $gm_product_link = xtc_href_link(FILENAME_PRODUCT_INFO, xtc_product_link($p_products_array[$i]['id'], $p_products_array[$i]['name']) . '&no_boost=1');
         include DIR_FS_CATALOG . 'gm/modules/gm_gprint_order_details_cart.php';
         $t_shipping_time = $p_products_array[$i]['shipping_time'];
         $t_products_weight = $p_products_array[$i]['gm_weight'];
         $t_products_model = $p_products_array[$i]['model'];
         #properties
         if ($t_combis_id != '') {
             $t_properties_html = $coo_properties_view->get_order_details_by_combis_id($t_combis_id, 'cart');
             $coo_products = MainFactory::create_object('GMDataObject', array('products', array('products_id' => $p_products_array[$i]['id'])));
             $use_properties_combis_quantity = $coo_products->get_data_value('use_properties_combis_quantity');
             if ($use_properties_combis_quantity == 1) {
                 // check article quantity
                 $mark_stock = xtc_check_stock($p_products_array[$i]['id'], $p_products_array[$i]['quantity']);
                 if ($mark_stock) {
                     $_SESSION['any_out_of_stock'] = 1;
                 }
             } else {
                 if ($use_properties_combis_quantity == 0 && ATTRIBUTE_STOCK_CHECK == 'true' && STOCK_CHECK == 'true' || $use_properties_combis_quantity == 2) {
                     // check combis quantity
                     $t_properties_stock = $coo_properties_control->get_properties_combis_quantity($t_combis_id);
                     if ($t_properties_stock < $p_products_array[$i]['quantity']) {
                         $_SESSION['any_out_of_stock'] = 1;
                         $mark_stock = '<span class="markProductOutOfStock">' . STOCK_MARK_PRODUCT_OUT_OF_STOCK . '</span>';
                     }
                 }
             }
             $t_weight = $coo_properties_control->get_properties_combis_weight($t_combis_id);
             if ($coo_products->get_data_value('use_properties_combis_weight') == 1) {
                 $t_products_weight = gm_prepare_number($t_weight, $xtPrice->currencies[$xtPrice->actualCurr]['decimal_point']);
             } else {
                 $t_products_weight = gm_prepare_number($t_weight + $p_products_array[$i]['weight'], $xtPrice->currencies[$xtPrice->actualCurr]['decimal_point']);
             }
             if ($coo_products->get_data_value('use_properties_combis_shipping_time') == 1) {
                 $t_shipping_time = $coo_properties_control->get_properties_combis_shipping_time($t_combis_id);
             }
             $t_combi_model = $coo_properties_control->get_properties_combis_model($t_combis_id);
             if (APPEND_PROPERTIES_MODEL == "true") {
                 // Artikelnummer (Kombi) an Artikelnummer (Artikel) anhängen
                 if ($t_products_model != '' && $t_combi_model != '') {
                     $t_products_model = $t_products_model . '-' . $t_combi_model;
                 } else {
                     if ($t_combi_model != '') {
                         $t_products_model = $t_combi_model;
                     }
                 }
             } else {
                 // Artikelnummer (Artikel) durch Artikelnummer (Kombi) ersetzen
                 if ($t_combi_model != '') {
                     $t_products_model = $t_combi_model;
                 }
             }
         } else {
             $t_properties_html = '';
         }
         $module_content[$i] = array('PRODUCTS_NAME' => $p_products_array[$i]['name'] . $mark_stock, 'PRODUCTS_QTY' => xtc_draw_input_field('cart_quantity[]', gm_convert_qty($p_products_array[$i]['quantity'], false), ' size="2" onblur="gm_qty_is_changed(' . $p_products_array[$i]['quantity'] . ', this.value, \'' . GM_QTY_CHANGED_MESSAGE . '\')"', 'text', true, "gm_cart_data gm_class_input") . xtc_draw_hidden_field('products_id[]', $p_products_array[$i]['id'], 'class="gm_cart_data"') . xtc_draw_hidden_field('old_qty[]', $p_products_array[$i]['quantity']), 'PRODUCTS_OLDQTY_INPUT_NAME' => 'old_qty[]', 'PRODUCTS_QTY_INPUT_NAME' => 'cart_quantity[]', 'PRODUCTS_QTY_VALUE' => gm_convert_qty($p_products_array[$i]['quantity'], false), 'PRODUCTS_ID_INPUT_NAME' => 'products_id[]', 'PRODUCTS_ID_EXTENDED' => $p_products_array[$i]['id'], 'PRODUCTS_MODEL' => $t_products_model, 'SHOW_PRODUCTS_MODEL' => SHOW_PRODUCTS_MODEL, 'PRODUCTS_SHIPPING_TIME' => $t_shipping_time, 'PRODUCTS_TAX' => (double) $p_products_array[$i]['tax'], 'PRODUCTS_IMAGE' => $image, 'IMAGE_ALT' => $p_products_array[$i]['name'], 'BOX_DELETE' => xtc_draw_checkbox_field('cart_delete[]', $p_products_array[$i]['id'], false, 'id="gm_delete_product_' . $gm_products_id . '"'), 'PRODUCTS_LINK' => $gm_product_link, 'PRODUCTS_PRICE' => $xtPrice->xtcFormat($p_products_array[$i]['price'] * $p_products_array[$i]['quantity'], true), 'PRODUCTS_SINGLE_PRICE' => $xtPrice->xtcFormat($p_products_array[$i]['price'], true), 'PRODUCTS_SHORT_DESCRIPTION' => xtc_get_short_description($p_products_array[$i]['id']), 'ATTRIBUTES' => '', 'PROPERTIES' => $t_properties_html, 'GM_WEIGHT' => $t_products_weight, 'PRODUCTS_ID' => $gm_products_id, 'UNIT' => $p_products_array[$i]['unit_name']);
         //eof gm
         // Product options names
         $attributes_exist = isset($p_products_array[$i]['attributes']) ? 1 : 0;
         if ($attributes_exist == 1) {
             reset($p_products_array[$i]['attributes']);
             while (list($option, $value) = each($p_products_array[$i]['attributes'])) {
                 if (ATTRIBUTE_STOCK_CHECK == 'true' && STOCK_CHECK == 'true' && $value != 0) {
                     $attribute_stock_check = xtc_check_stock_attributes($p_products_array[$i][$option]['products_attributes_id'], $p_products_array[$i]['quantity']);
                     if ($attribute_stock_check) {
                         $_SESSION['any_out_of_stock'] = 1;
                     }
                 }
                 $module_content[$i]['ATTRIBUTES'][] = array('ID' => $p_products_array[$i][$option]['products_attributes_id'], 'MODEL' => xtc_get_attributes_model(xtc_get_prid($p_products_array[$i]['id']), $p_products_array[$i][$option]['products_options_values_name'], $p_products_array[$i][$option]['products_options_name']), 'NAME' => $p_products_array[$i][$option]['products_options_name'], 'VALUE_NAME' => $p_products_array[$i][$option]['products_options_values_name'] . $attribute_stock_check);
                 // BOF GM_MOD GX-Customizer:
                 require DIR_FS_CATALOG . 'gm/modules/gm_gprint_order_details_cart_2.php';
             }
         }
     }
     $total_content = '';
     $total = $_SESSION['cart']->show_total();
     if ($_SESSION['customers_status']['customers_status_ot_discount_flag'] == '1' && $_SESSION['customers_status']['customers_status_ot_discount'] != '0.00') {
         if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 0 && $_SESSION['customers_status']['customers_status_add_tax_ot'] == 1) {
             $price = $total - $_SESSION['cart']->show_tax(false);
         } else {
             $price = $total;
         }
         // BOF GM_MOD
         $discount = round($xtPrice->xtcGetDC($price, $_SESSION['customers_status']['customers_status_ot_discount']), 2);
         $total_content = $_SESSION['customers_status']['customers_status_ot_discount'] . ' % ' . SUB_TITLE_OT_DISCOUNT . ' -' . xtc_format_price($discount, $price_special = 1, $calculate_currencies = false) . '<br />';
         $this->set_content_data('DISCOUNT_TEXT', round((double) $_SESSION['customers_status']['customers_status_ot_discount'], 2) . '% ' . SUB_TITLE_OT_DISCOUNT);
         $this->set_content_data('DISCOUNT_VALUE', '-' . xtc_format_price($discount, $price_special = 1, $calculate_currencies = false));
     }
     if ($_SESSION['customers_status']['customers_status_show_price'] == '1') {
         if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 0 && $_SESSION['customers_status']['customers_status_add_tax_ot'] == 0) {
             $total -= $discount;
         }
         if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 0 && $_SESSION['customers_status']['customers_status_add_tax_ot'] == 1) {
             $total -= $discount;
         }
         if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 1) {
             $total -= $discount;
         }
         $total_content .= SUB_TITLE_SUB_TOTAL . $xtPrice->xtcFormat($total, true) . '<br />';
         $t_total = $xtPrice->xtcFormat($total + $discount, true);
     } else {
         $total_content .= NOT_ALLOWED_TO_SEE_PRICES . '<br />';
     }
     // display only if there is an ot_discount
     if ($customer_status_value['customers_status_ot_discount'] != 0) {
         $total_content .= TEXT_CART_OT_DISCOUNT . $customer_status_value['customers_status_ot_discount'] . '%';
     }
     if (SHOW_SHIPPING == 'true') {
         $this->set_content_data('SHIPPING_INFO', ' ' . SHIPPING_EXCL . '<a href="' . $coo_main->gm_get_shipping_link(true) . '" target="_blank" class="lightbox_iframe"> ' . SHIPPING_COSTS . '</a>');
     }
     if ($_SESSION['customers_status']['customers_status_show_price'] == '1') {
         $gm_cart_tax_info = '';
         if (gm_get_conf('TAX_INFO_TAX_FREE') == 'true') {
             $gm_cart_tax_info = GM_TAX_FREE . '<br />';
             $this->set_content_data('TAX_FREE_TEXT', GM_TAX_FREE);
         } else {
             $gm_cart_tax_info = $_SESSION['cart']->show_tax();
             if (!empty($gm_cart_tax_info) && $_SESSION['customers_status']['customers_status_show_price_tax'] == '0' && $_SESSION['customers_status']['customers_status_add_tax_ot'] == '1') {
                 if (!defined(MODULE_ORDER_TOTAL_SUBTOTAL_TITLE_NO_TAX)) {
                     include_once DIR_FS_CATALOG . 'lang/' . $_SESSION['language'] . '/modules/order_total/ot_subtotal.php';
                 }
                 $t_gm_tax = 0;
                 foreach ($_SESSION['cart']->tax as $t_gm_key => $t_gm_value) {
                     $t_gm_tax += $t_gm_value['value'];
                 }
                 $gm_cart_tax_info = MODULE_ORDER_TOTAL_SUBTOTAL_TITLE_NO_TAX . ': ' . $xtPrice->xtcFormat((double) $total - (double) $t_gm_tax, true) . '<br />' . $gm_cart_tax_info;
                 $t_total = $xtPrice->xtcFormat((double) $total - (double) $t_gm_tax + $discount, true);
             }
         }
         $this->set_content_data('UST_CONTENT', $gm_cart_tax_info, 1);
     }
     $t_taxes_data_array = explode('<br />', $_SESSION['cart']->show_tax(true));
     $t_tax_array = array();
     for ($i = 0; $i < count($t_taxes_data_array); $i++) {
         if (!empty($t_taxes_data_array[$i])) {
             $t_tax_data_array = explode(':', $t_taxes_data_array[$i]);
             $t_tax_array[] = array('TEXT' => $t_tax_data_array[0], 'VALUE' => $t_tax_data_array[1]);
         }
     }
     $this->set_content_data('tax_data', $t_tax_array);
     $this->set_content_data('SUBTOTAL', $t_total);
     $this->set_content_data('TOTAL', $xtPrice->xtcFormat($total, true));
     $this->set_content_data('TOTAL_CONTENT', $total_content, 1);
     $this->set_content_data('language', $_SESSION['language']);
     $this->set_content_data('module_content', $module_content);
     $coo_gift_cart = MainFactory::create_object('GiftCartContentView');
     $t_view_html = $coo_gift_cart->get_html();
     $this->set_content_data('MODULE_gift_cart', $t_view_html);
     // Bitcoin Payment - Commerce Coding - BEGIN
     $multiplier = 1;
     $digits = 8;
     switch (MODULE_PAYMENT_BITCOIN_UNITS) {
         case 'uBTC':
             $multiplier *= 1000;
             $digits -= 3;
         case 'mBTC':
             $multiplier *= 1000;
             $digits -= 3;
         case 'BTC':
             $btcPrice = number_format($total / MODULE_PAYMENT_BITCOIN_BTCEUR * $multiplier, $digits, '.', '');
             $this->set_content_data('BITCOIN_PRICE', $btcPrice . ' ' . MODULE_PAYMENT_BITCOIN_UNITS);
     }
     // Bitcoin Payment - Commerce Coding - END
     $t_html_output = $this->build_html();
     return $t_html_output;
 }
Example #19
0
    $sql_sort = " ORDER BY p.products_id ASC ";
} elseif (isset($limit)) {
    $sql_limit = " LIMIT " . (int) $limit;
}
// set sql where
$sql_where = '';
if (isset($id)) {
    $sql_where = " AND p.products_id = '" . xtc_db_prepare_input($id) . "' ";
} elseif (isset($newer_than)) {
    $sql_where = " AND p.products_date_added >= '" . xtc_db_prepare_input(date("Y-m-d H:i:s", $newer_than)) . "' ";
    $sql_sort = " ORDER BY p.products_id ASC ";
}
// process request
if ($sql_limit != '' || $sql_where != '') {
    // init price class
    $xtPrice = new xtcPrice(DEFAULT_CURRENCY, DEFAULT_CUSTOMERS_STATUS_ID);
    // get all shipping countries
    $em_shipping_countries = array();
    if (defined('MODULE_EM_SHIPPING_COUNTRIES')) {
        $_countries = explode(',', MODULE_EM_SHIPPING_COUNTRIES);
        if (count($_countries) > 0) {
            foreach ($_countries as $country) {
                $country = trim($country);
                if (strlen($country) == 2) {
                    $em_shipping_countries[] = $country;
                }
            }
        }
    }
    if (count($em_shipping_countries) <= 0) {
        $em_shipping_countries[] = 'DE';
     default:
         $customers_email_address = xtc_db_prepare_input($_POST['customers_email_address']);
         $mail_query = xtc_db_query("select customers_firstname, customers_lastname, customers_email_address from " . TABLE_CUSTOMERS . " where customers_email_address = '" . xtc_db_input($customers_email_address) . "'");
         $mail_sent_to = $_POST['customers_email_address'];
         break;
 }
 //BOF - web28 - 2011-04-13 - ADD Coupon message infos
 //$coupon_query = xtc_db_query("select coupon_code from " . TABLE_COUPONS . " where coupon_id = '" . $_GET['cid'] . "'");
 $coupon_query = xtc_db_query("select * from " . TABLE_COUPONS . " where coupon_id = '" . (int) $_GET['cid'] . "'");
 //EOF - web28 - 2011-04-13 - ADD Coupon message infos
 $coupon_result = xtc_db_fetch_array($coupon_query);
 $coupon_name_query = xtc_db_query("select coupon_name from " . TABLE_COUPONS_DESCRIPTION . " where coupon_id = '" . (int) $_GET['cid'] . "' and language_id = '" . (int) $_SESSION['languages_id'] . "'");
 $coupon_name = xtc_db_fetch_array($coupon_name_query);
 //BOF - web28 - 2011-04-13 - ADD Coupon message infos
 require DIR_FS_CATALOG . DIR_WS_CLASSES . 'xtcPrice.php';
 $xtPrice = new xtcPrice(DEFAULT_CURRENCY, 1);
 $coupon_amount = '';
 if ($coupon_result['coupon_type'] == 'S') {
     $coupon_amount = COUPON_INFO . COUPON_FREE_SHIPPING;
 } else {
     $coupon_amount = COUPON_INFO . $xtPrice->xtcFormat($coupon_result['coupon_amount'], true) . ' ';
 }
 if ($coupon_result['coupon_type'] == 'P') {
     $coupon_amount = COUPON_INFO . number_format($coupon_result['coupon_amount'], 2) . '% ';
 }
 if ($coupon_result['coupon_minimum_order'] > 0) {
     $coupon_amount .= COUPON_MINORDER_INFO . $xtPrice->xtcFormat($coupon_result['coupon_minimum_order'], true) . ' ';
 }
 if (trim($coupon_result['restrict_to_products']) != '' || trim($coupon_result['restrict_to_categories']) != '') {
     $coupon_amount .= COUPON_RESTRICT_INFO;
 }
 function get_html($p_coo_product, $p_current_category_id = 0)
 {
     $t_html_output = '';
     $xtPrice = new xtcPrice($_SESSION['currency'], $_SESSION['customers_status']['customers_status_id']);
     $main = new main();
     $group_check = '';
     // xs:booster start (v1.041)
     $xsb_tx = array();
     if (@is_array($_SESSION['xtb0']['tx'])) {
         foreach ($_SESSION['xtb0']['tx'] as $tx) {
             if ($tx['products_id'] == $p_coo_product->data['products_id']) {
                 $xsb_tx = $tx;
                 break;
             }
         }
     }
     // xs:booster end
     if (!is_object($p_coo_product) || !$p_coo_product->isProduct()) {
         // product not found in database
         $error = TEXT_PRODUCT_NOT_FOUND;
         include DIR_WS_MODULES . FILENAME_ERROR_HANDLER;
         $t_html_output = $main_content;
     } else {
         if (ACTIVATE_NAVIGATOR == 'true') {
             $coo_product_navigator = MainFactory::create_object('ProductNavigatorContentView');
             $t_view_html = $coo_product_navigator->get_html($p_coo_product, $p_current_category_id);
             $this->set_content_data('PRODUCT_NAVIGATOR', $t_view_html);
         }
         xtc_db_query("update " . TABLE_PRODUCTS_DESCRIPTION . " set products_viewed = products_viewed+1 where products_id = '" . $p_coo_product->data['products_id'] . "' and language_id = '" . $_SESSION['languages_id'] . "'");
         $products_price = $xtPrice->xtcGetPrice($p_coo_product->data['products_id'], $format = true, 1, $p_coo_product->data['products_tax_class_id'], $p_coo_product->data['products_price'], 1);
         // check if customer is allowed to add to cart
         // BOF GM_MOD:
         if ($_SESSION['customers_status']['customers_status_show_price'] != '0' && $xtPrice->gm_check_price_status($p_coo_product->data['products_id']) == 0) {
             // fsk18
             if ($_SESSION['customers_status']['customers_fsk18'] == '1') {
                 if ($p_coo_product->data['products_fsk18'] == '0') {
                     // BOF GM_MOD:
                     $this->set_content_data('ADD_QTY', xtc_draw_input_field('products_qty', gm_convert_qty($p_coo_product->data['gm_min_order'], false), 'id="gm_attr_calc_qty"') . ' ' . xtc_draw_hidden_field('products_id', $p_coo_product->data['products_id'], 'id="gm_products_id"'));
                     $t_quantity = gm_convert_qty($p_coo_product->data['gm_min_order'], false);
                     $t_disabled_quantity = 0;
                     if (@$xsb_tx['XTB_ALLOW_USER_CHQTY'] == 'true' || $xsb_tx['products_id'] != $p_coo_product->data['products_id']) {
                         $this->set_content_data('ADD_QTY', xtc_draw_input_field('products_qty', str_replace('.', ',', (double) $p_coo_product->data['gm_min_order']), 'id="gm_attr_calc_qty"') . ' ' . xtc_draw_hidden_field('products_id', $p_coo_product->data['products_id'], 'id="gm_products_id"'));
                     } else {
                         $this->set_content_data('ADD_QTY', xtc_draw_input_field('products_qty', '1', 'disabled="disabled" style="background-color:gray;"') . ' ' . xtc_draw_hidden_field('products_id', $p_coo_product->data['products_id'], 'id="gm_attr_calc_qty"'));
                         $t_quantity = 1;
                         $t_disabled_quantity = 1;
                     }
                     $this->set_content_data('QUANTITY', $t_quantity);
                     $this->set_content_data('DISABLED_QUANTITY', $t_disabled_quantity);
                     $this->set_content_data('ADD_CART_BUTTON', xtc_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART, 'id="cart_button"'));
                     if (gm_get_conf('GM_SHOW_WISHLIST') == 'true') {
                         $this->set_content_data('ADD_WISHLIST_BUTTON', '<a href="javascript:submit_to_wishlist()" id="gm_wishlist_link">' . xtc_image_button('button_in_wishlist.gif', NC_WISHLIST) . '</a>');
                     }
                 } else {
                     $this->set_content_data('GM_PID', xtc_draw_hidden_field('products_id', $p_coo_product->data['products_id'], 'id="gm_products_id"'));
                 }
             } else {
                 // BOF GM_MOD:
                 $this->set_content_data('ADD_QTY', xtc_draw_input_field('products_qty', gm_convert_qty($p_coo_product->data['gm_min_order'], false), 'id="gm_attr_calc_qty"') . ' ' . xtc_draw_hidden_field('products_id', $p_coo_product->data['products_id'], 'id="gm_products_id"'));
                 $t_quantity = gm_convert_qty($p_coo_product->data['gm_min_order'], false);
                 $t_disabled_quantity = 0;
                 if (@$xsb_tx['XTB_ALLOW_USER_CHQTY'] == 'true' || $xsb_tx['products_id'] != $p_coo_product->data['products_id']) {
                     $this->set_content_data('ADD_QTY', xtc_draw_input_field('products_qty', str_replace('.', ',', (double) $p_coo_product->data['gm_min_order']), 'id="gm_attr_calc_qty"') . ' ' . xtc_draw_hidden_field('products_id', $p_coo_product->data['products_id'], 'id="gm_products_id"'));
                 } else {
                     $this->set_content_data('ADD_QTY', xtc_draw_input_field('products_qty', '1', 'disabled="disabled" style="background-color:gray;"') . ' ' . xtc_draw_hidden_field('products_id', $p_coo_product->data['products_id'], 'id="gm_attr_calc_qty"'));
                     $t_quantity = 1;
                     $t_disabled_quantity = 1;
                 }
                 $this->set_content_data('QUANTITY', $t_quantity);
                 $this->set_content_data('DISABLED_QUANTITY', $t_disabled_quantity);
                 $this->set_content_data('ADD_CART_BUTTON', xtc_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART, 'id="cart_button"'));
                 if (gm_get_conf('GM_SHOW_WISH_LIST') == 'true') {
                     $this->set_content_data('ADD_WISHLIST_BUTTON', '<a href="javascript:submit_to_wishlist()">' . xtc_image_button('button_in_wishlist.gif', NC_WISHLIST) . '</a>');
                 }
             }
         } elseif ($xtPrice->gm_check_price_status($p_coo_product->data['products_id']) > 0 || $_SESSION['customers_status']['customers_status_show_price'] == '0') {
             $this->set_content_data('GM_PID', xtc_draw_hidden_field('products_id', $p_coo_product->data['products_id'], 'id="gm_products_id"'));
         }
         if ($p_coo_product->data['products_fsk18'] == '1') {
             $this->set_content_data('PRODUCTS_FSK18', 'true');
         }
         // BOF GM_MOD:
         if (ACTIVATE_SHIPPING_STATUS == 'true' && $xtPrice->gm_check_price_status($p_coo_product->data['products_id']) == 0) {
             $this->set_content_data('SHIPPING_NAME', $main->getShippingStatusName($p_coo_product->data['products_shippingtime']));
             $this->set_content_data('SHIPPING_IMAGE', $main->getShippingStatusImage($p_coo_product->data['products_shippingtime']));
         }
         // BOF_GM_MOD:
         $this->set_content_data('FORM_ACTION', xtc_draw_form('cart_quantity', xtc_href_link(FILENAME_PRODUCT_INFO, xtc_get_all_get_params(array('action')) . 'action=add_product'), 'post', 'name="cart_quantity" onsubmit="gm_qty_check = new GMOrderQuantityChecker(); return gm_qty_check.check();"'));
         $this->set_content_data('FORM_ACTION_URL', xtc_href_link(FILENAME_PRODUCT_INFO, xtc_get_all_get_params(array('action')) . 'action=add_product'));
         $this->set_content_data('FORM_ID', 'cart_quantity');
         $this->set_content_data('FORM_NAME', 'cart_quantity');
         $this->set_content_data('FORM_METHOD', 'post');
         // BOF GM_MOD GX-Customizer
         $coo_gm_gprint_product_manager = new GMGPrintProductManager();
         if ($coo_gm_gprint_product_manager->get_surfaces_groups_id($p_coo_product->data['products_id']) !== false) {
             $coo_gm_gprint_configuration = new GMGPrintConfiguration($_SESSION['languages_id']);
             $this->set_content_data('GM_GPRINT_SHOW_PRODUCTS_DESCRIPTION', $coo_gm_gprint_configuration->get_configuration('SHOW_PRODUCTS_DESCRIPTION'));
             $this->set_content_data('GM_GPRINT', 1);
         }
         // EOF GM_MOD GX-Customizer
         $this->set_content_data('FORM_END', '</form>');
         $this->set_content_data('PRODUCTS_PRICE', $products_price['formated']);
         if ($p_coo_product->data['products_vpe_status'] == 1 && $p_coo_product->data['products_vpe_value'] != 0.0 && $products_price['plain'] > 0) {
             $this->set_content_data('PRODUCTS_VPE', $xtPrice->xtcFormat($products_price['plain'] * (1 / $p_coo_product->data['products_vpe_value']), true) . TXT_PER . xtc_get_vpe_name($p_coo_product->data['products_vpe']));
         }
         $this->set_content_data('PRODUCTS_ID', $p_coo_product->data['products_id']);
         $this->set_content_data('PRODUCTS_NAME', $p_coo_product->data['products_name']);
         // BOF GM_MOD:
         if ($_SESSION['customers_status']['customers_status_show_price'] != 0 && ($xtPrice->gm_check_price_status($p_coo_product->data['products_id']) == 0 || $xtPrice->gm_check_price_status($p_coo_product->data['products_id']) == 2 && $p_coo_product->data['products_price'] > 0)) {
             // price incl tax
             $tax_rate = $xtPrice->TAX[$p_coo_product->data['products_tax_class_id']];
             $tax_info = $main->getTaxInfo($tax_rate);
             $this->set_content_data('PRODUCTS_TAX_INFO', $tax_info);
             // BOF GM_MOD:
             if ($xtPrice->gm_check_price_status($p_coo_product->data['products_id']) == 0) {
                 $this->set_content_data('PRODUCTS_SHIPPING_LINK', $main->getShippingLink(true));
             }
         }
         // BOF GM_MOD
         if (gm_get_conf('GM_TELL_A_FRIEND') == 'true') {
             $this->set_content_data('GM_TELL_A_FRIEND', 1);
         }
         if ($p_coo_product->data['gm_show_price_offer'] == 1 && $_SESSION['customers_status']['customers_status_show_price'] != '0' && $xtPrice->gm_check_price_status($p_coo_product->data['products_id']) == 0) {
             $this->set_content_data('GM_PRICE_OFFER', 1);
         }
         if ((double) $p_coo_product->data['gm_min_order'] != 1) {
             $this->set_content_data('GM_MIN_ORDER', gm_convert_qty($p_coo_product->data['gm_min_order'], false));
         }
         if ((double) $p_coo_product->data['gm_graduated_qty'] != 1) {
             $this->set_content_data('GM_GRADUATED_QTY', gm_convert_qty($p_coo_product->data['gm_graduated_qty'], false));
         }
         // EOF GM_MOD
         $this->set_content_data('PRODUCTS_MODEL', $p_coo_product->data['products_model']);
         $this->set_content_data('PRODUCTS_EAN', $p_coo_product->data['products_ean']);
         if ($p_coo_product->data['gm_show_qty_info'] == 1) {
             $this->set_content_data('PRODUCTS_QUANTITY', gm_convert_qty(xtc_get_products_stock($p_coo_product->data['products_id']), false));
             if ($p_coo_product->data['quantity_unit_id'] > 0) {
                 $this->set_content_data('PRODUCTS_QUANTITY_UNIT', $p_coo_product->data['unit_name']);
             }
         }
         // BOF GM_MOD
         if ($p_coo_product->data['gm_show_weight'] == '1') {
             $this->set_content_data('SHOW_PRODUCTS_WEIGHT', 1);
             $this->set_content_data('PRODUCTS_WEIGHT', gm_prepare_number($p_coo_product->data['products_weight'], $xtPrice->currencies[$xtPrice->actualCurr]['decimal_point']));
         }
         // EOF GM_MOD
         $this->set_content_data('PRODUCTS_STATUS', $p_coo_product->data['products_status']);
         $this->set_content_data('PRODUCTS_ORDERED', $p_coo_product->data['products_ordered']);
         $this->set_content_data('PRODUCTS_PRINT', '<img src="templates/' . CURRENT_TEMPLATE . '/buttons/' . $_SESSION['language'] . '/print.gif"  style="cursor:hand;" onclick="javascript:window.open(\'' . xtc_href_link(FILENAME_PRINT_PRODUCT_INFO, 'products_id=' . $p_coo_product->data['products_id']) . '\', \'popup\', \'toolbar=0, width=640, height=600\')" alt="" />');
         //GM_MOD:
         $gmTabTokenizer = MainFactory::create_object('GMTabTokenizer', array(stripslashes($p_coo_product->data['products_description'])));
         $gm_products_descrition = $gmTabTokenizer->get_prepared_output();
         $this->set_content_data('PRODUCTS_DESCRIPTION', $gm_products_descrition);
         $t_gm_images_data = array();
         $t_thumbnails_array = array();
         $t_main_max_width = 369;
         $t_main_max_height = 279;
         $t_thumbnail_max_width = 86;
         $t_thumbnail_max_height = 86;
         // BOF GM_MOD
         require_once DIR_FS_CATALOG . 'gm/classes/GMGMotion.php';
         $coo_gm_gmotion = new GMGMotion();
         $this->set_content_data('GMOTION', $coo_gm_gmotion->check_status($p_coo_product->data['products_id']));
         // EOF GM_MOD
         if (isset($xsb_tx['XTB_REDIRECT_USER_TO']) && $xsb_tx['products_id'] == $p_coo_product->data['products_id']) {
             $this->set_content_data('XTB_REDIRECT_USER_TO', $xsb_tx['XTB_REDIRECT_USER_TO']);
         }
         // BOF GM_MOD
         if ($p_coo_product->data['products_image'] != '' && $p_coo_product->data['gm_show_image'] == '1') {
             $t_info_image_size_array = @getimagesize(DIR_WS_INFO_IMAGES . $p_coo_product->data['products_image']);
             $t_thumbnail_image_size_array = @getimagesize(DIR_WS_IMAGES . 'product_images/gallery_images/' . $p_coo_product->data['products_image']);
             $t_main_padding_left = 0;
             $t_main_padding_top = 0;
             if (isset($t_info_image_size_array[0]) && $t_info_image_size_array[0] < $t_main_max_width) {
                 $t_main_padding_left = round(($t_main_max_width - $t_info_image_size_array[0]) / 2);
             }
             if (isset($t_info_image_size_array[1]) && $t_info_image_size_array[1] < $t_main_max_height) {
                 $t_main_padding_top = round(($t_main_max_height - $t_info_image_size_array[1]) / 2);
             }
             $t_zoom_image = DIR_WS_POPUP_IMAGES . $p_coo_product->data['products_image'];
             if (file_exists(DIR_WS_ORIGINAL_IMAGES . $p_coo_product->data['products_image'])) {
                 $t_zoom_image = DIR_WS_ORIGINAL_IMAGES . $p_coo_product->data['products_image'];
             }
             $t_gm_images_data[] = array('IMAGE' => DIR_WS_INFO_IMAGES . $p_coo_product->data['products_image'], 'IMAGE_ALT' => $p_coo_product->data['gm_alt_text'], 'IMAGE_NR' => 0, 'ZOOM_IMAGE' => $t_zoom_image, 'PRODUCTS_NAME' => $p_coo_product->data['products_name'], 'PADDING_LEFT' => $t_main_padding_left, 'PADDING_TOP' => $t_main_padding_top, 'WIDTH' => $t_info_image_size_array[0], 'HEIGHT' => $t_info_image_size_array[1]);
             $t_thumbnail_padding_left = 0;
             $t_thumbnail_padding_top = 0;
             if (isset($t_thumbnail_image_size_array[0]) && $t_thumbnail_image_size_array[0] < $t_thumbnail_max_width) {
                 $t_thumbnail_padding_left = round(($t_thumbnail_max_width - $t_thumbnail_image_size_array[0]) / 2);
             }
             if (isset($t_thumbnail_image_size_array[1]) && $t_thumbnail_image_size_array[1] < $t_thumbnail_max_height) {
                 $t_thumbnail_padding_top = round(($t_thumbnail_max_height - $t_thumbnail_image_size_array[1]) / 2);
             }
             $t_thumbnails_array[] = array('IMAGE' => DIR_WS_IMAGES . 'product_images/gallery_images/' . $p_coo_product->data['products_image'], 'IMAGE_ALT' => $p_coo_product->data['gm_alt_text'], 'IMAGE_NR' => 0, 'ZOOM_IMAGE' => $t_zoom_image, 'INFO_IMAGE' => DIR_WS_INFO_IMAGES . $p_coo_product->data['products_image'], 'PRODUCTS_NAME' => $p_coo_product->data['products_name'], 'PADDING_LEFT' => $t_thumbnail_padding_left, 'PADDING_TOP' => $t_thumbnail_padding_top);
         }
         $t_gm_images = xtc_get_products_mo_images($p_coo_product->data['products_id']);
         if ($t_gm_images != false) {
             $coo_gm_alt_form = MainFactory::create_object('GMAltText');
             foreach ($t_gm_images as $t_gm_image) {
                 $t_info_image_size_array = @getimagesize(DIR_WS_INFO_IMAGES . $t_gm_image['image_name']);
                 $t_thumbnail_image_size_array = @getimagesize(DIR_WS_IMAGES . 'product_images/gallery_images/' . $t_gm_image['image_name']);
                 $t_main_padding_left = 0;
                 $t_main_padding_top = 0;
                 if (isset($t_info_image_size_array[0]) && $t_info_image_size_array[0] < $t_main_max_width) {
                     $t_main_padding_left = round(($t_main_max_width - $t_info_image_size_array[0]) / 2);
                 }
                 if (isset($t_info_image_size_array[1]) && $t_info_image_size_array[1] < $t_main_max_height) {
                     $t_main_padding_top = round(($t_main_max_height - $t_info_image_size_array[1]) / 2);
                 }
                 $t_zoom_image = DIR_WS_POPUP_IMAGES . $t_gm_image['image_name'];
                 if (file_exists(DIR_WS_ORIGINAL_IMAGES . $t_gm_image['image_name'])) {
                     $t_zoom_image = DIR_WS_ORIGINAL_IMAGES . $t_gm_image['image_name'];
                 }
                 $t_gm_images_data[] = array('IMAGE' => DIR_WS_INFO_IMAGES . $t_gm_image['image_name'], 'IMAGE_ALT' => $coo_gm_alt_form->get_alt($t_gm_image["image_id"], $t_gm_image['image_nr'], $p_coo_product->data['products_id']), 'IMAGE_NR' => $t_gm_image['image_nr'], 'ZOOM_IMAGE' => $t_zoom_image, 'PRODUCTS_NAME' => $p_coo_product->data['products_name'], 'PADDING_LEFT' => $t_main_padding_left, 'PADDING_TOP' => $t_main_padding_top, 'IMAGE_POPUP_URL' => DIR_WS_POPUP_IMAGES . $t_gm_image['image_name']);
                 $t_thumbnail_padding_left = 0;
                 $t_thumbnail_padding_top = 0;
                 if (isset($t_thumbnail_image_size_array[0]) && $t_thumbnail_image_size_array[0] < $t_thumbnail_max_width) {
                     $t_thumbnail_padding_left = round(($t_thumbnail_max_width - $t_thumbnail_image_size_array[0]) / 2);
                 }
                 if (isset($t_thumbnail_image_size_array[1]) && $t_thumbnail_image_size_array[1] < $t_thumbnail_max_height) {
                     $t_thumbnail_padding_top = round(($t_thumbnail_max_height - $t_thumbnail_image_size_array[1]) / 2);
                 }
                 $t_thumbnails_array[] = array('IMAGE' => DIR_WS_IMAGES . 'product_images/gallery_images/' . $t_gm_image['image_name'], 'IMAGE_ALT' => $coo_gm_alt_form->get_alt($t_gm_image["image_id"], $t_gm_image['image_nr'], $p_coo_product->data['products_id']), 'IMAGE_NR' => $t_gm_image['image_nr'], 'ZOOM_IMAGE' => $t_zoom_image, 'INFO_IMAGE' => DIR_WS_INFO_IMAGES . $t_gm_image['image_name'], 'PRODUCTS_NAME' => $p_coo_product->data['products_name'], 'PADDING_LEFT' => $t_thumbnail_padding_left, 'PADDING_TOP' => $t_thumbnail_padding_top);
             }
         }
         $this->set_content_data('images', $t_gm_images_data);
         $this->set_content_data('thumbnails', $t_thumbnails_array);
         // EOF GM_MOD
         $discount = 0.0;
         if ($_SESSION['customers_status']['customers_status_discount'] != '0.00') {
             // BOF GM_MOD:
             $discount = $_SESSION['customers_status']['customers_status_discount'];
             if ($p_coo_product->data['products_discount_allowed'] < $_SESSION['customers_status']['customers_status_discount']) {
                 $discount = $p_coo_product->data['products_discount_allowed'];
             }
             if ($discount != '0.00') {
                 $this->set_content_data('PRODUCTS_DISCOUNT', $discount . '%');
             }
         }
         // BOF GM_MOD
         if (PRODUCT_IMAGE_INFO_WIDTH < 190 - 16) {
             $this->set_content_data('MIN_IMAGE_WIDTH', 188);
             $this->set_content_data('MIN_INFO_BOX_WIDTH', 156 - 10);
             $this->set_content_data('MARGIN_LEFT', 188 + 10);
         } else {
             $this->set_content_data('MIN_IMAGE_WIDTH', PRODUCT_IMAGE_INFO_WIDTH + 16);
             $this->set_content_data('MIN_INFO_BOX_WIDTH', PRODUCT_IMAGE_INFO_WIDTH + 16 - 32 - 10);
             $this->set_content_data('MARGIN_LEFT', PRODUCT_IMAGE_INFO_WIDTH + 16 + 10);
         }
         // EOF GM_MOD
         $coo_product_attributes = MainFactory::create_object('ProductAttributesContentView', array($p_coo_product->data['options_template']));
         $t_view_html = $coo_product_attributes->get_html($p_coo_product);
         $this->set_content_data('MODULE_product_options', $t_view_html);
         $coo_product_reviews = MainFactory::create_object('ProductReviewsContentView');
         $t_view_html = $coo_product_reviews->get_html($p_coo_product);
         $this->set_content_data('MODULE_products_reviews', $t_view_html);
         if (xtc_not_null($p_coo_product->data['products_url'])) {
             $this->set_content_data('PRODUCTS_URL', sprintf(TEXT_MORE_INFORMATION, xtc_href_link(FILENAME_REDIRECT, 'action=product&id=' . $p_coo_product->data['products_id'], 'NONSSL', true)));
         }
         if ($p_coo_product->data['products_date_available'] > date('Y-m-d H:i:s')) {
             $this->set_content_data('PRODUCTS_DATE_AVIABLE', sprintf(TEXT_DATE_AVAILABLE, xtc_date_long($p_coo_product->data['products_date_available'])));
         } else {
             // BOF GM_MOD:
             if ($p_coo_product->data['products_date_added'] != '0000-00-00 00:00:00' && $p_coo_product->data['gm_show_date_added'] == 1) {
                 $this->set_content_data('PRODUCTS_ADDED', sprintf(TEXT_DATE_ADDED, xtc_date_long($p_coo_product->data['products_date_added'])));
             }
         }
         $coo_product_media = MainFactory::create_object('ProductMediaContentView');
         $t_view_html = $coo_product_media->get_html($p_coo_product->data['products_id'], $_SESSION['languages_id']);
         $this->set_content_data('MODULE_products_media', $t_view_html);
         $coo_graduated_prices = MainFactory::create_object('GraduatedPricesContentView');
         $t_view_html = $coo_graduated_prices->get_html($p_coo_product);
         $this->set_content_data('MODULE_graduated_price', $t_view_html);
         $coo_also_purchased = MainFactory::create_object('AlsoPurchasedContentView');
         $t_view_html = $coo_also_purchased->get_html($p_coo_product);
         $this->set_content_data('MODULE_also_purchased', $t_view_html);
         $coo_cross_selling = MainFactory::create_object('CrossSellingContentView', array('cross_selling'));
         $t_view_html = $coo_cross_selling->get_html($p_coo_product);
         $this->set_content_data('MODULE_cross_selling', $t_view_html);
         $coo_reverse_cross_selling = MainFactory::create_object('CrossSellingContentView', array('reverse_cross_selling'));
         $t_view_html = $coo_reverse_cross_selling->get_html($p_coo_product);
         $this->set_content_data('MODULE_reverse_cross_selling', $t_view_html);
         $i = count($_SESSION['tracking']['products_history']);
         if ($i > 6) {
             array_shift($_SESSION['tracking']['products_history']);
             $_SESSION['tracking']['products_history'][6] = $p_coo_product->data['products_id'];
             $_SESSION['tracking']['products_history'] = array_unique($_SESSION['tracking']['products_history']);
         } else {
             $_SESSION['tracking']['products_history'][$i] = $p_coo_product->data['products_id'];
             $_SESSION['tracking']['products_history'] = array_unique($_SESSION['tracking']['products_history']);
         }
         $coo_stop_watch = new StopWatch();
         $coo_stop_watch->start();
         $coo_properties_view = MainFactory::create_object('PropertiesView', array($_GET, $_POST));
         $t_properties_selection_form = $coo_properties_view->get_selection_form($p_coo_product->data['products_id'], $_SESSION['languages_id']);
         if (trim($t_properties_selection_form) != "") {
             if ($p_coo_product->data['gm_show_qty_info'] == 1) {
                 if ($p_coo_product->data['use_properties_combis_quantity'] == 0 && STOCK_CHECK == 'true' && ATTRIBUTES_STOCK_CHECK == 'true' || $p_coo_product->data['use_properties_combis_quantity'] == 2) {
                     $this->set_content_data('PRODUCTS_QUANTITY', '-');
                     $this->set_content_data('SHOW_PRODUCTS_QUANTITY', true);
                 } else {
                     if ($p_coo_product->data['use_properties_combis_quantity'] == 1) {
                         $this->set_content_data('SHOW_PRODUCTS_QUANTITY', true);
                     }
                 }
             }
             $this->set_content_data('SHOW_PRODUCTS_MODEL', true);
             if (APPEND_PROPERTIES_MODEL == "false" || trim($p_coo_product->data['products_model']) == '') {
                 $this->set_content_data('PRODUCTS_MODEL', '-');
             }
             if (ACTIVATE_SHIPPING_STATUS == 'true' && $xtPrice->gm_check_price_status($p_coo_product->data['products_id']) == 0 && $p_coo_product->data['use_properties_combis_shipping_time'] == 1) {
                 $this->set_content_data('SHOW_SHIPPING_TIME', true);
                 $this->set_content_data('SHIPPING_NAME', '');
                 $this->set_content_data('SHIPPING_IMAGE', 'admin/images/icons/gray.png');
             }
         }
         $this->set_content_data('properties_selection_form', $t_properties_selection_form);
         $coo_stop_watch->stop();
         //$coo_stop_watch->log_total_time('PropertiesView get_selection_form');
         // BOF GM_MOD
         $t_gm_show_wishlist = gm_get_conf('GM_SHOW_WISHLIST');
         if ($t_gm_show_wishlist == 'true') {
             $this->set_content_data('GM_SHOW_WISHLIST', 1);
         }
         $t_show_facebook = gm_get_conf('SHOW_FACEBOOK');
         if ($t_show_facebook == 'true') {
             $this->set_content_data('SHOW_FACEBOOK', 1);
         }
         $t_show_twitter = gm_get_conf('SHOW_TWITTER');
         if ($t_show_twitter == 'true') {
             $this->set_content_data('SHOW_TWITTER', 1);
         }
         $t_show_googleplus = gm_get_conf('SHOW_GOOGLEPLUS');
         if ($t_show_googleplus == 'true') {
             $this->set_content_data('SHOW_GOOGLEPLUS', 1);
         }
         $t_show_pinterest = gm_get_conf('SHOW_PINTEREST');
         if ($t_show_pinterest == 'true') {
             $this->set_content_data('SHOW_PINTEREST', 1);
         }
         $t_show_print = gm_get_conf('SHOW_PRINT');
         if ($t_show_print == 'true') {
             $this->set_content_data('SHOW_PRINT', 1);
         }
         $t_show_bookmarking = gm_get_conf('SHOW_BOOKMARKING');
         if ($t_show_bookmarking == 'true') {
             $this->set_content_data('SHOW_BOOKMARKING', 1);
         }
         // EOF GM_MOD
         // Bitcoin Payment - Commerce Coding - BEGIN
         $multiplier = 1;
         $digits = 8;
         switch (MODULE_PAYMENT_BITCOIN_UNITS) {
             case 'uBTC':
                 $multiplier *= 1000;
                 $digits -= 3;
             case 'mBTC':
                 $multiplier *= 1000;
                 $digits -= 3;
             case 'BTC':
                 $btcPrice = number_format($products_price['plain'] / MODULE_PAYMENT_BITCOIN_BTCEUR * $multiplier, $digits, '.', '');
                 $this->set_content_data('BITCOIN_PRICE', $btcPrice . ' ' . MODULE_PAYMENT_BITCOIN_UNITS);
         }
         // Bitcoin Payment - Commerce Coding - END
         include_once DIR_FS_DOCUMENT_ROOT . '/shopgate/plugins/gambiogx/system/views/product_info/ProductInfoContentView.inc.php';
         $t_html_output = $this->build_html();
     }
     return $t_html_output;
 }
   (c) 2000-2001 The Exchange Project  (earlier name of osCommerce)
   (c) 2002-2003 osCommerce(based on original files from OSCommerce CVS 2.2 2002/08/28 02:14:35); www.oscommerce.com
   (c) 2003 nextcommerce (group_prices.php,v 1.16 2003/08/21); www.nextcommerce.org
   (c) 2006 xt-commerce (group_prices.php 1307 2005-10-14); www.xt-commerce.com

   Released under the GNU General Public License
   --------------------------------------------------------------
   based on Third Party contribution:
   Customers Status v3.x  (c) 2002-2003 Copyright Elari elari@free.fr | www.unlockgsm.com/dload-osc/ | CVS : http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/elari/?sortby=date#dirlist

   Released under the GNU General Public License
   --------------------------------------------------------------*/
defined('_VALID_XTC') or die('Direct Access to this location is not allowed.');
require_once DIR_FS_INC . 'xtc_get_tax_rate.inc.php';
require DIR_FS_CATALOG . DIR_WS_CLASSES . 'xtcPrice.php';
$xtPrice = new xtcPrice(DEFAULT_CURRENCY, $_SESSION['customers_status']['customers_status_id']);
$i = 0;
$group_query = xtc_db_query("SELECT customers_status_image,\n                                    customers_status_id,\n                                    customers_status_name\n                               FROM " . TABLE_CUSTOMERS_STATUS . "\n                              WHERE language_id = '" . $_SESSION['languages_id'] . "'\n                              AND customers_status_id != '0'");
while ($group_values = xtc_db_fetch_array($group_query)) {
    // load data into array
    $i++;
    $group_data[$i] = array('STATUS_NAME' => $group_values['customers_status_name'], 'STATUS_IMAGE' => $group_values['customers_status_image'], 'STATUS_ID' => $group_values['customers_status_id']);
}
?>
<div class="main" style="margin:10px 5px 5px 5px"><?php 
echo HEADING_PRICES_OPTIONS;
?>
</div>
<div class='col-xs-12' style="border:1px solid #a3a3a3; background-color:#f3f3f3">
  <div class='col-xs-12'>
      <div class='col-xs-12'><br></div>
 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;
     }
 }
 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;
     }
 }