function xtc_get_products($session)
{
    if (!is_array($session)) {
        return false;
    }
    $products_array = array();
    reset($session);
    //BOF - Dokuman - 2009-11-30 - check for array in cart
    if (is_array($session['cart']->contents)) {
        //EOF - Dokuman - 2009-11-30 - check for array in cart
        while (list($products_id, ) = each($session['cart']->contents)) {
            $products_query = xtc_db_query("select p.products_id, pd.products_name,p.products_image, p.products_model, p.products_price, p.products_discount_allowed, p.products_weight, p.products_tax_class_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id='" . xtc_db_input((int) xtc_get_prid($products_id)) . "' and pd.products_id = p.products_id and pd.language_id = '" . xtc_db_input((int) $_SESSION['languages_id']) . "'");
            if ($products = xtc_db_fetch_array($products_query)) {
                $prid = $products['products_id'];
                // dirty workaround
                $xtPrice = new xtcPrice($session['currency'], $session['customers_status']['customers_status_id']);
                $products_price = $xtPrice->xtcGetPrice($products['products_id'], $format = false, $session['cart']->contents[$products_id]['qty'], $products['products_tax_class_id'], $products['products_price']);
                $products_array[] = array('id' => $products_id, 'name' => $products['products_name'], 'model' => $products['products_model'], 'image' => $products['products_image'], 'price' => $products_price + attributes_price($products_id, $session), 'quantity' => $session['cart']->contents[$products_id]['qty'], 'weight' => $products['products_weight'], 'final_price' => $products_price + attributes_price($products_id, $session), 'tax_class_id' => $products['products_tax_class_id'], 'attributes' => $session['contents'][$products_id]['attributes']);
            }
        }
        return $products_array;
    }
    return false;
    //Dokuman - 2009-11-30 - check for array in cart
}
Ejemplo n.º 2
0
 function process($file)
 {
     @xtc_set_time_limit(0);
     require DIR_FS_CATALOG . DIR_WS_CLASSES . 'xtcPrice.php';
     $xtPrice = new xtcPrice($_POST['currencies'], $_POST['status']);
     //$schema = 'Produktbezeichnung;Beschreibung;Preis;Url;Bild;Wä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;
     }
 }
Ejemplo n.º 3
0
 function process($file)
 {
     @xtc_set_time_limit(0);
     require DIR_FS_CATALOG . DIR_WS_CLASSES . 'xtcPrice.php';
     $xtPrice = new xtcPrice($_POST['currencies'], $_POST['status']);
     $schema = 'Artikelnummer;Preis;Produktname;Kategorie;USt;EAN;ProduktURL;BildURL;Beschreibung' . "\n";
     $export_query = xtc_db_query("SELECT\n                             p.products_id,\n                             pd.products_name,\n                             pd.products_description,\n                             p.products_model,p.products_ean,\n                             p.products_image,\n                             p.products_shippingtime,\n                             p.products_price,\n                             p.products_status,\n                             p.products_discount_allowed,\n                             p.products_tax_class_id,\n                             p.products_date_added,\n                             m.manufacturers_name\n                         FROM\n                             " . TABLE_PRODUCTS . " p LEFT JOIN\n                             " . TABLE_MANUFACTURERS . " m\n                           ON p.manufacturers_id = m.manufacturers_id LEFT JOIN\n                             " . TABLE_PRODUCTS_DESCRIPTION . " pd\n                           ON p.products_id = pd.products_id AND\n                            pd.language_id = '" . $_SESSION['languages_id'] . "' LEFT JOIN\n                             " . TABLE_SPECIALS . " s\n                           ON p.products_id = s.products_id\n                         WHERE\n                           p.products_status = 1\n                         ORDER BY\n                            p.products_date_added DESC,\n                            pd.products_name");
     while ($products = xtc_db_fetch_array($export_query)) {
         $products_price = $xtPrice->xtcGetPrice($products['products_id'], $format = false, 1, $products['products_tax_class_id'], '');
         // remove trash
         $products_description = $products['products_description'];
         $products_description = str_replace("\n", " ", $products_description);
         $products_description = str_replace("<br>", " ", $products_description);
         $products_description = str_replace("<BR>", " ", $products_description);
         $products_description = str_replace("<br />", " ", $products_description);
         $products_description = str_replace("\r", " ", $products_description);
         $products_description = str_replace(";", " ", $products_description);
         $products_description = strip_tags($products_description);
         $products_description = str_replace('|', ' ', $products_description);
         $products_description = substr($products_description, 0, 1000) . " ... ";
         $categorie_query = xtc_db_query("SELECT\n                                            categories_id\n                                            FROM " . TABLE_PRODUCTS_TO_CATEGORIES . "\n                                            WHERE products_id='" . $products['products_id'] . "'");
         while ($categorie_data = xtc_db_fetch_array($categorie_query)) {
             $categories = $categorie_data['categories_id'];
         }
         $categorie_query = xtc_db_query("SELECT\n                                            categories_name\n                                            FROM " . TABLE_CATEGORIES_DESCRIPTION . "\n                                            WHERE categories_id='" . $categories . "'\n                                            and language_id='" . $_SESSION['languages_id'] . "'");
         $categorie_data = xtc_db_fetch_array($categorie_query);
         //create content
         if ($products['products_image'] == '') {
             $wein_image = "";
         } else {
             $wein_image = HTTP_CATALOG_SERVER . DIR_WS_CATALOG_THUMBNAIL_IMAGES . $products['products_image'];
         }
         //create content
         $schema .= $products['products_model'] . ';' . number_format($products_price, 2, '.', '') . ';' . $products['products_name'] . ';' . $categorie_data['categories_name'] . ';' . $xtPrice->TAX[$products['products_tax_class_id']] . ';' . $products['products_ean'] . ';' . HTTP_CATALOG_SERVER . DIR_WS_CATALOG . 'product_info.php?' . $_POST['campaign'] . xtc_product_link($products['products_id'], $products['products_name']) . ';' . $wein_image . ';' . $products_description . "\n";
     }
     // create File
     $fp = fopen(DIR_FS_DOCUMENT_ROOT . 'export/' . $file, "w+");
     fputs($fp, $schema);
     fclose($fp);
     switch ($_POST['export']) {
         case 'yes':
             // send File to Browser
             $extension = substr($file, -3);
             $fp = fopen(DIR_FS_DOCUMENT_ROOT . 'export/' . $file, "rb");
             $buffer = fread($fp, filesize(DIR_FS_DOCUMENT_ROOT . 'export/' . $file));
             fclose($fp);
             header('Content-type: application/x-octet-stream');
             header('Content-disposition: attachment; filename=' . $file);
             echo $buffer;
             exit;
             break;
     }
 }
Ejemplo n.º 4
0
 function process($file)
 {
     @xtc_set_time_limit(0);
     require DIR_FS_CATALOG . DIR_WS_CLASSES . 'xtcPrice.php';
     $xtPrice = new xtcPrice($_POST['currencies'], $_POST['status']);
     $schema = 'Artikelnummer|Produktbezeichnung|Produktbeschreibung|Preis inkl. Mwst.|URL|Produktfoto' . "\n";
     $export_query = xtc_db_query("SELECT\n                             p.products_id,\n                             pd.products_name,\n                             pd.products_description,\n                             p.products_model,\n                             p.products_image,\n                             p.products_shippingtime,\n                             p.products_price,\n                             p.products_status,\n                             p.products_discount_allowed,\n                             p.products_tax_class_id,\n                             p.products_date_added,\n                             m.manufacturers_name\n                         FROM\n                             " . TABLE_PRODUCTS . " p LEFT JOIN\n                             " . TABLE_MANUFACTURERS . " m\n                           ON p.manufacturers_id = m.manufacturers_id LEFT JOIN\n                             " . TABLE_PRODUCTS_DESCRIPTION . " pd\n                           ON p.products_id = pd.products_id AND\n                            pd.language_id = '" . $_SESSION['languages_id'] . "' LEFT JOIN\n                             " . TABLE_SPECIALS . " s\n                           ON p.products_id = s.products_id\n                         WHERE\n                           p.products_status = 1\n                         ORDER BY\n                            p.products_date_added DESC,\n                            pd.products_name");
     while ($products = xtc_db_fetch_array($export_query)) {
         $products_price = $xtPrice->xtcGetPrice($products['products_id'], $format = false, 1, $products['products_tax_class_id'], '');
         // remove trash
         $products_description = $products['products_description'];
         $products_description = str_replace("\n", " ", $products_description);
         $products_description = str_replace("<BR>", " ", $products_description);
         $products_description = str_replace("<br>", " ", $products_description);
         $products_description = str_replace("<br />", " ", $products_description);
         $products_description = str_replace("\r", " ", $products_description);
         $products_description = strip_tags($products_description);
         $products_description = str_replace('|', ' ', $products_description);
         $products_description = substr($products_description, 0, 1000) . " ... ";
         //-- SNAKELAB ----//
         require_once DIR_FS_INC . 'xtc_href_link_from_admin.inc.php';
         $link = xtc_href_link_from_admin('product_info.php', 'products_id=' . $products['products_id']);
         preg_match("/\\?/", $link) ? $link .= '&' : ($link .= '?');
         $link .= 'referer=' . $this->code;
         !empty($_POST['campaign']) ? $link .= '&' . $_POST['campaign'] : false;
         //-- SNAKELAB ----//
         //create content
         $schema .= $products['products_model'] . '|' . $products['products_name'] . '|' . $products_description . '|' . number_format($products_price, 2, '.', '') . '|' . $link . '|' . HTTP_CATALOG_SERVER . DIR_WS_CATALOG_THUMBNAIL_IMAGES . $products['products_image'] . "\n";
     }
     // create File
     $fp = fopen(DIR_FS_DOCUMENT_ROOT . 'export/' . $file, "w+");
     fputs($fp, $schema);
     fclose($fp);
     switch ($_POST['export']) {
         case 'yes':
             // send File to Browser
             $extension = substr($file, -3);
             $fp = fopen(DIR_FS_DOCUMENT_ROOT . 'export/' . $file, "rb");
             $buffer = fread($fp, filesize(DIR_FS_DOCUMENT_ROOT . 'export/' . $file));
             fclose($fp);
             header('Content-type: application/x-octet-stream');
             header('Content-disposition: attachment; filename=' . $file);
             echo $buffer;
             exit;
             break;
     }
 }
Ejemplo n.º 5
0
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 process($file)
 {
     @xtc_set_time_limit(0);
     require DIR_FS_CATALOG . DIR_WS_CLASSES . 'xtcPrice.php';
     $xtPrice = new xtcPrice($_POST['currencies'], $_POST['status']);
     $schema = 'Bezeichnung;Artikelnr;Preis;Beschreibung;Produktlink;FotoLink;Kategorie' . "\n";
     $export_query = xtc_db_query("SELECT\n                             p.products_id,\n                             pd.products_name,\n                             pd.products_description,\n                             p.products_model,\n                             p.products_shippingtime,\n                             p.products_image,\n                             p.products_price,\n                             p.products_status,\n                             p.products_discount_allowed,\n                             p.products_tax_class_id,\n                             IF(s.status, s.specials_new_products_price, NULL) AS specials_new_products_price,\n                             p.products_date_added,\n                             m.manufacturers_name\n                         FROM\n                             " . TABLE_PRODUCTS . " p LEFT JOIN\n                             " . TABLE_MANUFACTURERS . " m\n                           ON p.manufacturers_id = m.manufacturers_id LEFT JOIN\n                             " . TABLE_PRODUCTS_DESCRIPTION . " pd\n                           ON p.products_id = pd.products_id AND\n                            pd.language_id = '" . $_SESSION['languages_id'] . "' LEFT JOIN\n                             " . TABLE_SPECIALS . " s\n                           ON p.products_id = s.products_id\n                         WHERE\n                           p.products_status = 1\n                         ORDER BY\n                            p.products_date_added DESC,\n                            pd.products_name");
     while ($products = xtc_db_fetch_array($export_query)) {
         $products_price = $xtPrice->xtcGetPrice($products['products_id'], $format = false, 1, $products['products_tax_class_id'], '');
         // remove trash
         $products_description = strip_tags($products['products_description']);
         $products_description = substr($products_description, 0, 197) . '..';
         $products_description = str_replace(";", ", ", $products_description);
         $products_description = str_replace("'", ", ", $products_description);
         $products_description = str_replace("\n", " ", $products_description);
         $products_description = str_replace("\r", " ", $products_description);
         $products_description = str_replace("\t", " ", $products_description);
         $products_description = str_replace("\v", " ", $products_description);
         $products_description = str_replace("&quot,", " \"", $products_description);
         $products_description = str_replace("&qout,", " \"", $products_description);
         //create content
         $schema .= $products['products_name'] . ';' . $products['products_model'] . ';' . number_format($products_price, 2, '.', '') . ';' . $products_description . ';' . HTTP_CATALOG_SERVER . DIR_WS_CATALOG . 'product_info.php?' . $_POST['campaign'] . xtc_product_link($products['products_id'], $products['products_name']) . ';' . HTTP_CATALOG_SERVER . DIR_WS_CATALOG_THUMBNAIL_IMAGES . $products['products_image'] . ';' . $products['manufacturers_name'] . "\n";
     }
     // create File
     $fp = fopen(DIR_FS_DOCUMENT_ROOT . 'export/' . $file, "w+");
     fputs($fp, $schema);
     fclose($fp);
     switch ($_POST['export']) {
         case 'yes':
             // send File to Browser
             $extension = substr($file, -3);
             $fp = fopen(DIR_FS_DOCUMENT_ROOT . 'export/' . $file, "rb");
             $buffer = fread($fp, filesize(DIR_FS_DOCUMENT_ROOT . 'export/' . $file));
             fclose($fp);
             header('Content-type: application/x-octet-stream');
             header('Content-disposition: attachment; filename=' . $file);
             echo $buffer;
             exit;
             break;
     }
 }
 function 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;
 }
Ejemplo n.º 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 = '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;
     }
 }
Ejemplo n.º 9
0
 function process($file)
 {
     @xtc_set_time_limit(0);
     require DIR_FS_CATALOG . DIR_WS_CLASSES . 'xtcPrice.php';
     $xtPrice = new xtcPrice($_POST['currencies'], $_POST['status']);
     $schema = 'ProduktID|Gewicht|EAN|Hersteller|ProduktBezeichnung|ArtikelNroderHerstellerArtikelNr|Preis|ProduktLangBeschreibung|ProduktKurzBeschreibung|Lieferzeit|Produktlink|FotoLink|Kategoriename' . "\n";
     $export_query = xtc_db_query("SELECT\n                             p.products_id,\n                             pd.products_name,\n                             pd.products_description,\n                             pd.products_short_description,\n                             p.products_weight,\n                             p.products_ean,\n                             p.products_model,\n                             p.products_shippingtime,\n                             p.products_image,\n                             p.products_price,\n                             p.products_status,\n                             p.products_discount_allowed,\n                             p.products_tax_class_id,\n                             IF(s.status, s.specials_new_products_price, NULL) AS specials_new_products_price,\n                             p.products_date_added,\n                             m.manufacturers_name\n                         FROM\n                             " . TABLE_PRODUCTS . " p LEFT JOIN\n                             " . TABLE_MANUFACTURERS . " m\n                           ON p.manufacturers_id = m.manufacturers_id LEFT JOIN\n                             " . TABLE_PRODUCTS_DESCRIPTION . " pd\n                           ON p.products_id = pd.products_id AND\n                            pd.language_id = '" . $_SESSION['languages_id'] . "' LEFT JOIN\n                             " . TABLE_SPECIALS . " s\n                           ON p.products_id = s.products_id\n                         WHERE\n                           p.products_status = 1\n                         ORDER BY\n                            p.products_date_added DESC,\n                            pd.products_name");
     while ($products = xtc_db_fetch_array($export_query)) {
         $products_price = $xtPrice->xtcGetPrice($products['products_id'], $format = false, 1, $products['products_tax_class_id'], '');
         // get product categorie
         $categorie_query = xtc_db_query("SELECT\n                                            categories_id\n                                            FROM " . TABLE_PRODUCTS_TO_CATEGORIES . "\n                                            WHERE products_id='" . $products['products_id'] . "'");
         while ($categorie_data = xtc_db_fetch_array($categorie_query)) {
             $categories = $categorie_data['categories_id'];
         }
         // remove trash in $products_description
         $products_description = strip_tags($products['products_description']);
         $products_description = str_replace(";", ", ", $products_description);
         $products_description = str_replace("'", ", ", $products_description);
         $products_description = str_replace("\n", " ", $products_description);
         $products_description = str_replace("\r", " ", $products_description);
         $products_description = str_replace("\t", " ", $products_description);
         $products_description = str_replace("\v", " ", $products_description);
         $products_description = str_replace("&quot,", " \"", $products_description);
         $products_description = str_replace("&qout,", " \"", $products_description);
         $products_description = str_replace("|", ",", $products_description);
         $products_description = substr($products_description, 0, 253);
         // remove trash in $products_short_description
         $products_short_description = strip_tags($products['products_short_description']);
         $products_short_description = str_replace(";", ", ", $products_short_description);
         $products_short_description = str_replace("'", ", ", $products_short_description);
         $products_short_description = str_replace("\n", " ", $products_short_description);
         $products_short_description = str_replace("\r", " ", $products_short_description);
         $products_short_description = str_replace("\t", " ", $products_short_description);
         $products_short_description = str_replace("\v", " ", $products_short_description);
         $products_short_description = str_replace("&quot,", " \"", $products_short_description);
         $products_short_description = str_replace("&qout,", " \"", $products_short_description);
         $products_short_description = str_replace("|", ",", $products_short_description);
         $products_short_description = substr($products_short_description, 0, 253);
         $cat = $this->buildCAT($categories);
         // creates pathes of images, if images are integrated
         if ($products['products_image'] != '') {
             $image_if_available = HTTP_CATALOG_SERVER . DIR_WS_CATALOG_ORIGINAL_IMAGES . $products['products_image'];
         } else {
             $image_if_available = '';
         }
         //create content
         $schema .= $products['products_id'] . '|' . $products['products_weight'] . '|' . $products['products_ean'] . '|' . $products['manufacturers_name'] . '|' . $products['products_name'] . '|' . $products['products_model'] . '|' . number_format($products_price, 2, ',', '.') . '|' . $products_description . '|' . $products_short_description . '|' . xtc_get_shipping_status_name($products['products_shippingtime']) . '|' . HTTP_CATALOG_SERVER . DIR_WS_CATALOG . 'product_info.php?' . $_POST['campaign'] . xtc_product_link($products['products_id'], $products['products_name']) . '|' . $image_if_available . '|' . substr($cat, 0, strlen($cat) - 2) . "\n";
     }
     // create File
     $fp = fopen(DIR_FS_DOCUMENT_ROOT . 'export/' . $file, "w+");
     fputs($fp, $schema);
     fclose($fp);
     switch ($_POST['export']) {
         case 'yes':
             // send File to Browser
             $extension = substr($file, -3);
             $fp = fopen(DIR_FS_DOCUMENT_ROOT . 'export/' . $file, "rb");
             $buffer = fread($fp, filesize(DIR_FS_DOCUMENT_ROOT . 'export/' . $file));
             fclose($fp);
             header('Content-type: application/x-octet-stream');
             header('Content-disposition: attachment; filename=' . $file);
             echo $buffer;
             exit;
             break;
     }
 }
Ejemplo n.º 10
0
        }
        $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'] . "'");
    //BOF - Dokuman - 2010-03-17 - calculate stock correctly when editing orders
 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;
             }
         }
     }
 }
Ejemplo n.º 12
0
 function process($file)
 {
     @xtc_set_time_limit(0);
     require DIR_FS_CATALOG . DIR_WS_CLASSES . 'xtcPrice.php';
     $xtPrice = new xtcPrice($_POST['currencies'], $_POST['status']);
     $schema = '<?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;
     }
 }
Ejemplo n.º 13
0
 // set some variables
 $total_weight = $products['products_weight'];
 // reset cart
 $_SESSION['cart']->reset(true);
 $_SESSION['cart']->add_cart($products['products_id'], 1, '', false);
 $_SESSION['cart']->weight = $total_weight;
 $_SESSION['cart']->total = $products_price;
 $products_item_codes = mod_get_products_item_codes($products['products_id']);
 $condition = !empty($products_item_codes['google_export_condition']) ? $products_item_codes['google_export_condition'] : MODULE_EM_CONDITION_DEFAULT;
 if (!isset($id)) {
     $sql_limit = '';
 }
 $select_properties_combis = xtc_db_query("SELECT * FROM products_properties_combis WHERE products_id = '" . $products['products_id'] . "' ORDER BY products_properties_combis_id " . $sql_limit);
 if (xtc_db_num_rows($select_properties_combis) > 0) {
     while ($row_property_combi = xtc_db_fetch_array($select_properties_combis)) {
         $products_price = $xtPrice->xtcGetPrice($products['products_id'], true, 1, $products['products_tax_class_id'], '', 1, 0, true, true, $row_property_combi['products_properties_combis_id']);
         $products_rrp = $xtPrice->xtcGetPrice($products['products_id'], true, 1, $products['products_tax_class_id'], '', 1, 0, false, true, $row_property_combi['products_properties_combis_id']);
         if ($products_price['plain'] != $products_rrp['plain']) {
             $discount_absolute = $products_rrp['plain'] - $products_price['plain'];
             $discount_percentage = round($discount_absolute / $products_rrp['plain'] * 100, 0);
         }
         $products_mapping = array();
         $product_details = array();
         $select_property_values = xtc_db_query("SELECT properties_id, values_name FROM products_properties_index WHERE products_id = '" . $products['products_id'] . "' AND products_properties_combis_id = '" . $row_property_combi['products_properties_combis_id'] . "' AND language_id = '" . (int) $oLanguage->language['id'] . "' ORDER BY properties_sort_order");
         while ($row_property_value = xtc_db_fetch_array($select_property_values)) {
             $product_details['p-' . $row_property_value['properties_id']] = $row_property_value['values_name'];
         }
         $select_additional_fields = xtc_db_query("SELECT afv.additional_field_id, afvd.language_id, afvd.value FROM additional_field_values afv LEFT JOIN additional_field_value_descriptions afvd ON afv.additional_field_value_id = afvd.additional_field_value_id WHERE item_id = '" . $products['products_id'] . "' AND afvd.language_id IN (0," . (int) $oLanguage->language['id'] . ") ORDER BY afv.additional_field_id, afvd.language_id ");
         while ($row_additional_field = xtc_db_fetch_array($select_additional_fields)) {
             $product_details['af-' . $row_additional_field['additional_field_id']] = $row_additional_field['value'];
         }
Ejemplo n.º 14
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;
     }
 }
Ejemplo n.º 15
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 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;
     }
 }
Ejemplo n.º 17
0
 function process($file)
 {
     @xtc_set_time_limit(0);
     $file = $_POST['configuration']['MODULE_BILLIGER_FILE'];
     #$config_query = xtc_db_query("UPDATE " . TABLE_CONFIGURATION . " SET configuration_value = ".$_POST['configuration']['MODULE_BILLIGER_SHIPPING_COST']." WHERE configuration_key = 'MODULE_BILLIGER_SHIPPING_METHOD'");
     require DIR_FS_CATALOG . DIR_WS_CLASSES . 'xtcPrice.php';
     $xtPrice = new xtcPrice($_POST['currencies'], $_POST['status']);
     // query
     //BOF - DokuMan - 2011-06-24 - fix sql query (thx to franky_n)
     /*
             $export_query = xtc_db_query("SELECT
                      p.products_id,
                      p.products_model,
                      p.products_ean,
                      p.products_image,
                      p.products_price,
                      p.products_status,
                      p.products_date_available,
                      p.products_shippingtime,
                      p.products_discount_allowed,
                      p.products_tax_class_id,
                      p.products_date_added,
                      p.products_weight,
                      pd.products_name,
                      pd.products_description,
                      pd.products_short_description,
                      pd.products_meta_keywords,
                      m.manufacturers_name,
                      lng.code
                  FROM
                      " . TABLE_PRODUCTS . " p LEFT JOIN
                      " . TABLE_MANUFACTURERS . " m
                    ON p.manufacturers_id = m.manufacturers_id LEFT JOIN
                      " . TABLE_PRODUCTS_DESCRIPTION . " pd
                    ON p.products_id = pd.products_id LEFT JOIN
                      " . TABLE_SPECIALS . " s
                    ON p.products_id = s.products_id LEFT JOIN
                      " . TABLE_LANGUAGES . " as lng
                    ON lng.languages_id = '" . (int) $_POST['languages_id'] . "'
                  WHERE
                    p.products_status = 1 AND
                    lng.languages_id = pd.language_id
                  ORDER BY
                     p.products_date_added DESC,
                     pd.products_name");
     */
     $export_query = xtc_db_query("SELECT\n                     p.products_id,\n                     pd.products_name,\n                     pd.products_description,\n                     pd.products_short_description,\n                     p.products_model,\n                     p.products_ean,\n                     p.products_image,\n                     p.products_price,\n                     p.products_status,\n                     p.products_date_available,\n                     p.products_shippingtime,\n                     p.products_discount_allowed,\n                     pd.products_meta_keywords,\n                     p.products_tax_class_id,\n                     p.products_date_added,\n                     p.products_weight,\n                     m.manufacturers_name\n                 FROM\n                     " . TABLE_PRODUCTS . " p LEFT JOIN\n                     " . TABLE_MANUFACTURERS . " m\n                   ON p.manufacturers_id = m.manufacturers_id LEFT JOIN\n                     " . TABLE_PRODUCTS_DESCRIPTION . " pd\n                   ON p.products_id = pd.products_id AND\n                    pd.language_id = '" . (int) $_SESSION['languages_id'] . "' LEFT JOIN\n                     " . TABLE_SPECIALS . " s\n                   ON p.products_id = s.products_id\n                 WHERE\n                   p.products_status = 1\n                 ORDER BY\n                    p.products_date_added DESC,\n                    pd.products_name");
     //BOF - DokuMan - 2011-06-24 - fix sql query (thx to franky_n)
     // csv schema / headline
     $schema = 'id;hersteller;modell_nr;name;kategorie;beschreibung;bild_klein;bild_gross;link;lieferzeit;lieferkosten;preis;waehrung;aufbauservice;24_Std_service;EAN;ASIN;ISBN;PZN;ISMN;EPC;VIN';
     $schema .= "\n";
     // parse data
     while ($products = xtc_db_fetch_array($export_query)) {
         $id = $products['products_id'];
         $hersteller = $products['manufacturers_name'];
         $modell_nr = '';
         $name = $this->cleanVars($products['products_name']);
         $kategorie = $this->buildCAT($this->getCategoriesID($products['products_id']));
         $beschreibung = substr($this->cleanVars($products['products_short_description']), 0, 255);
         $bild_klein = $products['products_image'] != '' ? HTTP_CATALOG_SERVER . DIR_WS_CATALOG_THUMBNAIL_IMAGES . $products['products_image'] : '';
         $bild_gross = $products['products_image'] != '' ? HTTP_CATALOG_SERVER . DIR_WS_CATALOG_POPUP_IMAGES . $products['products_image'] : '';
         $lang_param = $products['code'] != DEFAULT_LANGUAGE ? '&language=' . $products['code'] : '';
         $link = xtc_catalog_href_link('product_info.php', xtc_product_link($products['products_id'], $products['products_name']) . (!empty($_POST['campaign']) ? '&' . $_POST['campaign'] : ''));
         $lieferzeit = $this->getShippingtimeName($products['products_shippingtime']);
         $lieferkosten = number_format($this->getShippingCost($products['products_price'], $products['products_weight']), 2, ',', '');
         $preis = $xtPrice->xtcGetPrice($products['products_id'], $format = false, 1, $products['products_tax_class_id'], '');
         $waehrung = $_POST['currencies'];
         $aufbauservice = '';
         $x24_Std_service = '';
         $EAN = $products['products_ean'];
         $ASIN = '';
         $ISBN = '';
         $PZN = '';
         $ISMN = '';
         $EPC = '';
         $VIN = '';
         // add line
         $schema .= $id . ";" . $hersteller . ";" . $modell_nr . ";" . $name . ";" . substr($kategorie, 0, strlen($kategorie) - 2) . ";" . $beschreibung . ";" . $bild_klein . ";" . $bild_gross . ";" . $link . ";" . $lieferzeit . ";" . $lieferkosten . ";" . number_format($preis, 2, ',', '') . ";" . $waehrung . ";" . $aufbauservice . ";" . $x24_Std_service . ";" . $EAN . ";" . $ASIN . ";" . $ISBN . ";" . $PZN . ";" . $ISMN . ";" . $EPC . ";" . $VIN . "" . "\n";
     }
     $filename = DIR_FS_DOCUMENT_ROOT . 'export/' . $file;
     if ($_POST['export'] == 'yes') {
         $filename = $filename . '.tmp_' . time();
     }
     // create File
     $fp = fopen($filename, "w+");
     fputs($fp, $schema);
     fclose($fp);
     // send File to Browser
     switch ($_POST['export']) {
         case 'yes':
             header('Content-type: application/x-octet-stream');
             header('Content-disposition: attachment; filename=' . $file);
             readfile($filename);
             unlink($filename);
             exit;
             break;
     }
 }