function display()
 {
     $customers_statuses_array = olc_get_customers_statuses();
     // build Currency Select
     $curr = '';
     $currencies = olc_db_query("SELECT code FROM " . TABLE_CURRENCIES);
     while ($currencies_data = olc_db_fetch_array($currencies)) {
         $curr .= olc_draw_radio_field('currencies', $currencies_data['code'], true) . $currencies_data['code'] . HTML_BR;
     }
     return array('text' => EXPORT_STATUS_TYPE . HTML_BR . EXPORT_STATUS . HTML_BR . olc_draw_pull_down_menu('status', $customers_statuses_array, '1') . HTML_BR . CURRENCY . HTML_BR . CURRENCY_DESC . HTML_BR . $curr . EXPORT_TYPE . HTML_BR . EXPORT . HTML_BR . olc_draw_radio_field('export', 'no', false) . EXPORT_NO . HTML_BR . olc_draw_radio_field('export', 'yes', true) . EXPORT_YES . HTML_BR . HTML_BR . olc_image_submit('button_export.gif', IMAGE_UPDATE) . HTML_A_START . olc_href_link(FILENAME_MODULE_EXPORT, 'set=' . $_GET['set'] . '&module=preistrend') . '">' . olc_image_button('button_cancel.gif', IMAGE_CANCEL) . HTML_A_END);
 }
<?php 
            }
        }
        ?>
								</table>
<?php 
        break;
        // end default page
    // end default page
    case 'edit':
        $newsletters_query = olc_db_query("SELECT\n                                   title,body,cc\n                                  FROM " . TABLE_MODULE_NEWSLETTER . "\n                                  WHERE newsletter_id='" . $id_get . APOS);
        $newsletters_data = olc_db_fetch_array($newsletters_query);
    case 'safe':
    case 'new':
        // action for NEW newsletter!
        $customers_status = olc_get_customers_statuses();
        echo olc_draw_form('edit_newsletter', FILENAME_MODULE_NEWSLETTER, 'action=save', 'post') . olc_draw_hidden_field('id', $id_get);
        ?>
									<br/><br/>
									<table class="main" width="100%" border="0">
										<tr>
										  <td width="10%"><?php 
        echo TEXT_TITLE;
        ?>
</td>
										  <td width="90%">
										  	<?php 
        echo olc_draw_textarea_field('title', 'soft', '100%', '3', $newsletters_data['title']);
        ?>
										  </td>
										</tr>
--------------------------------------------------------------
based on:
(c) 2000-2001 The Exchange Project  (earlier name of osCommerce)
(c) 2002-2003 osCommerce(customers.php,v 1.76 2003/05/04); www.oscommerce.com
(c) 2003	    nextcommerce (create_account.php,v 1.17 2003/08/24); www.nextcommerce.org
(c) 2004      XT - Commerce; www.xt-commerce.com

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

Released under the GNU General Public License
--------------------------------------------------------------*/
require_once 'includes/application_top.php';
$customers_statuses_array = olc_get_customers_statuses();
$IsCreateAccount = true;
if ($_GET['action'] == 'edit') {
    //	W. Kaiser - Common code for "create_account.php" and "customers.php"
    $from_table_zones = SQL_FROM . TABLE_ZONES . " where zone_country_id = '";
    include DIR_FS_INC . 'olc_get_check_customer_data.inc.php';
    //	W. Kaiser - Common code for "create_account.php" and "customers.php"
    // Create insert into admin access table if admin is created.
    if (!$error) {
        olc_db_query(INSERT_INTO . TABLE_CUSTOMERS_INFO . " (customers_info_id, customers_info_number_of_logons, customers_info_date_account_created) values ('" . $cc_id . "', '0', now())");
        // Create eMail
        if ($customers_send_mail == 'yes') {
            $name = trim($customers_lastname . BLANK . $customers_firstname);
            $smarty->assign('NAME', $name);
            $smarty->assign('EMAIL', $customers_email_address);
            $smarty->assign('COMMENTS', $customers_mail_comments);
 /**
  *   Init some data
  *   @return array
  */
 function init($filename, $map_filename)
 {
     $this->filename = $filename;
     $this->map_filename = $map_filename;
     $this->languages = $this->get_lang();
     define('LANGUAGES', count($this->languages));
     define('LANGUAGE_0', $this->languages[0][ID]);
     define('CAT_1_QUERY', SELECT . "c.categories_id" . SQL_FROM . TABLE_CATEGORIES . " c," . TABLE_CATEGORIES_DESCRIPTION . " cd\n\t\t\tWHERE\n\t\t\tcd.categories_name='#' and\n\t\t\tcd.language_id=" . LANGUAGE_0 . " and\n\t\t\tcd.categories_id=c.categories_id and\n\t\t\tparent_id=@");
     $this->tax_rates = $this->getTaxRates();
     $this->mfn = $this->get_mfn();
     $this->errorlog = array();
     $this->Groups = olc_get_customers_statuses();
     define('GROUPS', count($this->Groups));
     $this->prod_desc_fields_array = array(NAME, DESC, SHORTDESC, META_TITLE, META_DESC, META_KEY, URL);
     if (IS_XTC) {
         $this->prod_desc_fields_array[] = KEYWORDS;
     }
     define('PROD_DESC_FIELDS', count($this->prod_desc_fields_array));
     $this->prod_fields_array = array(0 => MODEL, 1 => EAN, 2 => STOCK, 3 => WEIGHT, 4 => STATUS, 5 => IMAGE, 6 => DISC, 7 => TAX, 8 => TAX_VALUE, 9 => PRICENOTAX, 10 => OPTTPL, 11 => FSK18, 12 => TPL, 13 => VPE, 14 => VPE_STATUS, 15 => VPE_VALUE, 16 => SHIPPING, 17 => SORTING);
     $this->prod_fields_is_text = array(0 => true, 1 => true, 2 => false, 3 => false, 4 => false, 5 => true, 6 => false, 7 => false, 8 => true, 9 => false, 10 => true, 11 => false, 12 => true, 13 => false, 14 => false, 15 => false, 16 => false, 17 => false);
     if (OL_COMMERCE) {
         $this->prod_fields_array = array_merge($this->prod_fields_array, array(0 => BASEPRICE_SHOW, 1 => BASEPRICE_VALUE, 2 => MIN_ORDER_QUANTITY, 3 => MIN_ORDER_VPE, 4 => UVPNOTAX));
         $this->prod_fields_is_text = array_merge($this->prod_fields_array, array(0 => true, 1 => true, 2 => true, 3 => true, 4 => true));
     }
     define('PROD_FIELDS', count($this->prod_fields_array));
     $this->cat_fields_array = array(0 => CAT_HEADING_TITLE, 1 => CAT_DESCRIPTION, 2 => CAT_META_TITLE, 3 => CAT_META_DESCRIPTION, 4 => CAT_META_KEYWORDS);
     define('CAT_FIELDS', count($this->cat_fields_array));
     define('CAT_FIELDS_2', CAT_FIELDS + 2);
     $this->field_index = array();
     $this->new_lines_array = array("\n\r", "\r\n", "\n", "\r", chr(10), chr(13), chr(10) . chr(13), chr(13) . chr(10));
     $this->fields_assoc = $this->create_field_associations();
     $this->build_CatTree();
     $this->time_start = time();
 }
function SendProducts()
{
    global $_GET, $LangID;
    if (defined('SET_TIME_LIMIT')) {
        @set_time_limit(0);
    }
    $schema = '<?xml version="1.0" encoding="' . CHARSET . '"?>' . "\n" . '<PRODUCTS>' . "\n";
    $sql = "select products_id,products_fsk18, products_quantity, products_model, products_image, products_price, " . "products_date_added, products_last_modified, products_date_available, products_weight, " . "products_status, products_tax_class_id, manufacturers_id, products_ordered from " . TABLE_PRODUCTS;
    $from = olc_db_prepare_input($_GET['products_from']);
    $anz = olc_db_prepare_input($_GET['products_count']);
    if (isset($from)) {
        if (!isset($anz)) {
            $anz = 1000;
        }
        $sql .= " limit " . $from . "," . $anz;
    }
    $orders_query = olc_db_query($sql);
    //W. Kaiser
    require_once DIR_FS_INC . 'olc_image.inc.php';
    require_once DIR_FS_INC . 'olc_get_customers_statuses.inc.php';
    $http_catalog = HTTP_SERVER . DIR_WS_CATALOG;
    $deep_link = $http_catalog . $olc_filename['product_info'] . '?products_id=';
    while ($products = olc_db_fetch_array($orders_query)) {
        $products_image = $products['products_image'];
        $products_id = $products['products_id'];
        $schema .= '<PRODUCT_INFO>' . "\n" . '<PRODUCT_DATA>' . "\n" . '<PRODUCT_ID>' . $products_id . '</PRODUCT_ID>' . "\n" . '<PRODUCT_DEEPLINK>' . $deep_link . $products_id . '</PRODUCT_DEEPLINK>' . "\n" . '<PRODUCT_QUANTITY>' . $products['products_quantity'] . '</PRODUCT_QUANTITY>' . "\n" . '<PRODUCT_MODEL>' . htmlspecialchars($products['products_model']) . '</PRODUCT_MODEL>' . "\n" . '<PRODUCT_FSK18>' . htmlspecialchars($products['products_fsk18']) . '</PRODUCT_FSK18>' . "\n" . '<PRODUCT_IMAGE>' . htmlspecialchars($products_image) . '</PRODUCT_IMAGE>' . "\n";
        if ($products_image) {
            //W. Kaiser - pictures-on-the-fly
            /*
            $schema .=
            '<PRODUCT_IMAGE_POPUP>'.
            $http_catalog.DIR_WS_POPUP_IMAGES.$products_image.
            '</PRODUCT_IMAGE_POPUP>'. "\n" .
            '<PRODUCT_IMAGE_SMALL>'.
            $http_catalog.DIR_WS_INFO_IMAGES.$products_image.
            '</PRODUCT_IMAGE_SMALL>'. "\n" .
            '<PRODUCT_IMAGE_THUMBNAIL>'.
            $http_catalog.DIR_WS_THUMBNAIL_IMAGES.$products_image.
            '</PRODUCT_IMAGE_THUMBNAIL>'. "\n" .
            '<PRODUCT_IMAGE_ORIGINAL>'.
            $http_catalog.DIR_WS_ORIGINAL_IMAGES.$products_image.
            '</PRODUCT_IMAGE_ORIGINAL>'. "\n";
            */
            $schema .= '<PRODUCT_IMAGE_ORIGINAL>' . olc_image($http_catalog . DIR_WS_ORIGINAL_IMAGES . $products_image) . '</PRODUCT_IMAGE_ORIGINAL>' . "\n" . '<PRODUCT_IMAGE_SMALL>' . olc_image($http_catalog . DIR_WS_INFO_IMAGES . $products_image) . '</PRODUCT_IMAGE_SMALL>' . "\n" . '<PRODUCT_IMAGE_POPUP>' . olc_image($http_catalog . DIR_WS_POPUP_IMAGES . $products_image) . '</PRODUCT_IMAGE_POPUP>' . "\n" . '<PRODUCT_IMAGE_THUMBNAIL>' . olc_image($http_catalog . DIR_WS_THUMBNAIL_IMAGES . $products_image) . '</PRODUCT_IMAGE_THUMBNAIL>' . "\n";
            //W. Kaiser - pictures-on-the-fly
        }
        $schema .= '<PRODUCT_PRICE>' . $products['products_price'] . '</PRODUCT_PRICE>' . "\n";
        /* Wird von CAO derzeit nicht verwendet !!! */
        $customers_status = olc_get_customers_statuses();
        for ($i = 1, $n = sizeof($customers_status); $i < $n; $i++) {
            if ($customers_status[$i]['id'] != 0) {
                $schema .= "<PRODUCT_GROUP_PRICES ID='" . $customers_status[$i]['id'] . "' NAME='" . $customers_status[$i]['text'] . "'>" . "\n";
                $group_price_query = olc_db_query("SELECT * FROM " . TABLE_PERSONAL_OFFERS_BY_CUSTOMERS_STATUS . $customers_status[$i]['id'] . " WHERE products_id='" . $products_id . "'");
                while ($group_price_data = olc_db_fetch_array($group_price_query)) {
                    //if ($group_price_data['personal_offer']!='0')
                    //{
                    $schema .= '<PRICE_ID>' . $group_price_data['price_id'] . '</PRICE_ID>';
                    $schema .= '<PRODUCT_ID>' . $group_price_data['products_id'] . '</PRODUCT_ID>';
                    $schema .= '<QTY>' . $group_price_data['quantity'] . '</QTY>';
                    $schema .= '<PRICE>' . $group_price_data['personal_offer'] . '</PRICE>';
                    //}
                }
                $schema .= "</PRODUCT_GROUP_PRICES>\n";
            }
        }
        // products Options
        //W. Kaiser
        $products_attributes = '';
        $products_options_data = array();
        $products_options_array = array();
        $products_attributes_query = olc_db_query("select count(*) as total\n                                               from " . TABLE_PRODUCTS_OPTIONS . "\n                                               popt, " . TABLE_PRODUCTS_ATTRIBUTES . "\n                                               patrib where\n                                               patrib.products_id='" . $products['products_id'] . "'\n                                               and patrib.options_id = popt.products_options_id\n                                               and popt.language_id = '" . $LangID . "'");
        $products_attributes = olc_db_fetch_array($products_attributes_query);
        if ($products_attributes['total'] > 0) {
            $products_options_name_query = olc_db_query("select distinct\n                                                   popt.products_options_id,\n                                                   popt.products_options_name\n                                                   from " . TABLE_PRODUCTS_OPTIONS . "\n                                                   popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib\n                                                   where patrib.products_id='" . $products['products_id'] . "'\n                                                   and patrib.options_id = popt.products_options_id\n                                                   and popt.language_id = '" . $LangID . "' order by popt.products_options_name");
            $row = 0;
            $col = 0;
            $products_options_data = array();
            while ($products_options_name = olc_db_fetch_array($products_options_name_query)) {
                $selected = 0;
                $products_options_array = array();
                $products_options_data[$row] = array('NAME' => $products_options_name['products_options_name'], 'ID' => $products_options_name['products_options_id'], 'DATA' => '');
                $products_options_query = olc_db_query("select\n                                                 pov.products_options_values_id,\n                                                 pov.products_options_values_name,\n                                                 pa.attributes_model,\n                                                 pa.options_values_price,\n                                                 pa.options_values_weight,\n                                                 pa.price_prefix,\n                                                 pa.weight_prefix,\n                                                 pa.attributes_stock,\n                                                 pa.attributes_model\n                                                from " . TABLE_PRODUCTS_ATTRIBUTES . "\n                                                 pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . "\n                                                 pov\n                                                where\n                                                 pa.products_id = '" . $products['products_id'] . "'\n                                                 and pa.options_id = '" . $products_options_name['products_options_id'] . "' and\n                                                 pa.options_values_id = pov.products_options_values_id and\n                                                 pov.language_id = '" . $LangID . "'\n                                                order by pov.products_options_values_name");
                $col = 0;
                while ($products_options = olc_db_fetch_array($products_options_query)) {
                    $products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']);
                    if ($products_options['options_values_price'] != '0') {
                        $products_options_array[sizeof($products_options_array) - 1]['text'] .= ' ' . $products_options['price_prefix'] . ' ' . $products_options['options_values_price'] . ' ' . $_SESSION['currency'];
                    }
                    $price = '';
                    $products_options_data[$row]['DATA'][$col] = array('ID' => $products_options['products_options_values_id'], 'TEXT' => $products_options['products_options_values_name'], 'MODEL' => $products_options['attributes_model'], 'WEIGHT' => $products_options['options_values_weight'], 'PRICE' => $products_options['options_values_price'], 'WEIGHT_PREFIX' => $products_options['weight_prefix'], 'PREFIX' => $products_options['price_prefix']);
                    $col++;
                }
                $row++;
            }
        }
        if (sizeof($products_options_data) != 0) {
            for ($i = 0, $n = sizeof($products_options_data); $i < $n; $i++) {
                $schema .= "<PRODUCT_ATTRIBUTES NAME='" . $products_options_data[$i]['NAME'] . "'>";
                for ($ii = 0, $nn = sizeof($products_options_data[$i]['DATA']); $ii < $nn; $ii++) {
                    $schema .= '<OPTION>';
                    $schema .= '<ID>' . $products_options_data[$i]['DATA'][$ii]['ID'] . '</ID>';
                    $schema .= '<MODEL>' . $products_options_data[$i]['DATA'][$ii]['MODEL'] . '</MODEL>';
                    $schema .= '<TEXT>' . $products_options_data[$i]['DATA'][$ii]['TEXT'] . '</TEXT>';
                    $schema .= '<WEIGHT>' . $products_options_data[$i]['DATA'][$ii]['WEIGHT'] . '</WEIGHT>';
                    $schema .= '<PRICE>' . $products_options_data[$i]['DATA'][$ii]['PRICE'] . '</PRICE>';
                    $schema .= '<WEIGHT_PREFIX>' . $products_options_data[$i]['DATA'][$ii]['WEIGHT_PREFIX'] . '</WEIGHT_PREFIX>';
                    $schema .= '<PREFIX>' . $products_options_data[$i]['DATA'][$ii]['PREFIX'] . '</PREFIX>';
                    $schema .= '</OPTION>';
                }
                $schema .= '</PRODUCT_ATTRIBUTES>';
            }
        }
        /* End Wird zur Zeit nicht verwendet */
        require_once DIR_FS_INC . 'olc_get_tax_rate.inc.php';
        if (SWITCH_MWST == 'true') {
            // switch IDs
            if ($products['products_tax_class_id'] == 1) {
                $products['products_tax_class_id'] = 2;
            } else {
                if ($products['products_tax_class_id'] == 2) {
                    $products['products_tax_class_id'] = 1;
                }
            }
        }
        $schema .= '<PRODUCT_WEIGHT>' . $products['products_weight'] . '</PRODUCT_WEIGHT>' . "\n" . '<PRODUCT_STATUS>' . $products['products_status'] . '</PRODUCT_STATUS>' . "\n" . '<PRODUCT_TAX_CLASS_ID>' . $products['products_tax_class_id'] . '</PRODUCT_TAX_CLASS_ID>' . "\n" . '<PRODUCT_TAX_RATE>' . olc_get_tax_rate($products['products_tax_class_id']) . '</PRODUCT_TAX_RATE>' . "\n" . '<MANUFACTURERS_ID>' . $products['manufacturers_id'] . '</MANUFACTURERS_ID>' . "\n" . '<PRODUCT_DATE_ADDED>' . $products['products_date_added'] . '</PRODUCT_DATE_ADDED>' . "\n" . '<PRODUCT_LAST_MODIFIED>' . $products['products_last_modified'] . '</PRODUCT_LAST_MODIFIED>' . "\n" . '<PRODUCT_DATE_AVAILABLE>' . $products['products_date_available'] . '</PRODUCT_DATE_AVAILABLE>' . "\n" . '<PRODUCTS_ORDERED>' . $products['products_ordered'] . '</PRODUCTS_ORDERED>' . "\n";
        /* Wird von CAO derzeit nicht verwendet !!! */
        $categories_query = olc_db_query("SELECT\n                                     categories_id\n                                    FROM " . TABLE_PRODUCTS_TO_CATEGORIES . "\n                                     where products_id='" . $products['products_id'] . "'");
        $categories = array();
        while ($categories_data = olc_db_fetch_array($categories_query)) {
            $categories[] = $categories_data['categories_id'];
        }
        $categories = implode(',', $categories);
        $schema .= '<PRODUCTS_CATEGORIES>' . $categories . '</PRODUCTS_CATEGORIES>' . "\n";
        /* Ende Wird zur Zeit nicht verwendet */
        $detail_query = olc_db_query("select\n                                   products_id,\n                                   language_id,\n                                   products_name, " . TABLE_PRODUCTS_DESCRIPTION . ".products_description,\n                                   products_short_description,\n                                   products_meta_title,\n                                   products_meta_description,\n                                   products_meta_keywords,\n                                   products_url,\n                                   name as language_name, code as language_code " . "from " . TABLE_PRODUCTS_DESCRIPTION . ", " . TABLE_LANGUAGES . " " . "where " . TABLE_PRODUCTS_DESCRIPTION . ".language_id=" . TABLE_LANGUAGES . ".languages_id " . "and " . TABLE_PRODUCTS_DESCRIPTION . ".products_id=" . $products['products_id']);
        while ($details = olc_db_fetch_array($detail_query)) {
            $schema .= "<PRODUCT_DESCRIPTION ID='" . $details["language_id"] . "' CODE='" . $details["language_code"] . "' NAME='" . $details["language_name"] . "'>\n";
            if ($details["products_name"] != 'Array') {
                $schema .= "<NAME>" . htmlspecialchars($details["products_name"]) . "</NAME>" . "\n";
            }
            $schema .= "<URL>" . htmlspecialchars($details["products_url"]) . "</URL>" . "\n";
            $prod_details = $details["products_description"];
            if ($prod_details != 'Array') {
                $schema .= "<DESCRIPTION>" . htmlspecialchars($details["products_description"]) . "</DESCRIPTION>" . "\n";
                $schema .= "<SHORT_DESCRIPTION>" . htmlspecialchars($details["products_short_description"]) . "</SHORT_DESCRIPTION>" . "\n";
                $schema .= "<META_TITLE>" . htmlspecialchars($details["products_meta_title"]) . "</META_TITLE>" . "\n";
                $schema .= "<META_DESCRIPTION>" . htmlspecialchars($details["products_meta_description"]) . "</META_DESCRIPTION>" . "\n";
                $schema .= "<META_KEYWORDS>" . htmlspecialchars($details["products_meta_keywords"]) . "</META_KEYWORDS>" . "\n";
            }
            $schema .= "</PRODUCT_DESCRIPTION>\n";
        }
        // NEU JP 26.08.2005 Aktionspreise exportieren
        $special_query = "SELECT * from " . TABLE_SPECIALS . " " . "where products_id=" . $products['products_id'] . " limit 0,1";
        $special_result = olc_db_query($special_query);
        while ($specials = olc_db_fetch_array($special_result)) {
            $schema .= '<SPECIAL>' . "\n" . '<SPECIAL_PRICE>' . $specials['specials_new_products_price'] . '</SPECIAL_PRICE>' . "\n" . '<SPECIAL_DATE_ADDED>' . $specials['specials_date_added'] . '</SPECIAL_DATE_ADDED>' . "\n" . '<SPECIAL_LAST_MODIFIED>' . $specials['specials_last_modified'] . '</SPECIAL_LAST_MODIFIED>' . "\n" . '<SPECIAL_DATE_EXPIRES>' . $specials['expires_date'] . '</SPECIAL_DATE_EXPIRES>' . "\n" . '<SPECIAL_STATUS>' . $specials['status'] . '</SPECIAL_STATUS>' . "\n" . '<SPECIAL_DATE_STATUS_CHANGE>' . $specials['date_status_change'] . '</SPECIAL_DATE_STATUS_CHANGE>' . "\n" . '</SPECIAL>' . "\n";
        }
        // Ende Aktionspreise
        $schema .= '</PRODUCT_DATA>' . "\n" . '</PRODUCT_INFO>' . "\n";
    }
    $schema .= '</PRODUCTS>' . "\n\n";
    echo $schema;
}
 function duplicate_product($src_products_id, $dest_categories_id)
 {
     $product_query = xtDBquery("SELECT *\n\t\t\t\t    \t                                 FROM " . TABLE_PRODUCTS . "\n\t\t\t\t    \t                                WHERE products_id = '" . olc_db_input($src_products_id) . "'");
     $product = olc_db_fetch_array($product_query);
     if ($dest_categories_id == 0) {
         $startpage = 1;
         $products_status = 1;
     } else {
         $startpage = 0;
         $products_status = $product['products_status'];
     }
     $sql_data_array = array('products_quantity' => $product['products_quantity'], 'products_model' => $product['products_model'], 'products_ean' => $product['products_ean'], 'products_shippingtime' => $product['products_shippingtime'], 'products_sort' => $product['products_sort'], 'products_startpage' => $startpage, 'products_sort' => $product['products_sort'], 'products_price' => $product['products_price'], 'products_discount_allowed' => $product['products_discount_allowed'], 'products_date_added' => 'now()', 'products_date_available' => $product['products_date_available'], 'products_weight' => $product['products_weight'], 'products_status' => $products_status, 'products_tax_class_id' => $product['products_tax_class_id'], 'manufacturers_id' => $product['manufacturers_id'], 'product_template' => $product['product_template'], 'options_template' => $product['options_template'], 'products_fsk18' => $product['products_fsk18']);
     $customers_statuses_array = olc_get_customers_statuses();
     for ($i = 0; $n = sizeof($customers_statuses_array), $i < $n; $i++) {
         if (isset($customers_statuses_array[$i]['id'])) {
             $sql_data_array = array_merge($sql_data_array, array('group_permission_' . $customers_statuses_array[$i]['id'] => $product['group_permission_' . $customers_statuses_array[$i]['id']]));
         }
     }
     olc_db_perform(TABLE_PRODUCTS, $sql_data_array);
     //get duplicate id
     $dup_products_id = olc_db_insert_id();
     //duplicate image if there is one
     if ($product['products_image'] != '') {
         //build new image_name for duplicate
         $pname_arr = explode('.', $product['products_image']);
         $nsuffix = array_pop($pname_arr);
         $dup_products_image_name = $dup_products_id . '_0' . '.' . $nsuffix;
         //write to DB
         xtDBquery("SQL_UPDATE " . TABLE_PRODUCTS . " SET products_image = '" . $dup_products_image_name . "' WHERE products_id = '" . $dup_products_id . "'");
         @copy(DIR_FS_CATALOG_ORIGINAL_IMAGES . '/' . $product['products_image'], DIR_FS_CATALOG_ORIGINAL_IMAGES . '/' . $dup_products_image_name);
         @copy(DIR_FS_CATALOG_INFO_IMAGES . '/' . $product['products_image'], DIR_FS_CATALOG_INFO_IMAGES . '/' . $dup_products_image_name);
         @copy(DIR_FS_CATALOG_THUMBNAIL_IMAGES . '/' . $product['products_image'], DIR_FS_CATALOG_THUMBNAIL_IMAGES . '/' . $dup_products_image_name);
         @copy(DIR_FS_CATALOG_POPUP_IMAGES . '/' . $product['products_image'], DIR_FS_CATALOG_POPUP_IMAGES . '/' . $dup_products_image_name);
     } else {
         unset($dup_products_image_name);
     }
     $description_query = olc_db_query("SELECT *\n\t\t\t\t    \t                                     FROM " . TABLE_PRODUCTS_DESCRIPTION . "\n\t\t\t\t    \t                                    WHERE products_id = '" . olc_db_input($src_products_id) . "'");
     $old_products_id = olc_db_input($src_products_id);
     while ($description = olc_db_fetch_array($description_query)) {
         olc_db_query("INSERT INTO " . TABLE_PRODUCTS_DESCRIPTION . "\n\t\t\t\t\t\t    \t\t                 SET products_id                = '" . $dup_products_id . "',                                      \n\t\t\t\t\t\t    \t\t                     language_id                = '" . $description['language_id'] . "',                           \n\t\t\t\t\t\t    \t\t                     products_name              = '" . addslashes($description['products_name']) . "',             \n\t\t\t\t\t\t    \t\t                     products_description       = '" . addslashes($description['products_description']) . "',      \n\t\t\t\t\t\t    \t\t                     products_keywords          = '" . addslashes($description['products_keywords']) . "',\n\t\t\t\t\t\t    \t\t                     products_short_description = '" . addslashes($description['products_short_description']) . "',\n\t\t\t\t\t\t    \t\t                     products_meta_title        = '" . addslashes($description['products_meta_title']) . "',       \n\t\t\t\t\t\t    \t\t                     products_meta_description  = '" . addslashes($description['products_meta_description']) . "', \n\t\t\t\t\t\t    \t\t                     products_meta_keywords     = '" . addslashes($description['products_meta_keywords']) . "',    \n\t\t\t\t\t\t    \t\t                     products_url               = '" . $description['products_url'] . "',                          \n\t\t\t\t\t\t    \t\t                     products_viewed            = '0'");
     }
     olc_db_query("INSERT INTO " . TABLE_PRODUCTS_TO_CATEGORIES . "\n\t\t\t\t    \t                 SET products_id   = '" . $dup_products_id . "',\n\t\t\t\t    \t                     categories_id = '" . olc_db_input($dest_categories_id) . "'");
     //mo_images by Novalis@eXanto.de
     $mo_images = olc_get_products_mo_images($src_products_id);
     if (is_array($mo_images)) {
         foreach ($mo_images as $dummy => $mo_img) {
             //build new image_name for duplicate
             $pname_arr = explode('.', $mo_img['image_name']);
             $nsuffix = array_pop($pname_arr);
             $dup_products_image_name = $dup_products_id . '_' . $mo_img['image_nr'] . '.' . $nsuffix;
             //copy org images to duplicate
             @copy(DIR_FS_CATALOG_ORIGINAL_IMAGES . '/' . $mo_img['image_name'], DIR_FS_CATALOG_ORIGINAL_IMAGES . '/' . $dup_products_image_name);
             @copy(DIR_FS_CATALOG_INFO_IMAGES . '/' . $mo_img['image_name'], DIR_FS_CATALOG_INFO_IMAGES . '/' . $dup_products_image_name);
             @copy(DIR_FS_CATALOG_THUMBNAIL_IMAGES . '/' . $mo_img['image_name'], DIR_FS_CATALOG_THUMBNAIL_IMAGES . '/' . $dup_products_image_name);
             @copy(DIR_FS_CATALOG_POPUP_IMAGES . '/' . $mo_img['image_name'], DIR_FS_CATALOG_POPUP_IMAGES . '/' . $dup_products_image_name);
             olc_db_query("INSERT INTO " . TABLE_PRODUCTS_IMAGES . "\n\t\t\t\t\t\t\t\t    \t\t\t                 SET products_id = '" . $dup_products_id . "',\n\t\t\t\t\t\t\t\t    \t\t\t                     image_nr    = '" . $mo_img['image_nr'] . "',\n\t\t\t\t\t\t\t\t    \t\t\t                     image_name  = '" . $dup_products_image_name . "'");
         }
     }
     //mo_images EOF
     $products_id = $dup_products_id;
     $i = 0;
     $group_query = olc_db_query("SELECT customers_status_id\n\t\t\t\t    \t                               FROM " . TABLE_CUSTOMERS_STATUS . "\n\t\t\t\t    \t                              WHERE language_id = '" . (int) $_SESSION['languages_id'] . "'\n\t\t\t\t    \t                                AND customers_status_id != '0'");
     while ($group_values = olc_db_fetch_array($group_query)) {
         // load data into array
         $i++;
         $group_data[$i] = array('STATUS_ID' => $group_values['customers_status_id']);
     }
     for ($col = 0, $n = sizeof($group_data); $col < $n + 1; $col++) {
         if ($group_data[$col]['STATUS_ID'] != '') {
             $copy_query = olc_db_query("SELECT quantity,\n\t\t\t\t\t\t\t\t    \t\t\t                                   personal_offer\n\t\t\t\t\t\t\t\t    \t\t\t                              FROM personal_offers_by_customers_status_" . $group_data[$col]['STATUS_ID'] . "\n\t\t\t\t\t\t\t\t    \t\t\t                             WHERE products_id = '" . $old_products_id . "'");
             while ($copy_data = olc_db_fetch_array($copy_query)) {
                 olc_db_query("INSERT INTO personal_offers_by_customers_status_" . $group_data[$col]['STATUS_ID'] . "\n\t\t\t\t\t\t\t\t\t\t    \t\t\t\t                 SET price_id       = '',\n\t\t\t\t\t\t\t\t\t\t    \t\t\t\t                     products_id    = '" . $products_id . "',\n\t\t\t\t\t\t\t\t\t\t    \t\t\t\t                     quantity       = '" . $copy_data['quantity'] . "',\n\t\t\t\t\t\t\t\t\t\t    \t\t\t\t                     personal_offer = '" . $copy_data['personal_offer'] . "'");
             }
         }
     }
 }
Ejemplo n.º 7
0
function olc_cfg_pull_down_customers_status_list($customers_status_id, $key = '')
{
    $name = $key ? 'configuration[' . $key . ']' : 'configuration_value';
    return olc_draw_pull_down_menu($name, olc_get_customers_statuses(), $customers_status_id);
}