Example #1
0
 function process($file)
 {
     @xtc_set_time_limit(0);
     require DIR_FS_CATALOG . DIR_WS_CLASSES . 'xtcPrice.php';
     $xtPrice = new xtcPrice($_POST['currencies'], $_POST['status']);
     $schema = 'Artikelnummer;Preis;Produktname;Kategorie;USt;EAN;ProduktURL;BildURL;Beschreibung' . "\n";
     $export_query = xtc_db_query("SELECT\n                             p.products_id,\n                             pd.products_name,\n                             pd.products_description,\n                             p.products_model,p.products_ean,\n                             p.products_image,\n                             p.products_shippingtime,\n                             p.products_price,\n                             p.products_status,\n                             p.products_discount_allowed,\n                             p.products_tax_class_id,\n                             p.products_date_added,\n                             m.manufacturers_name\n                         FROM\n                             " . TABLE_PRODUCTS . " p LEFT JOIN\n                             " . TABLE_MANUFACTURERS . " m\n                           ON p.manufacturers_id = m.manufacturers_id LEFT JOIN\n                             " . TABLE_PRODUCTS_DESCRIPTION . " pd\n                           ON p.products_id = pd.products_id AND\n                            pd.language_id = '" . $_SESSION['languages_id'] . "' LEFT JOIN\n                             " . TABLE_SPECIALS . " s\n                           ON p.products_id = s.products_id\n                         WHERE\n                           p.products_status = 1\n                         ORDER BY\n                            p.products_date_added DESC,\n                            pd.products_name");
     while ($products = xtc_db_fetch_array($export_query)) {
         $products_price = $xtPrice->xtcGetPrice($products['products_id'], $format = false, 1, $products['products_tax_class_id'], '');
         // remove trash
         $products_description = $products['products_description'];
         $products_description = str_replace("\n", " ", $products_description);
         $products_description = str_replace("<br>", " ", $products_description);
         $products_description = str_replace("<BR>", " ", $products_description);
         $products_description = str_replace("<br />", " ", $products_description);
         $products_description = str_replace("\r", " ", $products_description);
         $products_description = str_replace(";", " ", $products_description);
         $products_description = strip_tags($products_description);
         $products_description = str_replace('|', ' ', $products_description);
         $products_description = substr($products_description, 0, 1000) . " ... ";
         $categorie_query = xtc_db_query("SELECT\n                                            categories_id\n                                            FROM " . TABLE_PRODUCTS_TO_CATEGORIES . "\n                                            WHERE products_id='" . $products['products_id'] . "'");
         while ($categorie_data = xtc_db_fetch_array($categorie_query)) {
             $categories = $categorie_data['categories_id'];
         }
         $categorie_query = xtc_db_query("SELECT\n                                            categories_name\n                                            FROM " . TABLE_CATEGORIES_DESCRIPTION . "\n                                            WHERE categories_id='" . $categories . "'\n                                            and language_id='" . $_SESSION['languages_id'] . "'");
         $categorie_data = xtc_db_fetch_array($categorie_query);
         //create content
         if ($products['products_image'] == '') {
             $wein_image = "";
         } else {
             $wein_image = HTTP_CATALOG_SERVER . DIR_WS_CATALOG_THUMBNAIL_IMAGES . $products['products_image'];
         }
         //create content
         $schema .= $products['products_model'] . ';' . number_format($products_price, 2, '.', '') . ';' . $products['products_name'] . ';' . $categorie_data['categories_name'] . ';' . $xtPrice->TAX[$products['products_tax_class_id']] . ';' . $products['products_ean'] . ';' . HTTP_CATALOG_SERVER . DIR_WS_CATALOG . 'product_info.php?' . $_POST['campaign'] . xtc_product_link($products['products_id'], $products['products_name']) . ';' . $wein_image . ';' . $products_description . "\n";
     }
     // create File
     $fp = fopen(DIR_FS_DOCUMENT_ROOT . 'export/' . $file, "w+");
     fputs($fp, $schema);
     fclose($fp);
     switch ($_POST['export']) {
         case 'yes':
             // send File to Browser
             $extension = substr($file, -3);
             $fp = fopen(DIR_FS_DOCUMENT_ROOT . 'export/' . $file, "rb");
             $buffer = fread($fp, filesize(DIR_FS_DOCUMENT_ROOT . 'export/' . $file));
             fclose($fp);
             header('Content-type: application/x-octet-stream');
             header('Content-disposition: attachment; filename=' . $file);
             echo $buffer;
             exit;
             break;
     }
 }
 function process($file)
 {
     @xtc_set_time_limit(0);
     require DIR_FS_CATALOG . DIR_WS_CLASSES . 'xtcPrice.php';
     $xtPrice = new xtcPrice($_POST['currencies'], $_POST['status']);
     $schema = '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 ProductRedirectionLink($ProdID = false)
{
    if ($ProdID) {
        $fsk_lock = '';
        //DokuMan - 2010-03-12 - set undefined variable
        if ($_SESSION['customers_status']['customers_fsk18_display'] == '0') {
            $fsk_lock = "AND p.products_fsk18!=1 ";
        }
        $group_check = '';
        //DokuMan - 2010-03-12 - set undefined variable
        if (GROUP_CHECK == 'true') {
            $group_check = "AND p.group_permission_" . $_SESSION['customers_status']['customers_status_id'] . "=1 ";
        }
        $dbQuery = xtDBquery("\n\t\t\t\tSELECT \tp.products_id, \n\t\t\t\t\t\tpd.products_name\n\t\t\t\tFROM \t" . TABLE_PRODUCTS_DESCRIPTION . " pd,\n\t\t\t\t\t\t" . TABLE_PRODUCTS . " p\n\t\t\t\tWHERE \tpd.products_id = '" . intval($ProdID) . "'\n\t\t\t\tAND \tpd.products_id = p.products_id\n\t\t\t\t" . $fsk_lock . "\n\t\t\t\t" . $group_check . "\n\t\t\t\tAND\t\tp.products_status = '1'\n\t\t\t\tAND \tpd.language_id = '" . (int) $_SESSION['languages_id'] . "' \n\t\t\t");
        $dbQuery = xtc_db_fetch_array($dbQuery, true);
        if (!empty($dbQuery['products_id'])) {
            return xtc_href_link(FILENAME_PRODUCT_INFO, xtc_product_link(intval($ProdID), $dbQuery['products_name']));
        }
    }
    return false;
}
$box_smarty->assign('tpl_path', 'templates/' . CURRENT_TEMPLATE . '/');
// define defaults
$products_in_cart = array();
$discount = $qty = 0;
$total = 0.0;
// include needed files
require_once DIR_FS_INC . 'xtc_recalculate_price.inc.php';
if ($_SESSION['cart']->count_contents() > 0) {
    $total = $_SESSION['cart']->show_total();
    // build array with cart content and count quantity
    if (strpos($PHP_SELF, FILENAME_LOGOFF) === false) {
        $products = $_SESSION['cart']->get_products();
        $sizeof_products = sizeof($products);
        for ($i = 0, $n = $sizeof_products; $i < $n; $i++) {
            $qty += $products[$i]['quantity'];
            $products_in_cart[] = array('QTY' => $products[$i]['quantity'], 'LINK' => xtc_href_link(FILENAME_PRODUCT_INFO, xtc_product_link($products[$i]['id'], $products[$i]['name'])), 'NAME' => $products[$i]['name']);
        }
    }
    // sales discount
    if ($_SESSION['customers_status']['customers_status_ot_discount_flag'] == '1' && $_SESSION['customers_status']['customers_status_ot_discount'] != '0.00') {
        if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 0 && $_SESSION['customers_status']['customers_status_add_tax_ot'] == 1) {
            $price = $total - $_SESSION['cart']->show_tax(false);
        } else {
            $price = $total;
        }
        $discount = $xtPrice->xtcGetDC($price, $_SESSION['customers_status']['customers_status_ot_discount']);
        $box_smarty->assign('DISCOUNT', $xtPrice->xtcFormat($discount * -1, $price_special = 1, $calculate_currencies = false));
    }
    // generate total price
    if ($_SESSION['customers_status']['customers_status_show_price'] == '1') {
        if ($discount) {
 /**
  * buildDataArray
  *
  * @param array $array
  * @return array
  */
 function buildDataArray(&$array, $image = 'thumbnail')
 {
     global $xtPrice, $main;
     $img_data = xtc_db_fetch_array(xtc_db_query("SELECT products_image_title, products_image_alt FROM " . TABLE_PRODUCTS . " WHERE products_id = '" . $array['products_id'] . "' LIMIT 1"));
     //get tax rate
     $tax_rate = isset($xtPrice->TAX[$array['products_tax_class_id']]) ? $xtPrice->TAX[$array['products_tax_class_id']] : 0;
     //DokuMan: set Undefined index
     //get products price , returns array
     $products_price = $xtPrice->xtcGetPrice($array['products_id'], $format = true, 1, $array['products_tax_class_id'], $array['products_price'], 1);
     //create buy now button
     $buy_now = '';
     if ($_SESSION['customers_status']['customers_status_show_price'] != '0' && defined('SHOW_BUTTON_BUY_NOW') && SHOW_BUTTON_BUY_NOW != 'false') {
         if ($_SESSION['customers_status']['customers_fsk18'] == '1') {
             if (isset($array['products_fsk18']) && $array['products_fsk18'] == '0') {
                 $buy_now = $this->getBuyNowButton($array['products_id'], $array['products_name']);
             }
         } else {
             $buy_now = $this->getBuyNowButton($array['products_id'], $array['products_name']);
         }
     }
     //get $shipping_status_name, $shipping_status_image
     // BOF - Tutorial: Umsetzung der EU-Verbraucherrichtlinie vom 13.06.2014
     /*
     if (isset($array['products_shippingtime']) && ACTIVATE_SHIPPING_STATUS == 'true') {
       $shipping_status_name = $main->getShippingStatusName($array['products_shippingtime']);
       $shipping_status_image = $main->getShippingStatusImage($array['products_shippingtime']);
     } else {
       $shipping_status_name = '';
       $shipping_status_image = '';
     }
     */
     $shipping_status_name = $shipping_status_image = $shipping_status_link = '';
     if (isset($array['products_shippingtime']) && ACTIVATE_SHIPPING_STATUS == 'true') {
         $shipping_status_name = $main->getShippingStatusName($array['products_shippingtime']);
         $shipping_status_image = $main->getShippingStatusImage($array['products_shippingtime']);
         $shipping_status_link = $main->getShippingStatusName($array['products_shippingtime'], true);
     }
     // EOF - Tutorial: Umsetzung der EU-Verbraucherrichtlinie vom 13.06.2014
     //get products image, imageinfo array
     $products_image = $this->productImage($array['products_image'], $image);
     $p_img = substr($products_image, strlen(DIR_WS_BASE));
     //web28 - 2011-01-24 - FIX DIR_WS_BASE
     $img_attr = '';
     if (file_exists($p_img)) {
         list($width, $height, $type, $img_attr) = getimagesize($p_img);
     }
     //products data array
     $productData = array('PRODUCTS_NAME' => $array['products_name'], 'COUNT' => isset($array['ID']) ? $array['ID'] : 0, 'PRODUCTS_ID' => $array['products_id'], 'PRODUCTS_MODEL' => isset($array['products_model']) ? $array['products_model'] : '', 'PRODUCTS_EAN' => isset($array['products_ean']) ? $array['products_ean'] : '', 'PRODUCTS_MANUFACTURERS_MODEL' => isset($array['products_manufacturers_model']) ? $array['products_manufacturers_model'] : '', 'PRODUCTS_VPE' => $main->getVPEtext($array, $products_price['plain']), 'PRODUCTS_IMAGE' => $products_image, 'PRODUCTS_IMAGE_SIZE' => $img_attr, 'PRODUCTS_IMAGE_TITLE' => !empty($img_data['products_image_title']) ? $img_data['products_image_title'] : str_replace('"', '', $array['products_name']), 'PRODUCTS_IMAGE_ALT' => !empty($img_data['products_image_alt']) ? $img_data['products_image_alt'] : str_replace('"', '', $array['products_name']), 'PRODUCTS_LINK' => xtc_href_link(FILENAME_PRODUCT_INFO, xtc_product_link($array['products_id'], $array['products_name'])), 'PRODUCTS_PRICE' => $products_price['formated'], 'PRODUCTS_TAX_INFO' => $main->getTaxInfo($tax_rate), 'PRODUCTS_SHIPPING_LINK' => $main->getShippingLink(), 'PRODUCTS_BUTTON_BUY_NOW' => $buy_now, 'PRODUCTS_BUTTON_PRODUCT_MORE' => '<a href="' . xtc_href_link(FILENAME_PRODUCT_INFO, xtc_product_link($array['products_id'], $array['products_name'])) . '">' . xtc_image_button('button_product_more.gif', IMAGE_BUTTON_PRODUCT_MORE) . '</a>', 'PRODUCTS_SHIPPING_NAME' => $shipping_status_name, 'PRODUCTS_SHIPPING_IMAGE' => $shipping_status_image, 'PRODUCTS_SHIPPING_NAME_LINK' => $shipping_status_link, 'PRODUCTS_DESCRIPTION' => isset($array['products_description']) ? $array['products_description'] : '', 'PRODUCTS_QUANTITY' => isset($array['products_quantity']) ? $array['products_quantity'] : '', 'PRODUCTS_WEIGHT' => $array['products_weight'], 'PRODUCTS_EXPIRES' => isset($array['expires_date']) ? $array['expires_date'] : 0, 'PRODUCTS_CATEGORY_URL' => isset($array['cat_url']) ? $array['cat_url'] : '', 'PRODUCTS_SHORT_DESCRIPTION' => isset($array['products_short_description']) ? $array['products_short_description'] : '', 'PRODUCTS_FSK18' => isset($array['products_fsk18']) ? $array['products_fsk18'] : 0, 'PRODUCTS_BUTTON_DETAILS' => '<a href="' . xtc_href_link(FILENAME_PRODUCT_INFO, xtc_product_link($array['products_id'], $array['products_name'])) . '">' . xtc_image_button('button_product_more.gif', $array['products_name'] . TEXT_NOW) . '</a>');
     return $productData;
 }
 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;
     }
 }
Example #7
0
 function process($file)
 {
     @xtc_set_time_limit(0);
     require DIR_FS_CATALOG . DIR_WS_CLASSES . 'xtcPrice.php';
     $xtPrice = new xtcPrice($_POST['currencies'], $_POST['status']);
     $schema = '<?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;
     }
 }
         $target = '';
     } elseif ($imagesliders_data['imagesliders_url_target'] == '1') {
         $target = ' target="_blank"';
     } elseif ($imagesliders_data['imagesliders_url_target'] == '2') {
         $target = ' target="_top"';
     } elseif ($imagesliders_data['imagesliders_url_target'] == '3') {
         $target = ' target="_self"';
     } elseif ($imagesliders_data['imagesliders_url_target'] == '4') {
         $target = ' target="_parent"';
     }
     if ($imagesliders_data['imagesliders_url_typ'] == '0') {
         $url = $imagesliders_data['imagesliders_url'];
     } elseif ($imagesliders_data['imagesliders_url_typ'] == '1') {
         $url = xtc_href_link($imagesliders_data['imagesliders_url']);
     } elseif ($imagesliders_data['imagesliders_url_typ'] == '2') {
         $url = xtc_href_link(FILENAME_PRODUCT_INFO, xtc_product_link((int) $imagesliders_data['imagesliders_url'], xtc_get_products_name((int) $imagesliders_data['imagesliders_url'])));
     } elseif ($imagesliders_data['imagesliders_url_typ'] == '3') {
         $url = xtc_href_link(FILENAME_DEFAULT, xtc_category_link((int) $imagesliders_data['imagesliders_url'], xtc_get_categories_name((int) $imagesliders_data['imagesliders_url'])));
     } elseif ($imagesliders_data['imagesliders_url_typ'] == '4') {
         $content_querys = "SELECT content_title FROM " . TABLE_CONTENT_MANAGER . " WHERE languages_id='" . (int) $_SESSION['languages_id'] . "' and content_group = '" . (int) $imagesliders_data['imagesliders_url'] . "' and content_status=1 order by sort_order";
         $content_querys = xtDBquery($content_querys);
         $content_title = xtc_db_fetch_array($content_querys, true);
         $SEF = '';
         if (SEARCH_ENGINE_FRIENDLY_URLS == 'true') {
             $SEF = '&content=' . xtc_cleanName($content_title['content_title']);
         }
         $url = xtc_href_link(FILENAME_CONTENT, 'coID=' . (int) $imagesliders_data['imagesliders_url'] . $SEF);
     }
 }
 $imagesliders_data['imagesliders_image_url'] = DIR_WS_IMAGES . $imagesliders_data['imagesliders_image'];
 $imagesliders_data['imagesliders_image_url_link'] = $url;
 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;
     }
 }
    //EOF - Dokuman - 2009-09-02: show upcoming products only when greater zero
    $module_smarty = new Smarty();
    $module_smarty->assign('tpl_path', 'templates/' . CURRENT_TEMPLATE . '/');
    // include needed functions
    require_once DIR_FS_INC . 'xtc_date_short.inc.php';
    $module_content = array();
    //fsk18 lock
    $fsk_lock = '';
    if ($_SESSION['customers_status']['customers_fsk18_display'] == '0') {
        $fsk_lock = ' and p.products_fsk18!=1';
    }
    if (GROUP_CHECK == 'true') {
        $group_check = "and p.group_permission_" . $_SESSION['customers_status']['customers_status_id'] . "=1 ";
    }
    $expected_query = xtDBquery("select p.products_id,\n                                    pd.products_name,\n                                    products_date_available as date_expected from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd\n                                    where to_days(products_date_available) >= to_days(now())\n                                    and p.products_id = pd.products_id\n                                    " . $group_check . "\n                                    " . $fsk_lock . "\n                                    and pd.language_id = '" . (int) $_SESSION['languages_id'] . "'\n                                    order by " . EXPECTED_PRODUCTS_FIELD . " " . EXPECTED_PRODUCTS_SORT . "\n                                    limit " . MAX_DISPLAY_UPCOMING_PRODUCTS);
    if (xtc_db_num_rows($expected_query, true) > 0) {
        $row = 0;
        while ($expected = xtc_db_fetch_array($expected_query, true)) {
            $row++;
            $module_content[] = array('PRODUCTS_LINK' => xtc_href_link(FILENAME_PRODUCT_INFO, xtc_product_link($expected['products_id'], $expected['products_name'])), 'PRODUCTS_NAME' => $expected['products_name'], 'PRODUCTS_DATE' => xtc_date_short($expected['date_expected']));
        }
        $module_smarty->assign('language', $_SESSION['language']);
        $module_smarty->assign('module_content', $module_content);
        // set cache ID
        $module_smarty->caching = 0;
        $module = $module_smarty->fetch(CURRENT_TEMPLATE . '/module/upcoming_products.html');
        $default_smarty->assign('MODULE_upcoming_products', $module);
    }
    //BOF - Dokuman - 2009-09-02: show upcoming products only when greater zero
}
//BOF - Dokuman - 2009-09-02: show upcoming products only when greater zero
 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;
     }
 }
Example #12
0
             foreach ($mappings as $key => $data) {
                 foreach ($data['values'] as $value) {
                     if (isset($product_details[$value])) {
                         $products_mapping[$key] = $product_details[$value];
                         break 1;
                     }
                 }
             }
             if (empty($products_mapping['name'])) {
                 $products_mapping['name'] = $products['products_name'];
             }
             if (empty($products_mapping['description'])) {
                 $products_mapping['description'] = mod_get_description(array('products_description' => $products['products_description'], 'products_short_description' => $products['products_short_description']));
             }
             // build products array
             $products_array[] = array('id' => $products['products_id'], 'name' => mod_convert_string($products_mapping['name']), 'categories' => mod_get_categories_array($products['products_id']), 'google_category' => mod_get_google_category($products['products_id']), 'condition' => mod_get_condition($condition), 'availability' => mod_get_availability($products_item_codes['google_export_availability_id'], $products['products_quantity']), 'currency' => DEFAULT_CURRENCY, 'price' => $products_price['plain'], 'rrp' => $products_rrp['plain'], 'discount_absolute' => $discount_absolute > 0 ? $discount_absolute : 0, 'discount_percentage' => $discount_percentage > 0 ? $discount_percentage : 0, 'url' => xtc_href_link(FILENAME_PRODUCT_INFO, xtc_product_link($products['products_id'], $products['products_name']), 'NONSSL', false), 'image_url' => !empty($products['products_image']) ? HTTP_SERVER . DIR_WS_CATALOG . DIR_WS_POPUP_IMAGES . $products['products_image'] : 'null', 'shipping' => mod_calculate_shipping_cost($products['products_id'], $products_price), 'description' => mod_convert_string($products_mapping['description']), 'age_group' => mod_get_age_group($products_item_codes['age_group']), 'gender' => mod_get_gender($products_item_codes['gender']), 'gtin' => $products['products_ean'] != '' ? $products['products_ean'] : 'null', 'adult' => $products['products_fsk18'] == '1' ? true : false, 'mpn' => mod_convert_string($products_item_codes['code_mpn']), 'brand' => mod_convert_string($products_item_codes['brand_name']));
         }
     }
 }
 // init response array
 $response = array();
 // normal products
 if (isset($offset)) {
     $response['offset'] = $offset;
 }
 // new products
 if (isset($newer_than)) {
     $response['time'] = $newer_than;
     $response['newer_than'] = $limit;
 }
 // add products
if ($random_product) {
    // display random review box
    $review_query = "select substring(reviews_text, 1, 60) as reviews_text from " . TABLE_REVIEWS_DESCRIPTION . " where reviews_id = '" . $random_product['reviews_id'] . "' and languages_id = '" . $_SESSION['languages_id'] . "'";
    $review_query = xtDBquery($review_query);
    $review = xtc_db_fetch_array($review_query, true);
    $review = encode_htmlspecialchars($review['reviews_text']);
    $review = xtc_break_string($review, 15, '-<br />');
    //BOF - Dokuman - 2010-01-29 - show review stars in box
    //$box_content = '<div align="center" class="bewert"><a href="' . xtc_href_link(FILENAME_PRODUCT_REVIEWS_INFO, 'products_id=' . $random_product['products_id'] . '&reviews_id=' . $random_product['reviews_id']) . '">' . xtc_image(DIR_WS_THUMBNAIL_IMAGES . $random_product['products_image'], $random_product['products_name']) . '</a></div><a href="' . xtc_href_link(FILENAME_PRODUCT_REVIEWS_INFO, 'products_id=' . $random_product['products_id'] . '&reviews_id=' . $random_product['reviews_id']) . '">' . $review . ' ..</a><br />';
    $box_content = '<div align="center" class="bewert"><a href="' . xtc_href_link(FILENAME_PRODUCT_REVIEWS_INFO, 'products_id=' . $random_product['products_id'] . '&amp;reviews_id=' . $random_product['reviews_id']) . '">' . xtc_image(DIR_WS_THUMBNAIL_IMAGES . $random_product['products_image'], $random_product['products_name']) . '</a></div><a href="' . xtc_href_link(FILENAME_PRODUCT_REVIEWS_INFO, 'products_id=' . $random_product['products_id'] . '&amp;reviews_id=' . $random_product['reviews_id']) . '">' . $review . ' ..</a><br /><div align="center">' . xtc_image('templates/' . CURRENT_TEMPLATE . '/img/stars_' . $random_product['reviews_rating'] . '.gif', sprintf(BOX_REVIEWS_TEXT_OF_5_STARS, $random_product['reviews_rating'])) . '</div>';
    //EOF - Dokuman - 2010-01-29 - show review stars in box
} elseif ($product->isProduct()) {
    // Verhindern das Gäste oder Spamer bewerten können. www.aranowa.de
    if (isset($_SESSION['customer_id'])) {
        // display 'write a review' box
        $box_content = '<table border="0" cellspacing="0" cellpadding="2"><tr><td align="left" class="infoBoxContents"><a href="' . xtc_href_link(FILENAME_PRODUCT_REVIEWS_WRITE, xtc_product_link($product->data['products_id'], $product->data['products_name'])) . '">' . BOX_REVIEWS_WRITE_REVIEW . '</a></td></tr></table>';
    }
}
if ($box_content != '') {
    $box_smarty->assign('REVIEWS_LINK', xtc_href_link(FILENAME_REVIEWS));
    $box_smarty->assign('BOX_CONTENT', $box_content);
    $box_smarty->assign('language', $_SESSION['language']);
    // set cache ID
    if (!CacheCheck()) {
        $box_smarty->caching = 0;
        $box_reviews = $box_smarty->fetch(CURRENT_TEMPLATE . '/boxes/box_reviews.html');
    } else {
        $box_smarty->caching = 1;
        $box_smarty->cache_lifetime = CACHE_LIFETIME;
        $box_smarty->cache_modified_check = CACHE_CHECK;
        $cache_id = $_SESSION['language'] . $random_product['reviews_id'] . $product->data['products_id'] . $_SESSION['language'];
$reviews_query = "select rd.reviews_text,\n                         r.reviews_rating,\n                         r.reviews_id,\n                         r.products_id,\n                         r.customers_name,\n                         r.date_added,\n                         r.last_modified,\n                         r.reviews_read,\n                         p.products_id,\n                         pd.products_name,\n                         p.products_image\n                  from " . TABLE_REVIEWS . " r\n                  left join " . TABLE_PRODUCTS . " p on (r.products_id = p.products_id)\n                  left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on (p.products_id = pd.products_id \n                  and pd.language_id = '" . (int) $_SESSION['languages_id'] . "'), " . TABLE_REVIEWS_DESCRIPTION . " rd \n                  where r.reviews_id = '" . (int) $_GET['reviews_id'] . "'\n                  and r.reviews_id = rd.reviews_id\n                  and p.products_status = '1'";
$reviews_query = xtc_db_query($reviews_query);
if (!xtc_db_num_rows($reviews_query)) {
    xtc_redirect(xtc_href_link(FILENAME_REVIEWS));
}
$reviews = xtc_db_fetch_array($reviews_query);
$breadcrumb->add(NAVBAR_TITLE_PRODUCT_REVIEWS, xtc_href_link(FILENAME_PRODUCT_REVIEWS, $get_params));
xtc_db_query("update " . TABLE_REVIEWS . " set reviews_read = reviews_read+1 where reviews_id = '" . $reviews['reviews_id'] . "'");
$reviews_text = xtc_break_string(encode_htmlspecialchars($reviews['reviews_text']), 60, '-<br />');
require DIR_WS_INCLUDES . 'header.php';
$smarty->assign('PRODUCTS_NAME', $reviews['products_name']);
$smarty->assign('AUTHOR', $reviews['customers_name']);
$smarty->assign('DATE', xtc_date_long($reviews['date_added']));
$smarty->assign('REVIEWS_TEXT', nl2br($reviews_text));
$smarty->assign('RATING', xtc_image('templates/' . CURRENT_TEMPLATE . '/img/stars_' . $reviews['reviews_rating'] . '.gif', sprintf(TEXT_OF_5_STARS, $reviews['reviews_rating'])));
$smarty->assign('PRODUCTS_LINK', xtc_href_link(FILENAME_PRODUCT_INFO, xtc_product_link($reviews['products_id'], $reviews['products_name'])));
$smarty->assign('BUTTON_BACK', '<a href="' . xtc_href_link(FILENAME_PRODUCT_REVIEWS, $get_params) . '">' . xtc_image_button('button_back.gif', IMAGE_BUTTON_BACK) . '</a>');
$smarty->assign('BUTTON_BUY_NOW', '<a href="' . xtc_href_link(FILENAME_DEFAULT, 'action=buy_now&BUYproducts_id=' . $reviews['products_id']) . '">' . xtc_image_button('button_in_cart.gif', IMAGE_BUTTON_IN_CART) . '</a>');
$smarty->assign('IMAGE', '<a href="javascript:popupImageWindow(\'' . xtc_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $reviews['products_id']) . '\')">' . xtc_image(DIR_WS_THUMBNAIL_IMAGES . $reviews['products_image'], $reviews['products_name'], '', '', 'align="center" hspace="5" vspace="5"') . '<br /></a>');
$smarty->assign('language', $_SESSION['language']);
// set cache ID
if (!CacheCheck()) {
    $smarty->caching = 0;
    $main_content = $smarty->fetch(CURRENT_TEMPLATE . '/module/product_reviews_info.html');
} else {
    $smarty->caching = 1;
    $smarty->cache_lifetime = CACHE_LIFETIME;
    $smarty->cache_modified_check = CACHE_CHECK;
    $cache_id = $_SESSION['language'] . $reviews['reviews_id'];
    $main_content = $smarty->fetch(CURRENT_TEMPLATE . '/module/product_reviews_info.html', $cache_id);
}
 public function getCSVValues($variant, $id, $separator, $quotarchar, $extraName = '', $exrtaPrice = 0, $extraWeight = 0, $optionNumer = '', $stock = '')
 {
     $products = $this->getArticle($id);
     $schema = '';
     $products_price = $products['products_price'] + $exrtaPrice;
     $products_price = $this->getPrice($products['products_tax_class_id'], $products['products_price'], $id);
     $tax = $this->getTax($products['products_tax_class_id'], $id);
     $exrtaPrice = $exrtaPrice * (1 + $tax / 100);
     $products_price = $products_price + $exrtaPrice;
     if ((double) $products['products_discount_allowed'] > 0.0) {
         $products_price = $products_price * (1 - $products['products_discount_allowed'] / 100);
     }
     $categorie_query = xtc_db_query("\tSELECT\n                                            categories_id\n                                            FROM " . TABLE_PRODUCTS_TO_CATEGORIES . "\n                                            WHERE products_id = '" . $products['products_id'] . "'\n                                            ORDER BY categories_id DESC;");
     $categories = '0';
     while ($categorie_data = xtc_db_fetch_array($categorie_query)) {
         if ($categorie_data['categories_id'] != '0') {
             $categories = $categorie_data['categories_id'];
         }
     }
     $cat = $this->buildCAT($categories);
     $export = true;
     if ($this->warehouse === true) {
         if ($variant == 1) {
             if ($stock == 0) {
                 $export = false;
             }
         } elseif ((double) $products['products_quantity'] <= (double) 0) {
             $export = false;
         }
     }
     if ($products['products_status'] == 1 && $products_price > 0.0 && $this->filter($id, $products['manufacturers_name']) === true && $this->filterCat($cat) === true && $export) {
         if ($optionNumer != '') {
             $schema .= $quotarchar . $id . '-' . $optionNumer . $quotarchar . $separator;
         } else {
             $schema .= $quotarchar . $id . $quotarchar . $separator;
         }
         $products_description = $products['products_description'];
         $products_short_description = $products['products_short_description'];
         if ($products['products_image'] != '') {
             $image = $this->getImages($products['products_id'], $products['products_image']);
         } else {
             $image = '';
         }
         $price = number_format($products_price, 2, '.', '');
         $language = xtc_db_query("SELECT `code`\n\t\t\t\t\t\t\t\t\t  FROM `languages`\n\t\t\t\t\t\t\t\t\t  WHERE `languages_id` = " . $_SESSION['languages_id'] . ";");
         $language = xtc_db_fetch_array($language);
         $url = $this->shop_url . DIR_WS_CATALOG . 'product_info.php?' . xtc_product_link($products['products_id'], $products['products_name']);
         if ($this->campaignSet === true) {
             $url = $this->addQueryParams($url, array('refID' => IDEALO_CAMPAIGN));
         }
         $netto = (double) $price / (1 + $tax / 100);
         $schema .= $quotarchar . $this->checkSeparator($this->cleanText($products['manufacturers_name'], 100), $separator) . $quotarchar . $separator . $quotarchar . $this->checkSeparator($products['products_name'] . ' ' . $extraName, $separator) . $quotarchar . $separator . $quotarchar . $this->checkSeparator($this->cleanText($cat, 100), $separator) . $quotarchar . $separator . $quotarchar . $this->checkSeparator($products_short_description, $separator) . $quotarchar . $separator . $quotarchar . $this->checkSeparator($products_description, $separator) . $quotarchar . $separator . $quotarchar . $this->checkSeparator($image, $separator) . $quotarchar . $separator . $quotarchar . $this->checkSeparator($url, $separator) . $quotarchar . $separator . $quotarchar . $price . $quotarchar . $separator . $quotarchar . number_format($netto, 2, '.', '') . $quotarchar . $separator;
         if ($variant == '0') {
             $schema .= $quotarchar . $products['products_ean'] . $quotarchar . $separator;
         } else {
             $schema .= $quotarchar . '' . $quotarchar . $separator;
         }
         $schema .= $quotarchar . $this->checkSeparator($this->getShippingTime($products['products_shippingtime'], $_SESSION['languages_id']), $separator) . $quotarchar . $separator;
         if ($products['products_vpe_status'] == '1' && (double) $products['products_vpe_value'] > 0) {
             $vpe = $this->getVPE($products['products_vpe'], $_SESSION['languages_id']);
             $schema .= $quotarchar . $this->checkSeparator(number_format($price / $products['products_vpe_value'], 2, '.', '') . ' EUR / ' . $vpe, $separator) . $quotarchar . $separator;
         } else {
             $schema .= $quotarchar . '' . $quotarchar . $separator;
         }
         $weight = 0;
         if (empty($products['products_weight'])) {
             $schema .= $quotarchar . 'keine Angabe' . $quotarchar . $separator;
         } else {
             $weight = (double) $products['products_weight'] + (double) $extraWeight;
             $weight = str_replace(",", ".", $weight);
             $schema .= $quotarchar . $weight . $quotarchar . $separator;
         }
         $portocoment = $this->shippingcomment;
         if ($this->checkMinOrder($price)) {
             $portocoment = IDEALO_CSV_MIN_ORDER . number_format($this->minOrder, 2, '.', '') . ' EUR';
         }
         if ($this->minOrderPrice != '') {
             if ($this->checkMinExtraPrice($price)) {
                 $portocoment = number_format($this->minOrderPrice, 2, '.', '') . IDEALO_CSV_MIN_ORDER_EXTRA_PRICE . number_format($this->minorderBorder, 2, '.', '') . IDEALO_CSV_SUM;
             }
         }
         $schema .= $quotarchar . $this->checkSeparator($portocoment, $separator) . $quotarchar . $separator;
         foreach ($this->shipping as $ship) {
             if ($ship['active'] == '1') {
                 $costs = $this->getShippingCosts($price, (double) $weight, $ship);
             }
             foreach ($this->payment as $payment) {
                 if ($payment['active'] == '1' && $this->paymentAllowed($ship['country'], $payment['country']) === true) {
                     $schema .= $quotarchar . $this->getPaymentCosts($payment, $ship['country'], $price, $costs) . $quotarchar . $separator;
                 }
             }
         }
         if ($this->minOrderPrice != '') {
             if ($this->checkMinExtraPrice($price)) {
                 $schema .= $quotarchar . number_format($this->minOrderPrice, 2, '.', '') . $quotarchar . $separator;
             } else {
                 $schema .= $quotarchar . '0.00' . $this->quoting . $quotarchar . $separator;
             }
         }
         $schema .= $quotarchar . $this->checkSeparator($extraName . $this->quoting, $separator) . $quotarchar . $separator;
         if (file_exists(DIR_FS_CATALOG . 'gm/classes/GMSEOBoost.php')) {
             $gmSeo = new GMSEOBoost();
             $seoURL = $gmSeo->get_boosted_product_url($id, $products['products_name'], $_SESSION['languages_id']);
             $schema .= $quotarchar . $this->shop_url . DIR_WS_CATALOG . $seoURL . $quotarchar . $separator;
         }
         if ($this->hanExists) {
             $schema .= IDEALO_CSV_QUOTECHAR . $this->getHAN($id) . IDEALO_CSV_QUOTECHAR . IDEALO_CSV_SEPARATOR;
         }
         if ($this->codeMpnExists) {
             $schema .= IDEALO_CSV_QUOTECHAR . $this->getValueTableProductsItemCodes($id, 'code_mpn') . IDEALO_CSV_QUOTECHAR . IDEALO_CSV_SEPARATOR;
         }
         if ($this->googleExportConditionExists) {
             $condition = $this->getValueTableProductsItemCodes($id, 'google_export_condition');
             if ($condition == '') {
                 $condition = 'neu';
             }
             $schema .= IDEALO_CSV_QUOTECHAR . $condition . IDEALO_CSV_QUOTECHAR . IDEALO_CSV_SEPARATOR;
         }
         $schema .= "\n";
     } else {
         $schema = '';
     }
     return $schema;
 }
Example #16
0
 public function getXMLValues($variant, $id, $extraName = '', $exrtaPrice = 0, $extraWeight = 0, $optionNumer = '', $stock = '')
 {
     $xml = '';
     $db_tolls = new idealo_db_tools_realtime();
     $db_tolls->checkAll();
     $products = $this->getArticle($id);
     $products_price = $products['products_price'] + $exrtaPrice;
     $products_price = $this->getPrice($products['products_tax_class_id'], $products['products_price'], $id);
     $tax = $this->getTax($products['products_tax_class_id'], $id);
     $exrtaPrice = $exrtaPrice * (1 + $tax / 100);
     $products_price = $products_price + $exrtaPrice;
     if ((double) $products['products_discount_allowed'] > 0.0) {
         $products_price = $products_price * (1 - $products['products_discount_allowed'] / 100);
     }
     $categorie_query = xtc_db_query("\tSELECT\n\t                                            categories_id\n\t                                            FROM " . TABLE_PRODUCTS_TO_CATEGORIES . "\n\t                                            WHERE products_id = '" . $products['products_id'] . "'\n\t                                            ORDER BY categories_id DESC;");
     $categories = '0';
     while ($categorie_data = xtc_db_fetch_array($categorie_query)) {
         if ($categorie_data['categories_id'] != '0') {
             $categories = $categorie_data['categories_id'];
         }
     }
     $cat = $this->buildCAT($categories, $id);
     $export = true;
     if ($this->warehouse === true) {
         if ($variant == 1) {
             if ($stock == 0) {
                 $export = false;
             }
         } elseif ((double) $products['products_quantity'] <= (double) 0) {
             $export = false;
         }
     }
     if ($products['products_status'] == 1 && $products_price > 0.0 && $this->filter($id, $products['manufacturers_name']) === true && $this->filterCat($cat) === true && $export) {
         $language = 'de';
         $language_id = xtc_db_query("SELECT `languages_id`\n\t\t\t\t\t\t\t\t\t\t  FROM `languages`\n\t\t\t\t\t\t\t\t\t\t  WHERE `code` LIKE '" . $language . "';");
         $language_id = xtc_db_fetch_array($language_id);
         if ($optionNumer != '') {
             $sku = $id . '-' . $optionNumer;
         } else {
             $sku = $id;
         }
         $url = $this->shop_url . DIR_WS_CATALOG . 'product_info.php?' . xtc_product_link($products['products_id'], $products['products_name']);
         if ($this->campaignSet === true) {
             $url .= IDEALO_CAMPAIGN;
         }
         $price = number_format($products_price, 2, '.', '');
         if ($products['products_image'] != '') {
             $image = $this->shop_url . $this->image_url . $products['products_image'];
         } else {
             $image = '';
         }
         $xml .= '<offer>' . '<command>InsertOrReplace</command>' . '<sku><![CDATA[' . $sku . ']]></sku>' . '<title><![CDATA[' . $this->cleanText($products['products_name'] . ' ' . $extraName, 200, $this->textdecode) . ']]></title>' . '<url><![CDATA[' . $this->cleanText($url, 300, $this->textdecode) . ']]></url>' . '<price>' . $price . '</price>' . '<category><![CDATA[' . $cat . ']]></category>';
         if ($image != '') {
             $xml .= '<image><![CDATA[' . $image . ']]></image>';
         }
         if ($products['manufacturers_name'] != '') {
             $xml .= '<brand><![CDATA[' . $this->cleanText($products['manufacturers_name'], 100, $this->textdecode) . ']]></brand>';
         }
         if ($products['products_description'] != '') {
             $products['products_description'] = $this->prepareText($products['products_description']);
             $xml .= '<description><![CDATA[' . $this->cleanText($products['products_description'], 1000, $this->textdecode) . ']]></description>';
         }
         $shippingTime = $this->getShippingTime($products['products_shippingtime'], $language_id['languages_id']);
         if ($shippingTime != '') {
             $xml .= '<delivery><![CDATA[' . $this->cleanText($shippingTime, 100, $this->textdecode) . ']]></delivery>';
         }
         if ($this->checkEan($products['products_ean'])) {
             $xml .= '<ean><![CDATA[' . $products['products_ean'] . ']]></ean>';
         }
         if ($products['products_vpe_status'] == '1' && (double) $products['products_vpe_value'] > 0) {
             $vpe = $this->getVPE($products['products_vpe'], $language_id['languages_id']);
             $xml .= '<basePrice measure="' . $vpe['measure'] . '" unit="' . $this->cleanText($vpe['unit'], 100, $this->textdecode) . '">0.99</basePrice>';
         }
         foreach ($this->shipping as $ship) {
             if ($ship['active'] == '1') {
                 $costs = $this->getShippingCosts($price, $products['products_weight'], $ship);
                 if ($this->minOrderPrice != '') {
                     if ($this->checkMinExtraPrice($price)) {
                         $costs = $costs + $this->minOrderPrice;
                     }
                 }
             }
             foreach ($this->payment as $payment) {
                 if ($payment['active'] == '1') {
                     $payment_coutry = 'DE';
                     if ($payment['country'] == '1') {
                         $payment_coutry = 'DE';
                     }
                     if ($payment['country'] == '2') {
                         $payment_coutry = 'AT';
                     }
                     if ($payment['country'] == '3') {
                         $payment_coutry = 'DE/AT';
                     }
                     if (strpos($payment_coutry, $ship['country']) !== false) {
                         $xml .= '<shipping context="' . $ship['country'] . '" type="' . $payment['db'] . '">' . $this->getPaymentCosts($payment, $ship['title'], $price, $costs) . '</shipping>';
                     }
                 }
             }
         }
         $portocoment = $this->shippingcomment;
         if ($this->checkMinOrder($price)) {
             $portocoment = IDEALO_REALTIME_MIN_ORDER . number_format($this->minOrder, 2, '.', '') . ' EUR';
         }
         if ($this->minOrderPrice != '') {
             if ($this->checkMinExtraPrice($price)) {
                 $portocoment = number_format($this->minOrderPrice, 2, '.', '') . IDEALO_REALTIME_MIN_ORDER_EXTRA_PRICE . number_format($this->idealoMinorderBorder, 2, '.', '') . IDEALO_REALTIME_SUM;
             }
         }
         $xml .= '<shippingComment><![CDATA[' . $this->cleanText($portocoment, 100, $this->textdecode) . ']]></shippingComment>';
         if ($extraName != '') {
             $attribute_array = explode(';', $extraName);
             if (count($attribute_array) > 0) {
                 $xml .= '<attributes>';
                 foreach ($attribute_array as $attr_array) {
                     $attr_array = explode(':', $attr_array);
                     $xml .= '<attribute name="' . $this->cleanText($attr_array[0], 50, $this->textdecode) . '">' . '<value>' . $this->cleanText($attr_array[1], 50, $this->textdecode) . '</value>' . '</attribute>';
                 }
                 $xml .= '</attributes>>';
             }
         }
         if ($this->hanExists || $this->codeMpnExists) {
             $hanInDb = '';
             if ($this->hanExists) {
                 $hanInDb = $db_tolls->getHAN($id);
             }
             if ($this->codeMpnExists) {
                 $hanInDb = $db_tolls->getValueTableProductsItemCodes($id, 'code_mpn');
             }
             $xml .= '<han><![CDATA[' . $hanInDb . ']]></han>';
         }
         $xml .= '</offer>';
     } elseif ($id != '') {
         if ($optionNumer != '') {
             $sku = $id . '-' . $optionNumer;
         } else {
             $sku = $id;
         }
         $sxml .= $this->deleteProductAtIdealo($sku);
     }
     return $xml;
 }
    $prev_id = $actual_key - 1;
    $prev_link = xtc_href_link(FILENAME_PRODUCT_INFO, xtc_product_link($p_data[$prev_id]['pID'], $p_data[$prev_id]['pName']));
    // check if prev id = first
    if ($prev_id != 0) {
        $first_link = xtc_href_link(FILENAME_PRODUCT_INFO, xtc_product_link($p_data[0]['pID'], $p_data[0]['pName']));
    }
}
// check if key = last
if ($actual_key == sizeof($p_data) - 1) {
    // actual key is last
} else {
    $next_id = $actual_key + 1;
    $next_link = xtc_href_link(FILENAME_PRODUCT_INFO, xtc_product_link($p_data[$next_id]['pID'], $p_data[$next_id]['pName']));
    // check if next id = last
    if ($next_id != sizeof($p_data) - 1) {
        $last_link = xtc_href_link(FILENAME_PRODUCT_INFO, xtc_product_link($p_data[sizeof($p_data) - 1]['pID'], $p_data[sizeof($p_data) - 1]['pName']));
    }
}
$overview_link = xtc_href_link(FILENAME_DEFAULT, xtc_category_link($current_category_id));
$module_smarty->assign('FIRST', $first_link);
$module_smarty->assign('PREVIOUS', $prev_link);
$module_smarty->assign('OVERVIEW', $overview_link);
$module_smarty->assign('NEXT', $next_link);
$module_smarty->assign('LAST', $last_link);
// BOF - Tomcraft - 2010-05-02 - Show actual product count in product_navigator
$module_smarty->assign('ACTUAL_PRODUCT', $actual_key + 1);
// EOF - Tomcraft - 2010-05-02 - Show actual product count in product_navigator
$module_smarty->assign('PRODUCTS_COUNT', count($p_data));
$module_smarty->assign('language', $_SESSION['language']);
$module_smarty->caching = 0;
$product_navigator = $module_smarty->fetch(CURRENT_TEMPLATE . '/module/product_navigator.html');
 function get_redirect_url($inline = false)
 {
     /**
      * Create Rakuten Checkout Insert Cart XML request
      */
     $xml = new SimpleXMLElement("<?xml version='1.0' encoding='UTF-8' ?><tradoria_insert_cart />");
     $merchantAuth = $xml->addChild('merchant_authentication');
     $merchantAuth->addChild('project_id', MODULE_PAYMENT_RAKUTEN_PROJECT_ID);
     $merchantAuth->addChild('api_key', MODULE_PAYMENT_RAKUTEN_API_KEY);
     $xml->addChild('language', 'DE');
     // TODO: add list of available languages and check if current language is supported
     $xml->addChild('currency', $_SESSION['currency']);
     // TODO: check currencies
     $merchantCart = $xml->addChild('merchant_carts')->addChild('merchant_cart');
     $merchantCart->addChild('custom_1', xtc_session_name());
     $merchantCart->addChild('custom_2', xtc_session_id());
     $merchantCart->addChild('custom_3', $_SESSION['customer_id']);
     $merchantCart->addChild('custom_4');
     $merchantCartItems = $merchantCart->addChild('items');
     if ($_SESSION['cart']->count_contents() > 0) {
         $products = $_SESSION['cart']->get_products();
         for ($i = 0, $n = sizeof($products); $i < $n; $i++) {
             $t_image = '';
             if ($products[$i]['image'] != '') {
                 $t_image = HTTP_SERVER . DIR_WS_CATALOG . DIR_WS_THUMBNAIL_IMAGES . $products[$i]['image'];
             }
             $merchantCartItemsItem = $merchantCartItems->addChild('item');
             $merchantCartItemsItemName = $merchantCartItemsItem->addChild('name');
             $this->_add_CDATA($merchantCartItemsItemName, $products[$i]['name']);
             $merchantCartItemsItem->addChild('sku', $this->_escape_str($products[$i]['model']));
             $merchantCartItemsItem->addChild('external_product_id', $this->_escape_str($products[$i]['id']));
             $merchantCartItemsItem->addChild('qty', $products[$i]['quantity']);
             $merchantCartItemsItem->addChild('unit_price', $products[$i]['price']);
             $merchantCartItemsItem->addChild('tax_class', $this->get_rakuten_tax_class($products[$i]['tax_class_id']));
             $merchantCartItemsItem->addChild('image_url', $this->_escape_str($t_image));
             $product_url = xtc_href_link(FILENAME_PRODUCT_INFO, xtc_product_link($products[$i]['id'], $products[$i]['name']));
             $merchantCartItemsItem->addChild('product_url', $this->_escape_str($product_url));
             $comment = array();
             if (isset($products[$i]['attributes'])) {
                 while (list($option, $value) = each($products[$i]['attributes'])) {
                     $attributes = xtc_db_query("select popt.products_options_name, poval.products_options_values_name, pa.options_values_price, pa.price_prefix,pa.attributes_stock,pa.products_attributes_id,pa.attributes_model,pa.weight_prefix,pa.options_values_weight\n                                                              from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_OPTIONS_VALUES . " poval, " . TABLE_PRODUCTS_ATTRIBUTES . " pa\n                                                              where pa.products_id = '" . (int) $products[$i]['id'] . "'\n                                                               and pa.options_id = '" . (int) $option . "'\n                                                               and pa.options_id = popt.products_options_id\n                                                               and pa.options_values_id = '" . (int) $value . "'\n                                                               and pa.options_values_id = poval.products_options_values_id\n                                                               and popt.language_id = '" . (int) $_SESSION['languages_id'] . "'\n                                                               and poval.language_id = '" . (int) $_SESSION['languages_id'] . "'");
                     $attributes_values = xtc_db_fetch_array($attributes);
                     $comment[] = $attributes_values['products_options_name'] . ': ' . $attributes_values['products_options_values_name'];
                 }
             }
             $comment = implode('; ', $comment);
             $merchantCartItemsItemComment = $merchantCartItemsItem->addChild('comment');
             $this->_add_CDATA($merchantCartItemsItemComment, $comment);
             $merchantCartItemsItemCustom = $merchantCartItemsItem->addChild('custom');
             $this->_add_CDATA($merchantCartItemsItemCustom, $products[$i]['id']);
         }
     }
     $merchantCartShippingRates = $merchantCart->addChild('shipping_rates');
     $shippingRates = $this->_str_get_csv(MODULE_PAYMENT_RAKUTEN_SHIPPING_RATES);
     foreach ($shippingRates as $shippingRate) {
         if (isset($shippingRate[0]) && isset($shippingRate[1]) && is_numeric($shippingRate[1])) {
             $merchantCartShippingRate = $merchantCartShippingRates->addChild('shipping_rate');
             $merchantCartShippingRate->addChild('country', (string) $shippingRate[0]);
             $merchantCartShippingRate->addChild('price', (double) $shippingRate[1]);
             if (isset($shippingRate[2]) && (int) $shippingRate[2] > 0) {
                 $merchantCartShippingRate->addChild('delivery_date', date('Y-m-d', strtotime('+' . (int) $shippingRate[2] . ' days')));
             }
         }
     }
     $billingAddressRestrictions = $xml->addChild('billing_address_restrictions');
     // restrict invoice address to require private / commercial and by country
     switch (MODULE_PAYMENT_RAKUTEN_BILLING_ADDR_TYPE) {
         // 1=all 2=business 3=private
         case 'All Addresses':
             $billingAddressRestrictions->addChild('customer_type')->addAttribute('allow', 1);
             break;
         case 'Business Addresses Only':
             $billingAddressRestrictions->addChild('customer_type')->addAttribute('allow', 2);
             break;
         case 'Private Addresses Only':
             $billingAddressRestrictions->addChild('customer_type')->addAttribute('allow', 3);
             break;
     }
     $xml->addChild('callback_url', $this->ROCKBACK_URL);
     $xml->addChild('pipe_url', $this->PIPE_URL);
     $request = $xml->asXML();
     $response = $this->send_request($request);
     $redirectUrl = false;
     $inlineUrl = false;
     $inlineCode = false;
     try {
         $response = new SimpleXMLElement($response);
         if ($response->success != 'true') {
             throw new Exception((string) $response->message, (int) $response->code);
         } else {
             $redirectUrl = $response->redirect_url;
             $inlineUrl = $response->inline_url;
             $inlineCode = $response->inline_code;
         }
     } catch (Exception $e) {
         xtc_redirect(sprintf($this->ERROR_URL, urlencode($e->getCode()), urlencode($e->getMessage())));
     }
     if ($inline) {
         return $inlineCode;
     } else {
         return $redirectUrl;
     }
 }
 function get_html($p_products_array)
 {
     $coo_properties_control = MainFactory::create_object('PropertiesControl');
     $coo_properties_view = MainFactory::create_object('PropertiesView');
     $t_content_array = array();
     $module_content = array();
     $any_out_of_stock = '';
     $mark_stock = '';
     $coo_seo_boost = MainFactory::create_object('GMSEOBoost');
     $coo_main = new main();
     $xtPrice = new xtcPrice($_SESSION['currency'], $_SESSION['customers_status']['customers_status_id']);
     for ($i = 0, $n = sizeof($p_products_array); $i < $n; $i++) {
         $t_combis_id = $coo_properties_control->extract_combis_id($p_products_array[$i]['id']);
         // check if combis_id is empty
         if ($t_combis_id == '') {
             // combis_id is empty = article without properties
             if (STOCK_CHECK == 'true') {
                 $mark_stock = xtc_check_stock($p_products_array[$i]['id'], $p_products_array[$i]['quantity']);
                 if ($mark_stock) {
                     $_SESSION['any_out_of_stock'] = 1;
                 }
             }
         }
         $image = '';
         if ($p_products_array[$i]['image'] != '') {
             $image = DIR_WS_THUMBNAIL_IMAGES . $p_products_array[$i]['image'];
         }
         //bof gm
         $gm_products_id = $p_products_array[$i]['id'];
         $gm_products_id = str_replace('{', '_', $gm_products_id);
         $gm_products_id = str_replace('}', '_', $gm_products_id);
         $gm_query = xtc_db_query("SELECT gm_show_weight FROM products WHERE products_id='" . $p_products_array[$i]['id'] . "'");
         $gm_array = xtc_db_fetch_array($gm_query);
         if (empty($gm_array['gm_show_weight'])) {
             $p_products_array[$i]['gm_weight'] = 0;
         }
         $gm_product_link = xtc_href_link(FILENAME_PRODUCT_INFO, xtc_product_link($p_products_array[$i]['id'], $p_products_array[$i]['name']) . '&no_boost=1');
         include DIR_FS_CATALOG . 'gm/modules/gm_gprint_order_details_cart.php';
         $t_shipping_time = $p_products_array[$i]['shipping_time'];
         $t_products_weight = $p_products_array[$i]['gm_weight'];
         $t_products_model = $p_products_array[$i]['model'];
         #properties
         if ($t_combis_id != '') {
             $t_properties_html = $coo_properties_view->get_order_details_by_combis_id($t_combis_id, 'cart');
             $coo_products = MainFactory::create_object('GMDataObject', array('products', array('products_id' => $p_products_array[$i]['id'])));
             $use_properties_combis_quantity = $coo_products->get_data_value('use_properties_combis_quantity');
             if ($use_properties_combis_quantity == 1) {
                 // check article quantity
                 $mark_stock = xtc_check_stock($p_products_array[$i]['id'], $p_products_array[$i]['quantity']);
                 if ($mark_stock) {
                     $_SESSION['any_out_of_stock'] = 1;
                 }
             } else {
                 if ($use_properties_combis_quantity == 0 && ATTRIBUTE_STOCK_CHECK == 'true' && STOCK_CHECK == 'true' || $use_properties_combis_quantity == 2) {
                     // check combis quantity
                     $t_properties_stock = $coo_properties_control->get_properties_combis_quantity($t_combis_id);
                     if ($t_properties_stock < $p_products_array[$i]['quantity']) {
                         $_SESSION['any_out_of_stock'] = 1;
                         $mark_stock = '<span class="markProductOutOfStock">' . STOCK_MARK_PRODUCT_OUT_OF_STOCK . '</span>';
                     }
                 }
             }
             $t_weight = $coo_properties_control->get_properties_combis_weight($t_combis_id);
             if ($coo_products->get_data_value('use_properties_combis_weight') == 1) {
                 $t_products_weight = gm_prepare_number($t_weight, $xtPrice->currencies[$xtPrice->actualCurr]['decimal_point']);
             } else {
                 $t_products_weight = gm_prepare_number($t_weight + $p_products_array[$i]['weight'], $xtPrice->currencies[$xtPrice->actualCurr]['decimal_point']);
             }
             if ($coo_products->get_data_value('use_properties_combis_shipping_time') == 1) {
                 $t_shipping_time = $coo_properties_control->get_properties_combis_shipping_time($t_combis_id);
             }
             $t_combi_model = $coo_properties_control->get_properties_combis_model($t_combis_id);
             if (APPEND_PROPERTIES_MODEL == "true") {
                 // Artikelnummer (Kombi) an Artikelnummer (Artikel) anhängen
                 if ($t_products_model != '' && $t_combi_model != '') {
                     $t_products_model = $t_products_model . '-' . $t_combi_model;
                 } else {
                     if ($t_combi_model != '') {
                         $t_products_model = $t_combi_model;
                     }
                 }
             } else {
                 // Artikelnummer (Artikel) durch Artikelnummer (Kombi) ersetzen
                 if ($t_combi_model != '') {
                     $t_products_model = $t_combi_model;
                 }
             }
         } else {
             $t_properties_html = '';
         }
         $module_content[$i] = array('PRODUCTS_NAME' => $p_products_array[$i]['name'] . $mark_stock, 'PRODUCTS_QTY' => xtc_draw_input_field('cart_quantity[]', gm_convert_qty($p_products_array[$i]['quantity'], false), ' size="2" onblur="gm_qty_is_changed(' . $p_products_array[$i]['quantity'] . ', this.value, \'' . GM_QTY_CHANGED_MESSAGE . '\')"', 'text', true, "gm_cart_data gm_class_input") . xtc_draw_hidden_field('products_id[]', $p_products_array[$i]['id'], 'class="gm_cart_data"') . xtc_draw_hidden_field('old_qty[]', $p_products_array[$i]['quantity']), 'PRODUCTS_OLDQTY_INPUT_NAME' => 'old_qty[]', 'PRODUCTS_QTY_INPUT_NAME' => 'cart_quantity[]', 'PRODUCTS_QTY_VALUE' => gm_convert_qty($p_products_array[$i]['quantity'], false), 'PRODUCTS_ID_INPUT_NAME' => 'products_id[]', 'PRODUCTS_ID_EXTENDED' => $p_products_array[$i]['id'], 'PRODUCTS_MODEL' => $t_products_model, 'SHOW_PRODUCTS_MODEL' => SHOW_PRODUCTS_MODEL, 'PRODUCTS_SHIPPING_TIME' => $t_shipping_time, 'PRODUCTS_TAX' => (double) $p_products_array[$i]['tax'], 'PRODUCTS_IMAGE' => $image, 'IMAGE_ALT' => $p_products_array[$i]['name'], 'BOX_DELETE' => xtc_draw_checkbox_field('cart_delete[]', $p_products_array[$i]['id'], false, 'id="gm_delete_product_' . $gm_products_id . '"'), 'PRODUCTS_LINK' => $gm_product_link, 'PRODUCTS_PRICE' => $xtPrice->xtcFormat($p_products_array[$i]['price'] * $p_products_array[$i]['quantity'], true), 'PRODUCTS_SINGLE_PRICE' => $xtPrice->xtcFormat($p_products_array[$i]['price'], true), 'PRODUCTS_SHORT_DESCRIPTION' => xtc_get_short_description($p_products_array[$i]['id']), 'ATTRIBUTES' => '', 'PROPERTIES' => $t_properties_html, 'GM_WEIGHT' => $t_products_weight, 'PRODUCTS_ID' => $gm_products_id, 'UNIT' => $p_products_array[$i]['unit_name']);
         //eof gm
         // Product options names
         $attributes_exist = isset($p_products_array[$i]['attributes']) ? 1 : 0;
         if ($attributes_exist == 1) {
             reset($p_products_array[$i]['attributes']);
             while (list($option, $value) = each($p_products_array[$i]['attributes'])) {
                 if (ATTRIBUTE_STOCK_CHECK == 'true' && STOCK_CHECK == 'true' && $value != 0) {
                     $attribute_stock_check = xtc_check_stock_attributes($p_products_array[$i][$option]['products_attributes_id'], $p_products_array[$i]['quantity']);
                     if ($attribute_stock_check) {
                         $_SESSION['any_out_of_stock'] = 1;
                     }
                 }
                 $module_content[$i]['ATTRIBUTES'][] = array('ID' => $p_products_array[$i][$option]['products_attributes_id'], 'MODEL' => xtc_get_attributes_model(xtc_get_prid($p_products_array[$i]['id']), $p_products_array[$i][$option]['products_options_values_name'], $p_products_array[$i][$option]['products_options_name']), 'NAME' => $p_products_array[$i][$option]['products_options_name'], 'VALUE_NAME' => $p_products_array[$i][$option]['products_options_values_name'] . $attribute_stock_check);
                 // BOF GM_MOD GX-Customizer:
                 require DIR_FS_CATALOG . 'gm/modules/gm_gprint_order_details_cart_2.php';
             }
         }
     }
     $total_content = '';
     $total = $_SESSION['cart']->show_total();
     if ($_SESSION['customers_status']['customers_status_ot_discount_flag'] == '1' && $_SESSION['customers_status']['customers_status_ot_discount'] != '0.00') {
         if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 0 && $_SESSION['customers_status']['customers_status_add_tax_ot'] == 1) {
             $price = $total - $_SESSION['cart']->show_tax(false);
         } else {
             $price = $total;
         }
         // BOF GM_MOD
         $discount = round($xtPrice->xtcGetDC($price, $_SESSION['customers_status']['customers_status_ot_discount']), 2);
         $total_content = $_SESSION['customers_status']['customers_status_ot_discount'] . ' % ' . SUB_TITLE_OT_DISCOUNT . ' -' . xtc_format_price($discount, $price_special = 1, $calculate_currencies = false) . '<br />';
         $this->set_content_data('DISCOUNT_TEXT', round((double) $_SESSION['customers_status']['customers_status_ot_discount'], 2) . '% ' . SUB_TITLE_OT_DISCOUNT);
         $this->set_content_data('DISCOUNT_VALUE', '-' . xtc_format_price($discount, $price_special = 1, $calculate_currencies = false));
     }
     if ($_SESSION['customers_status']['customers_status_show_price'] == '1') {
         if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 0 && $_SESSION['customers_status']['customers_status_add_tax_ot'] == 0) {
             $total -= $discount;
         }
         if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 0 && $_SESSION['customers_status']['customers_status_add_tax_ot'] == 1) {
             $total -= $discount;
         }
         if ($_SESSION['customers_status']['customers_status_show_price_tax'] == 1) {
             $total -= $discount;
         }
         $total_content .= SUB_TITLE_SUB_TOTAL . $xtPrice->xtcFormat($total, true) . '<br />';
         $t_total = $xtPrice->xtcFormat($total + $discount, true);
     } else {
         $total_content .= NOT_ALLOWED_TO_SEE_PRICES . '<br />';
     }
     // display only if there is an ot_discount
     if ($customer_status_value['customers_status_ot_discount'] != 0) {
         $total_content .= TEXT_CART_OT_DISCOUNT . $customer_status_value['customers_status_ot_discount'] . '%';
     }
     if (SHOW_SHIPPING == 'true') {
         $this->set_content_data('SHIPPING_INFO', ' ' . SHIPPING_EXCL . '<a href="' . $coo_main->gm_get_shipping_link(true) . '" target="_blank" class="lightbox_iframe"> ' . SHIPPING_COSTS . '</a>');
     }
     if ($_SESSION['customers_status']['customers_status_show_price'] == '1') {
         $gm_cart_tax_info = '';
         if (gm_get_conf('TAX_INFO_TAX_FREE') == 'true') {
             $gm_cart_tax_info = GM_TAX_FREE . '<br />';
             $this->set_content_data('TAX_FREE_TEXT', GM_TAX_FREE);
         } else {
             $gm_cart_tax_info = $_SESSION['cart']->show_tax();
             if (!empty($gm_cart_tax_info) && $_SESSION['customers_status']['customers_status_show_price_tax'] == '0' && $_SESSION['customers_status']['customers_status_add_tax_ot'] == '1') {
                 if (!defined(MODULE_ORDER_TOTAL_SUBTOTAL_TITLE_NO_TAX)) {
                     include_once DIR_FS_CATALOG . 'lang/' . $_SESSION['language'] . '/modules/order_total/ot_subtotal.php';
                 }
                 $t_gm_tax = 0;
                 foreach ($_SESSION['cart']->tax as $t_gm_key => $t_gm_value) {
                     $t_gm_tax += $t_gm_value['value'];
                 }
                 $gm_cart_tax_info = MODULE_ORDER_TOTAL_SUBTOTAL_TITLE_NO_TAX . ': ' . $xtPrice->xtcFormat((double) $total - (double) $t_gm_tax, true) . '<br />' . $gm_cart_tax_info;
                 $t_total = $xtPrice->xtcFormat((double) $total - (double) $t_gm_tax + $discount, true);
             }
         }
         $this->set_content_data('UST_CONTENT', $gm_cart_tax_info, 1);
     }
     $t_taxes_data_array = explode('<br />', $_SESSION['cart']->show_tax(true));
     $t_tax_array = array();
     for ($i = 0; $i < count($t_taxes_data_array); $i++) {
         if (!empty($t_taxes_data_array[$i])) {
             $t_tax_data_array = explode(':', $t_taxes_data_array[$i]);
             $t_tax_array[] = array('TEXT' => $t_tax_data_array[0], 'VALUE' => $t_tax_data_array[1]);
         }
     }
     $this->set_content_data('tax_data', $t_tax_array);
     $this->set_content_data('SUBTOTAL', $t_total);
     $this->set_content_data('TOTAL', $xtPrice->xtcFormat($total, true));
     $this->set_content_data('TOTAL_CONTENT', $total_content, 1);
     $this->set_content_data('language', $_SESSION['language']);
     $this->set_content_data('module_content', $module_content);
     $coo_gift_cart = MainFactory::create_object('GiftCartContentView');
     $t_view_html = $coo_gift_cart->get_html();
     $this->set_content_data('MODULE_gift_cart', $t_view_html);
     // Bitcoin Payment - Commerce Coding - BEGIN
     $multiplier = 1;
     $digits = 8;
     switch (MODULE_PAYMENT_BITCOIN_UNITS) {
         case 'uBTC':
             $multiplier *= 1000;
             $digits -= 3;
         case 'mBTC':
             $multiplier *= 1000;
             $digits -= 3;
         case 'BTC':
             $btcPrice = number_format($total / MODULE_PAYMENT_BITCOIN_BTCEUR * $multiplier, $digits, '.', '');
             $this->set_content_data('BITCOIN_PRICE', $btcPrice . ' ' . MODULE_PAYMENT_BITCOIN_UNITS);
     }
     // Bitcoin Payment - Commerce Coding - END
     $t_html_output = $this->build_html();
     return $t_html_output;
 }
Example #20
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;
     }
 }
    $link_index = HEADER_TITLE_TOP;
} else {
    $breadcrumb->add(HEADER_TITLE_TOP, xtc_href_link('../'));
    $breadcrumb->add(HEADER_TITLE_CATALOG, xtc_href_link(FILENAME_DEFAULT));
    $link_index = HEADER_TITLE_CATALOG;
}
// add category names or the manufacturer name to the breadcrumb trail
if (isset($cPath_array)) {
    for ($i = 0, $n = sizeof($cPath_array); $i < $n; $i++) {
        $group_check = '';
        if (GROUP_CHECK == 'true') {
            $group_check = "AND c.group_permission_" . $_SESSION['customers_status']['customers_status_id'] . "=1 ";
        }
        $categories_query = xtDBquery("-- /includes/application_top.php\n                                   SELECT cd.categories_name\n                                     FROM " . TABLE_CATEGORIES_DESCRIPTION . " cd,\n                                          " . TABLE_CATEGORIES . " c\n                                    WHERE cd.categories_id = '" . $cPath_array[$i] . "'\n                                      AND c.categories_id=cd.categories_id\n                                          " . $group_check . "\n                                      AND cd.language_id='" . (int) $_SESSION['languages_id'] . "'");
        if (xtc_db_num_rows($categories_query, true) > 0) {
            $categories = xtc_db_fetch_array($categories_query, true);
            $breadcrumb->add($categories['categories_name'], xtc_href_link(FILENAME_DEFAULT, xtc_category_link($cPath_array[$i], $categories['categories_name'])));
        } else {
            break;
        }
    }
} elseif (isset($_GET['manufacturers_id']) && xtc_not_null($_GET['manufacturers_id'])) {
    $_GET['manufacturers_id'] = (int) $_GET['manufacturers_id'];
    $manufacturers_query = xtDBquery("-- /includes/application_top.php\n                                    SELECT manufacturers_name \n                                      FROM " . TABLE_MANUFACTURERS . " \n                                     WHERE manufacturers_id = '" . (int) $_GET['manufacturers_id'] . "'");
    $manufacturers = xtc_db_fetch_array($manufacturers_query, true);
    $breadcrumb->add($manufacturers['manufacturers_name'], xtc_href_link(FILENAME_DEFAULT, xtc_manufacturer_link((int) $_GET['manufacturers_id'], $manufacturers['manufacturers_name'])));
}
// add the products model/name to the breadcrumb trail
if ($product->isProduct()) {
    $breadcrumb->add($product->data['products_name'], xtc_href_link(FILENAME_PRODUCT_INFO, xtc_product_link($product->data['products_id'], $product->data['products_name'])));
}
Example #22
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;
     }
 }
if (!$product->isProduct()) {
    $smarty->assign('error', ERROR_INVALID_PRODUCT);
} else {
    $name = "";
    if (isset($customer_info['customers_firstname']) && $customer_info['customers_firstname'] != '') {
        $name .= $customer_info['customers_firstname'] . ' ';
    }
    if (isset($customer_info['customers_lastname']) && $customer_info['customers_lastname'] != '') {
        $name .= $customer_info['customers_lastname'];
    }
    if ($name == "") {
        $name = TEXT_GUEST;
    }
    $smarty->assign('PRODUCTS_NAME', $product->data['products_name']);
    $smarty->assign('AUTHOR', $name);
    $smarty->assign('INPUT_TEXT', xtc_draw_textarea_field('review', 'soft', 60, 15, '', '', false));
    $smarty->assign('INPUT_RATING', xtc_draw_radio_field('rating', '1') . ' ' . xtc_draw_radio_field('rating', '2') . ' ' . xtc_draw_radio_field('rating', '3') . ' ' . xtc_draw_radio_field('rating', '4') . ' ' . xtc_draw_radio_field('rating', '5'));
    $smarty->assign('FORM_ACTION', xtc_draw_form('product_reviews_write', xtc_href_link(FILENAME_PRODUCT_REVIEWS_WRITE, 'action=process&' . xtc_product_link($product->data['products_id'], $product->data['products_name'])), 'post', 'onSubmit="return checkForm();"'));
    $smarty->assign('BUTTON_BACK', '<a href="javascript:history.back(1)">' . xtc_image_button('button_back.gif', IMAGE_BUTTON_BACK) . '</a>');
    $smarty->assign('BUTTON_SUBMIT', xtc_image_submit('button_continue.gif', IMAGE_BUTTON_CONTINUE) . xtc_draw_hidden_field('get_params', $get_params));
    $smarty->assign('FORM_END', '</form>');
}
$smarty->assign('language', $_SESSION['language']);
$main_content = $smarty->fetch(CURRENT_TEMPLATE . '/module/product_reviews_write.html');
$smarty->assign('main_content', $main_content);
$smarty->caching = 0;
if (!defined('RM')) {
    $smarty->load_filter('output', 'note');
}
$smarty->display(CURRENT_TEMPLATE . '/index.html');
include 'includes/application_bottom.php';
    $smarty->assign('error', $messageStack->output('checkout_payment'));
}
if ($order->info['payment_method'] != 'no_payment' && $order->info['payment_method'] != '') {
    include_once DIR_WS_LANGUAGES . '/' . $_SESSION['language'] . '/modules/payment/' . $order->info['payment_method'] . '.php';
    //Dokuman - 2012-05-31 - fix paypal_checkout notices
    $smarty->assign('PAYMENT_METHOD', constant('MODULE_PAYMENT_' . strtoupper($order->info['payment_method']) . '_TEXT_TITLE'));
}
require_once DIR_FS_INC . 'xtc_get_products_image.inc.php';
$temp_prods = $order->products;
//BOF - DokuMan - 2011-12-19 - precount for performance
//for ($i=0, $n=sizeof($temp_prods); $i<$n; $i++) {
$n = sizeof($temp_prods);
for ($i = 0; $i < $n; $i++) {
    //EOF - DokuMan - 2011-12-19 - precount for performance
    //	$temp_prods[$i]['details']='&nbsp;&#187;<a style="cursor:pointer" onclick="javascript:window.open(\''.xtc_href_link(FILENAME_PRINT_PRODUCT_INFO, 'products_id='.$temp_prods[$i]['id']).'\', \'popup\', \'toolbar=0, width=640, height=600\')" alt="" /><small>Details</small></a>';
    $temp_prods[$i]['details'] = '&nbsp;&#187;<a href="' . xtc_href_link(FILENAME_PRODUCT_INFO, xtc_product_link($temp_prods[$i]['id'], $temp_prods[$i]['name'])) . '" target="_blank"><small>Details</small></a>';
    $image = xtc_get_products_image($temp_prods[$i]['id']);
    if ($image != '') {
        $temp_prods[$i]['image'] = '<img height="60px" src="' . DIR_WS_THUMBNAIL_IMAGES . $image . '" alt="' . $temp_prods[$i]['name'] . '" title="' . $temp_prods[$i]['name'] . '" />';
    }
    if (isset($temp_prods[$i]['attributes'])) {
        //Dokuman - 2012-05-31 - fix paypal_checkout notices
        $attributes_model = '';
        reset($temp_prods[$i]['attributes']);
        while (list($option, $value) = each($temp_prods[$i]['attributes'])) {
            $attributes_model .= xtc_get_attributes_model($temp_prods[$i]['id'], $value['value'], $value['option']);
        }
        if ($attributes_model) {
            $temp_prods[$i]['model'] .= $attributes_model;
        }
    }
for ($i = 0, $n = sizeof($products); $i < $n; $i++) {
    if (STOCK_CHECK == 'true') {
        $mark_stock = xtc_check_stock($products[$i]['id'], $products[$i]['quantity']);
        if ($mark_stock) {
            $_SESSION['any_out_of_stock'] = 1;
        }
    }
    $image = '';
    if ($products[$i]['image'] != '') {
        $image = DIR_WS_THUMBNAIL_IMAGES . $products[$i]['image'];
    }
    //show 'delete button' in shopping cart
    $del_button = '<a href="' . xtc_href_link(FILENAME_SHOPPING_CART, 'action=remove_product&prd_id=' . $products[$i]['id'], 'NONSSL') . '">' . xtc_image_button('cart_del.gif', IMAGE_BUTTON_DELETE) . '</a>';
    //show 'delete link' in shopping cart
    $del_link = '<a href="' . xtc_href_link(FILENAME_SHOPPING_CART, 'action=remove_product&prd_id=' . $products[$i]['id'], 'NONSSL') . '">' . IMAGE_BUTTON_DELETE . '</a>';
    $module_content[$i] = array('PRODUCTS_NAME' => $products[$i]['name'] . $mark_stock, 'PRODUCTS_QTY' => xtc_draw_input_field('cart_quantity[]', $products[$i]['quantity'], 'size="2"') . xtc_draw_hidden_field('products_id[]', $products[$i]['id']) . xtc_draw_hidden_field('old_qty[]', $products[$i]['quantity']), 'PRODUCTS_MODEL' => $products[$i]['model'], 'PRODUCTS_SHIPPING_TIME' => $products[$i]['shipping_time'], 'PRODUCTS_TAX' => number_format($products[$i]['tax'], TAX_DECIMAL_PLACES), 'PRODUCTS_IMAGE' => $image, 'IMAGE_ALT' => $products[$i]['name'], 'BOX_DELETE' => xtc_draw_checkbox_field('cart_delete[]', $products[$i]['id']), 'PRODUCTS_LINK' => xtc_href_link(FILENAME_PRODUCT_INFO, xtc_product_link($products[$i]['id'], $products[$i]['name'])), 'BUTTON_DELETE' => $del_button, 'LINK_DELETE' => $del_link, 'PRODUCTS_PRICE' => $xtPrice->xtcFormat($products[$i]['price'] * $products[$i]['quantity'], true), 'PRODUCTS_SINGLE_PRICE' => $xtPrice->xtcFormat($products[$i]['price'], true), 'PRODUCTS_VPE' => $products[$i]['vpe'], 'PRODUCTS_SHORT_DESCRIPTION' => xtc_get_short_description($products[$i]['id']), 'ATTRIBUTES' => '');
    //products attributes
    if (isset($products[$i]['attributes']) && is_array($products[$i]['attributes'])) {
        $subindex = 0;
        reset($products[$i]['attributes']);
        while (list($option, $value) = each($products[$i]['attributes'])) {
            $hidden_options .= xtc_draw_hidden_field('id[' . $products[$i]['id'] . '][' . $option . ']', $value);
            $attributes = $main->getAttributes($products[$i]['id'], $option, $value);
            $attribute_stock_check = '';
            if (ATTRIBUTE_STOCK_CHECK == 'true' && STOCK_CHECK == 'true') {
                if ($attributes['attributes_stock'] - $products[$i]['quantity'] < 0) {
                    $attribute_stock_check = '<span class="markProductOutOfStock">' . STOCK_MARK_PRODUCT_OUT_OF_STOCK . '</span>';
                    $_SESSION['any_out_of_stock'] = 1;
                }
            }
            $module_content[$i]['ATTRIBUTES'][$subindex] = array('ID' => $attributes['products_attributes_id'], 'MODEL' => $attributes['attributes_model'], 'EAN' => $attributes['attributes_ean'], 'NAME' => $attributes['products_options_name'], 'VALUE_NAME' => $attributes['products_options_values_name'] . $attribute_stock_check);