<?php
/* --------------------------------------------------------------
csv_backend.php 2015-09-28 gm
Gambio GmbH
http://www.gambio.de
Copyright (c) 2015 Gambio GmbH
Released under the GNU General Public License (Version 2)
[
http://www.gnu.org/licenses/gpl-2.0.html]
IMPORTANT! THIS FILE IS DEPRECATED AND WILL BE REPLACED IN THE FUTURE.
MODIFY IT ONLY FOR FIXES. DO NOT APPEND IT WITH NEW FEATURES, USE THE
NEW GX-ENGINE LIBRARIES INSTEAD.
--------------------------------------------------------------
based on:
(c) 2000-2001 The Exchange Project (earlier name of osCommerce)
(c) 2002-2003 osCommercecoding standards (a typical file)
www.oscommerce.com
(c) 2003 XT-Commerce - community made shopping
http://www.xt-commerce.com ($Id: csv_backend.php 1030 2005-07-14 20:22:32Z novalis $)
Released under the GNU General Public License
--------------------------------------------------------------*/
$import_file = 'ImportGambio.csv';
// tell modified shop code, we have a secure access
define('_VALID_XTC', true);
// tell import class our delimeter and textsign
require('includes/application_top.php');
require('admin/includes/classes/import.php');
require('inc/xtc_format_filesize.inc.php');
require('inc/xtc_get_customers_statuses.inc.php');
/*
echo "DIR: " . DIR_FS_CATALOG . "<br>";
echo "CSV_SEPERATOR: " . CSV_SEPERATOR . "<br>";
echo "CSV_TEXTSIGN: " . CSV_TEXTSIGN . "<br>";
echo "import_file: " . $import_file . "<br>";
echo "<br><br><br>";
/*
require_once(DIR_FS_INC . 'xtc_format_filesize.inc.php');
*/
// make a connection to the database... now
xtc_db_connect() or die('Unable to connect to database server!');
// define the database table names used in the project
define('TABLE_CATEGORIES', 'categories');
define('TABLE_CATEGORIES_DESCRIPTION', 'categories_description');
define('TABLE_CONFIGURATION', 'configuration');
define('TABLE_CUSTOMERS_STATUS', 'customers_status');
define('TABLE_LANGUAGES', 'languages');
define('TABLE_MANUFACTURERS', 'manufacturers');
define('TABLE_MANUFACTURERS_INFO', 'manufacturers_info');
define('TABLE_PRODUCTS', 'products');
define('TABLE_PRODUCTS_ATTRIBUTES', 'products_attributes');
define('TABLE_PRODUCTS_ATTRIBUTES_DOWNLOAD', 'products_attributes_download');
define('TABLE_PRODUCTS_CONTENT','products_content' );
define('TABLE_PRODUCTS_DESCRIPTION', 'products_description');
define('TABLE_PRODUCTS_NOTIFICATIONS', 'products_notifications');
define('TABLE_PRODUCTS_IMAGES', 'products_images');
define('TABLE_PRODUCTS_OPTIONS', 'products_options');
define('TABLE_PRODUCTS_OPTIONS_VALUES', 'products_options_values');
define('TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_ OPTIONS', 'products_options_values_to_products_options');
define('TABLE_PRODUCTS_TO_CATEGORIES', 'products_to_categories');
define('TABLE_REVIEWS', 'reviews');
define('TABLE_REVIEWS_DESCRIPTION', 'reviews_description');
// set application wide parameters
$configuration_query = xtc_db_query("select configuration_key as cfgKey, configuration_value as cfgValue from " . TABLE_CONFIGURATION . " where configuration_group_id = '20' order by sort_order");
//$configuration_query = xtc_db_query("select configuration_key,configuration_id, configuration_value, use_function,set_function from " . TABLE_CONFIGURATION . " where configuration_group_id = '20' order by sort_order");
while ($configuration = xtc_db_fetch_array($configuration_query)) {
define($configuration['cfgKey'], $configuration['cfgValue']);
echo "conf: " . $configuration['cfgKey'] . $configuration['cfgValue'];
}
$handler = new xtcImport($import_file);
$mapping=$handler->map_file($handler->generate_map());
$import=$handler->import($mapping);
if ($import)
{
if($import[0])
{
echo '<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td class="messageStackSuccess">';
if (isset($import[0]['prod_new'])) echo 'Neue Artikel:'.$import[0]['prod_new'].'<br />';
if (isset($import[0]['cat_new'])) echo 'Neue Kategorien:'.$import[0]['cat_new'].'<br />';
if (isset($import[0]['prod_upd'])) echo 'Aktualisierte Artikel:'.$import[0]['prod_upd'].'<br />';
if (isset($import[0]['cat_upd'])) echo 'Aktualisierte Kategorien:'.$import[0]['cat_upd'].'<br />';
if (isset($import[0]['cat_touched'])) echo 'Betroffene Kategorien:'.$import[0]['cat_touched'].'<br />';
if (isset($import[2])) echo $import[2];
echo '</td></tr></table>';
}
/*
if (isset($import[1]) && $import[1][0]!='')
{
echo '<table width="100%" border="0" cellspacing="0" cellpadding="0"><tr><td class="messageStackError">';
for ($i=0;$i<count($import[1]);$i++)
{
echo $import[1][$i].'<br />';
}
echo '</td></tr></table>';
}
*/
}
for ($i=0;$i<count($import[1]);$i++)
{
echo $import[1][$i].'<br />';
}
?>