} } } else { if (preg_match("/^item\\d{4}([\\.])txt\$/", $filename)) { //verwerking stock.txt if (mysql_num_rows(mysql_query("SHOW TABLES LIKE 'devices_to_products'"))) { if ($filename == 'item0001.txt') { mysql_query("TRUNCATE TABLE `devices_to_products`"); } $lines = file(DIR_FS_CATALOG . $tempDir . $filename); $headertags = array(); foreach (explode($seperator, $lines[0]) as $title) { $headertags[] = trim($title); } unset($lines[0]); $devices_to_products_fields = tep_get_table_fields('devices_to_products'); foreach ($lines as $key => $value) { $data = array(); $products_data = array(); foreach (explode($seperator, $value) as $count => $waarde) { //get through all values of 1 line $data[$headertags[$count]] = trim($waarde); } foreach ($devices_to_products_fields as $field) { //go through all products fields if (isset($data[$field]) && !empty($data[$field])) { //if field exists in data, add it $products_data[$field] = $data[$field]; } } echo 'Devices added<br />';
require_once 'includes/application_top.php'; $filename = $_GET['filename']; $tempDir = 'temp/'; $seperator = ";"; $languages = tep_get_languages(); if (preg_match("/^discount\\d{4}([\\.])txt\$/", $filename)) { //verwerking artikel.txt $lines = file(DIR_FS_CATALOG . $tempDir . $filename); $headertags = array(); foreach (explode($seperator, $lines[0]) as $title) { //create list of table names $headertags[] = $title; } unset($lines[0]); //delete first row == titles $discount_fields = tep_get_table_fields('customers_discount'); foreach ($lines as $key => $value) { //go through all lines in file $discount_data = array(); $data = array(); foreach (explode($seperator, $value) as $count => $waarde) { //get through all values of 1 line $data[$headertags[$count]] = trim($waarde); } foreach ($discount_fields as $field) { //go through all products fields if (isset($data[$field])) { //if field exists in data, add it $discount_data[$field] = $data[$field]; } }
require_once 'includes/application_top.php'; $filename = $_GET['localfile']; $tempDir = 'temp/'; $seperator = ";"; $languages = tep_get_languages(); if (preg_match("/^address\\d{4}([\\.])txt\$/", $filename)) { //verwerking address.txt $lines = file(DIR_FS_CATALOG . $tempDir . $filename); $headertags = array(); foreach (explode($seperator, $lines[0]) as $title) { //create list of table names $headertags[] = $title; } unset($lines[0]); //delete first row == titles $address_book_fields = tep_get_table_fields('address_book'); foreach ($lines as $key => $value) { //go through all lines in file $data = array(); foreach (explode($seperator, $value) as $count => $waarde) { //get through all values of 1 line $data[$headertags[$count]] = trim($waarde); } $address_book_data = array(); if (($customers_id = tep_get_customers_id($data['abo_id'])) == '') { //check if products_model exists echo '<span style="color:#ff0000;font-weight:bold;">Geen klant gevonden met het id ' . $data['abo_id'] . '</span><br />'; } else { $address_book_data['customers_id'] = $customers_id; foreach ($address_book_fields as $field) { //go through all products fields