Jump to content
VJ

Easy Populate & Products Attributes

Recommended Posts

Sorry to bother everybody again, but after reading for hours, I still did not find ANY way around my import problem java script:emoticon(":'(",

smilie:

 

I try to reimport the exported file (this part works well, thanks God), but I get this as a result:

 

File uploaded.

Temporary filename: /tmp/phpKk95F2

User filename: 1.txt

Size: 10077

| 2401000 | big-240100 | Boule Oeuf | Cette boul | | Ball Tea I | This metal | | Ball Tea I | This metal | | 5.27 | 228 | | 0000-00-00 | 1 | | | | | | | | | --none-- | Active Updated

| 531000$b | 530430$b | 530415$b | 511115$b | 511150$b | 511161$b | 511192$b | 511230$b | 511415$b | 530000$b |

 

(in this example, I tried $ as a delimiter, just in case).

 

I don't understand... it updates the first one and stop.

 

Please please please, I beg, today, for a kind help from the wise ones (or any other crazy idea)

 

Interesting. I don't have this problem when I upload into my store which is sitting on a Unix hosting server, but with the test version of my store, which is running on a Windows PC over Wamp, I get exactly the same result with exactly the same csv file that was imported just fine on the Unix system. Did you get the same result with tabs between the fields?

Share this post


Link to post
Share on other sites

After succesfully installing the 2.74 version of Mibble I ran into the next problem.

 

Strange but there is no default language to work... That may not happen, just in case... 1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 5

 

SELECT categories_name FROM categories_description WHERE categories_id = 22 AND language_id =

 

 

Where can I setup my default language??

 

I have 3 languages in my admin, but on my page there are no flags displayed....???

 

 

(another question....I threw the default osc articles out of the shop, can I test directly with uploading the file in the contribution pack?)

Share this post


Link to post
Share on other sites

I have a question and it doesn't seem to have been covered here yet. I am using 2 images, thumbnail and reg size. I have not seen anything in the documentation about what the field name is for the thumbnail. I'm sorry if I missed it in this thread.

 

Also, is this a bug or not. I have a fully working store with the images on my server already. I go to upload the EP file and all the sudden...all the images disappear as if they aren't even there but yet they are still on the server. Unless I upload all 5000 of them again overwriting the others, they won't come up.

Share this post


Link to post
Share on other sites
I installed easy_populate, and assume you must first export a template before attempting to import items? However, I am getting this error, though right at the top it says DEFAUL_LANGUAGE_EP English

 

Fixed this language error, which was in the data base.

 

Fatal error: Call to undefined function: tep_get_languages() in /homepages/45/d152861670/htdocs/smallengines/catalog/easypopulate.php on line 850

 

I am also getting an error at the top but do not know how to secure the file, as I have Front Page installed and if I put the Catalog in a secured subweb, no one will be able to get to it without a pass word, and if I put the includes in the subweb it will destroy the structure.

 

Warning: I am able to write to the configuration file: /kunden/homepages/45/d152861670/htdocs/smallengines/catalog/includes/configure.php. This is a potential security risk - please set the right user permissions on this file.

 

New error after upload to Temp director when trying to input to data base:Filename: /tmp/phpWClZz5

 

Warning: file(/kunden/homepages/45/d152861670/htdocs/Mall/catalog/EP_TEMP_DIR/tmp/phpWClZz5): failed to open stream: No such file or directory in /homepages/45/d152861670/htdocs/smallengines/catalog/admin/easypopulate.php on line 637


Talos

Share this post


Link to post
Share on other sites

with EP 2.8 i can import products with specials but when i export it does not have specials column how do i get the "v_specials_price", and "v_specials_expires_date" to also be in the spreadsheet to download?

Share this post


Link to post
Share on other sites

Yes, I did. Exactly the same.

I even reinstalled a fresh version of OScommerce just in case. Same result.

The new thing is that now, I still get :

 

File uploaded.

Temporary filename: /tmp/phpVxIlhI

User filename: EP2006Mar29-1907.txt

Size: 6611

| 2401000 | big-240100 | Boule Oeuf | Cette boul | | Ball Tea I | This metal | | Ball Tea I | This metal | | 5.27 | 228.00 | | 0000-00-00 | 1 | 1 | Color | Farbe | Color | 2 | Size | Gr??e | Talla | 3 | Model | Modell | Modelo | 5 | | Value | Value Ausg | Value | 6 | | Premium | Premium Au | Premium | 7 | | Deluxe | Deluxe Aus | Deluxe | 8 | | PS/2 | PS/2 Ansch | PS/2 | 9 | | USB | USB Anschl | USB | 4 | Memory | Speicher | Memoria | 1 | | 4 mb | 4 MB | 4 mb | 2 | | 8 mb | 8 MB | 8 mb | 3 | | 16 mb | 16 MB | 16 mb | 4 | | 32 mb | 32 MB | 32 mb | 5 | Version | Version | Version | 10 | | Download: | Download: | Download: | 13 | | Box: Windo | Box: Windo | Box: Windo | | | | | | | | | --none-- | Active Updated

| 531000 bi | 530430 bi |

 

when uploading file.

 

I also just realize that it's not using the same temp directory as the one defined in EP.

 

And when I do a "export to temp - complete" then "import from temp", I get:

Invalid argument supplied for foreach() in /home/bartonch/public_html/catalog/admin/easypopulate.php on line 677

 

I even tried to save the text file in several formats, unix, utf8, unicode for fun... no change.

 

 

Interesting. I don't have this problem when I upload into my store which is sitting on a Unix hosting server, but with the test version of my store, which is running on a Windows PC over Wamp, I get exactly the same result with exactly the same csv file that was imported just fine on the Unix system. Did you get the same result with tabs between the fields?

Share this post


Link to post
Share on other sites

I just realized that it imports the first one ok, and then stop after the second caracter of the image name from the second record.

 

Example:

 

File uploaded.

Temporary filename: /tmp/phpHNz43p

User filename: EP2006Mar29-1907.txt

Size: 6608

| 2401000 | big2401000 | Boule Oeuf | Cette boul | | Ball Tea I | This metal | | Ball Tea I | This metal | | 5.27 | 228.00 | | 0000-00-00 | 1 | 1 | Color | Farbe | Color | 2 | Size | Gr??e | Talla | 3 | Model | Modell | Modelo | 5 | | Value | Value Ausg | Value | 6 | | Premium | Premium Au | Premium | 7 | | Deluxe | Deluxe Aus | Deluxe | 8 | | PS/2 | PS/2 Ansch | PS/2 | 9 | | USB | USB Anschl | USB | 4 | Memory | Speicher | Memoria | 1 | | 4 mb | 4 MB | 4 mb | 2 | | 8 mb | 8 MB | 8 mb | 3 | | 16 mb | 16 MB | 16 mb | 4 | | 32 mb | 32 MB | 32 mb | 5 | Version | Version | Version | 10 | | Download: | Download: | Download: | 13 | | Box: Windo | Box: Windo | Box: Windo | | | | | | | | | --none-- | Active Updated

| 531000 bi | 530430 bi |

 

here is the line from the text file:

 

531000 big531000.gif Darjeeling (25 sachets) Th? en provenance de cette province d?Inde situ?e au nord du pays, sur les contreforts de l?Himalaya, a ?t? r?colt? durant les mois d??t? (2nd flush). Son go?t rappelle celui du fruit m?r. A d?guster ? toute heure de la journ?e. Darjeeling (25 bags) A tea originating from this Indian province,located in the North of the country, in the Himalayas foothills. It was picked during the summer months (2nd Flush).Its taste is reminiscent of ripe fruit. It can be enjoyed at any time of the day. Darjeeling (25 bags) A tea originating from this Indian province,located in the North of the country, in the Himalayas foothills. It was picked during the summer months (2nd Flush).Its taste is reminiscent of ripe fruit. It can be enjoyed at any time of the day. 10.14 228.00 0000-00-00 00:00:00 1 1 Color Farbe Color 2 Size Gr??e Talla 3 Model Modell Modelo 5 Value Value Ausgabe Value 6 Premium Premium Ausgabe Premium 7 Deluxe Deluxe Ausgabe Deluxe 8 PS/2 PS/2 Anschluss PS/2 9 USB USB Anschluss USB 4 Memory Speicher Memoria 1 4 mb 4 MB 4 mb 2 8 mb 8 MB 8 mb 3 16 mb 16 MB 16 mb 4 32 mb 32 MB 32 mb 5 Version Version Version 10 Download: Windows - English Download: Windows - Englisch Download: Windows - Inglese 13 Box: Windows - English Box: Windows - Englisch Box: Windows - Inglese Thes et tisanes Confections et sachets --none-- Active EOREOR

Share this post


Link to post
Share on other sites

I tryed to post this before and no answer... If this is not the right place, please let me know. "I have easy populate installed and cannot find out how to upload just a price change. If I upload only data in the model number field and price field and the EOREOR field it erases the data in all other fields. Is there a way to only update the fields you want to update without over writing the other fields?" Please help.


Laser labels, barcode labels, custom labels

Share this post


Link to post
Share on other sites

Importing with newly created fields not working. It will export with the new field column but not import.

 

 

Hello All!

 

If anyone has a mintue could you help me determine why the new fields I created using the 'ADD NEW PRODUCT FIELDS' contribution (http://www.oscommerce.com/community/contributions,2779) will not import using the EASY POPULATE interface? I created a new field called 'SKU' for placement on the Prodcut page and Product Listing screens. I followed the steps and was able to get it working and displaying in the site correctly.

 

The problem is that the when I do a COMPLETE EXPORT it shows the new column field (SKU). But when I import that same file with the SKU data filled in, it skips over that column and does not import any of the data. Could someone have a look at my code here and see what I'm doing wrong please?

 

<?php

// Current EP Version
$curver = '2.78-MS2';

/*
$Id: easypopulate.php,v 2.74 2004/05/03 VJ Exp $
*/

require('includes/application_top.php');

//**** File Splitting Configuration ****
// we attempt to set the timeout limit longer for this script to avoid having to split the files
// NOTE: If your server is running in safe mode, this setting cannot override the timeout set in php.ini
if (EP_SET_TIME_LIMIT == 'true') {set_time_limit(330);}

//**** Size of products_model in products table ****
// This is automatically set to the maximum defined size of products_model in the products table. We check to make sure all models are no longer than this value.
global $modelsize;
$table_definition_query=tep_db_query("describe " . TABLE_PRODUCTS);
while ($product_definition=tep_db_fetch_array($table_definition_query)){
if ($product_definition[Field]=='products_model'){
if (substr($product_definition[Type],0,7)=='varchar'){
$modelsize=substr($product_definition[Type],8,strlen($product_definition[Type]));
$modelsize=substr($modelsize,0,(strlen($modelsize)-1));
}
}
}
//**** Price includes tax? ****
global $price_with_tax;
$price_with_tax = (EP_PRICE_INC_TAX =='true' ? 1 : 0);

global $separator;
if (EP_DELIMITER == '\t') {
$separator = "\t"; // oscommerce stores escaped delimeters in mySQL as a string and not an actual tab.
} else {
$separator = EP_DELIMITER;
}


// change this if you want to download selected product options
// this might be handy, if you have a lot of product options, and your output file exceeds 256 columns (which is the max. limit MS Excel is able to handle)
global $attribute_options_select;
//$attribute_options_select = array('Size', 'Model'); // uncomment and fill with product options name you wish to download // comment this line, if you wish to download all product options
// VJ product attributes end

//*******************************
// If you are running a pre-Nov1-2002 snapshot of OSC, then we need this include line to avoid
// errors like:
// undefined function tep_get_uploaded_file
if (!function_exists(tep_get_uploaded_file)){
include (DIR_WS_FUNCTIONS . 'easypopulate_functions.php');
}
//*******************************

// VJ product attributes begin
global $attribute_options_array;
$attribute_options_array = array();

if (EP_PROD_ATTR == 'true') {
if (is_array($attribute_options_select) && (count($attribute_options_select) > 0)) {
foreach ($attribute_options_select as $value) {
$attribute_options_query = "select distinct products_options_id from " . TABLE_PRODUCTS_OPTIONS . " where products_options_name = '" . $value . "'";

$attribute_options_values = tep_db_query($attribute_options_query);

if ($attribute_options = tep_db_fetch_array($attribute_options_values)){
$attribute_options_array[] = array('products_options_id' => $attribute_options['products_options_id']);
}
}
} else {
$attribute_options_query = "select distinct products_options_id from " . TABLE_PRODUCTS_OPTIONS . " order by products_options_id";

$attribute_options_values = tep_db_query($attribute_options_query);

while ($attribute_options = tep_db_fetch_array($attribute_options_values)){
$attribute_options_array[] = array('products_options_id' => $attribute_options['products_options_id']);
}
}
}
// VJ product attributes end

global $filelayout, $filelayout_count, $filelayout_sql, $langcode, $fileheaders;

// these are the fields that will be defaulted to the current values in the database if they are not found in the incoming file
global $default_these;
$default_these = array(
'v_products_image',
#'v_products_dim_type',
#'v_products_length',
#'v_products_width',
#'v_products_height',
#'v_products_mimage',
#'v_products_bimage',
#'v_products_subimage1',
#'v_products_bsubimage1',
#'v_products_subimage2',
#'v_products_bsubimage2',
#'v_products_subimage3',
#'v_products_bsubimage3',
'v_categories_id',
'v_products_price',
'v_products_quantity',
'v_products_weight',
'v_date_avail',
'v_instock',
'v_tax_class_title',
'v_manufacturers_name',
'v_manufacturers_id',
'v_products_dim_type',
'v_products_length',
'v_products_width',
'v_products_height',
'v_products_status',
);

//elari check default language_id from configuration table DEFAULT_LANGUAGE
$epdlanguage_query = tep_db_query("select languages_id, name from " . TABLE_LANGUAGES . " where code = '" . DEFAULT_LANGUAGE . "'");
if (tep_db_num_rows($epdlanguage_query)) {
$epdlanguage = tep_db_fetch_array($epdlanguage_query);
$epdlanguage_id = $epdlanguage['languages_id'];
$epdlanguage_name = $epdlanguage['name'];
} else {
Echo 'Strange but there is no default language to work... That may not happen, just in case... ';
}

$langcode = ep_get_languages();

if ( $dltype != '' ){
// if dltype is set, then create the filelayout. Otherwise it gets read from the uploaded file
ep_create_filelayout($dltype); // get the right filelayout for this download
}

//*******************************
// E N D
// INITIALIZATION
//*******************************

//*******************************
// DOWNLOAD FILE
//*******************************
if ( $download == 'stream' or $download == 'tempfile' ){
$filestring = ""; // this holds the csv file we want to download
$result = tep_db_query($filelayout_sql);
$row = tep_db_fetch_array($result);

// Here we need to allow for the mapping of internal field names to external field names
// default to all headers named like the internal ones
// the field mapping array only needs to cover those fields that need to have their name changed
if ( count($fileheaders) != 0 ){
$filelayout_header = $fileheaders; // if they gave us fileheaders for the dl, then use them
} else {
$filelayout_header = $filelayout; // if no mapping was spec'd use the internal field names for header names
}
//We prepare the table heading with layout values
foreach( $filelayout_header as $key => $value ){
$filestring .= $key . $separator;
}
// now lop off the trailing tab
$filestring = substr($filestring, 0, strlen($filestring)-1); 

// set the type
if ( $dltype == 'froogle' ){
$endofrow = "\n";
} else {
// default to normal end of row
$endofrow = $separator . 'EOREOR' . "\n";
}
$filestring .= $endofrow;

$num_of_langs = count($langcode);
while ($row){


// if the filelayout says we need a products_name, get it
// build the long full froogle image path
$row['v_products_fullpath_image'] = EP_FROOGLE_IMG . $row['v_products_image'];
// Other froogle defaults go here for now
$row['v_froogle_instock'] = 'Y';
$row['v_froogle_shipping'] = '';
$row['v_froogle_upc'] = '';
$row['v_froogle_color'] = '';
$row['v_froogle_size'] = '';
$row['v_froogle_quantitylevel'] = '';
$row['v_froogle_manufacturer_id'] = '';
$row['v_froogle_exp_date'] = '';
$row['v_froogle_product_type'] = 'OTHER';
$row['v_froogle_delete'] = '';
$row['v_froogle_currency'] = 'EUR';
$row['v_froogle_offer_id'] = $row['v_products_model'];
$row['v_froogle_product_id'] = $row['v_products_model'];

// names and descriptions require that we loop thru all languages that are turned on in the store
foreach ($langcode as $key => $lang){
$lid = $lang['id'];

// for each language, get the description and set the vals
$sql2 = "SELECT *
FROM ".TABLE_PRODUCTS_DESCRIPTION."
WHERE
products_id = " . $row['v_products_id'] . " AND
language_id = '" . $lid . "'
";
$result2 = tep_db_query($sql2);
$row2 = tep_db_fetch_array($result2);

// I'm only doing this for the first language, since right now froogle is US only.. Fix later!
// adding url for froogle, but it should be available no matter what
if (EP_SEF_URLS == 'true'){
// if only one language
if ($num_of_langs == 1){
$row['v_froogle_products_url_' . $lid] = EP_FROOGLE_PROD . '/products_id/' . $row['v_products_id'];
} else {
$row['v_froogle_products_url_' . $lid] = EP_FROOGLE_PROD . '/products_id/' . $row['v_products_id'] . '/language/' . $lid;
}
} else {
if ($num_of_langs == 1){
$row['v_froogle_products_url_' . $lid] = EP_FROOGLE_PROD . '?products_id=' . $row['v_products_id'];
} else {
$row['v_froogle_products_url_' . $lid] = EP_FROOGLE_PROD . '?products_id=' . $row['v_products_id'] . '&language=' . $lid;
}
}

$row['v_products_name_' . $lid] = $row2['products_name'];
$row['v_products_description_' . $lid] = $row2['products_description'];
$row['v_products_url_' . $lid] = $row2['products_url'];

// froogle advanced format needs the quotes around the name and desc
$row['v_froogle_products_name_' . $lid] = '"' . strip_tags(str_replace('"','""',$row2['products_name'])) . '"';
$row['v_froogle_products_description_' . $lid] = '"' . strip_tags(str_replace('"','""',$row2['products_description'])) . '"';

// support for Linda's Header Controller 2.0 here
if(isset($filelayout['v_products_head_title_tag_' . $lid])){
$row['v_products_head_title_tag_' . $lid] = $row2['products_head_title_tag'];
$row['v_products_head_desc_tag_' . $lid] = $row2['products_head_desc_tag'];
$row['v_products_head_keywords_tag_' . $lid] = $row2['products_head_keywords_tag'];
}
// end support for Header Controller 2.0
}

// for the categories, we need to keep looping until we find the root category

// start with v_categories_id
// Get the category description
// set the appropriate variable name
// if parent_id is not null, then follow it up.
// we'll populate an aray first, then decide where it goes in the
$thecategory_id = $row['v_categories_id'];
$fullcategory = ''; // this will have the entire category stack for froogle
for( $categorylevel=1; $categorylevel<EP_MAX_CAT+1; $categorylevel++){
if ($thecategory_id){
$sql2 = "SELECT categories_name
FROM ".TABLE_CATEGORIES_DESCRIPTION."
WHERE 
categories_id = " . $thecategory_id . " AND
language_id = " . $epdlanguage_id;

$result2 = tep_db_query($sql2);
$row2 = tep_db_fetch_array($result2);
// only set it if we found something
$temprow['v_categories_name_' . $categorylevel] = $row2['categories_name'];
// now get the parent ID if there was one
$sql3 = "SELECT parent_id
FROM ".TABLE_CATEGORIES."
WHERE
categories_id = " . $thecategory_id;
$result3 = tep_db_query($sql3);
$row3 = tep_db_fetch_array($result3);
$theparent_id = $row3['parent_id'];
if ($theparent_id != ''){
// there was a parent ID, lets set thecategoryid to get the next level
$thecategory_id = $theparent_id;
} else {
// we have found the top level category for this item,
$thecategory_id = false;
}
//$fullcategory .= " > " . $row2['categories_name'];
$fullcategory = $row2['categories_name'] . " > " . $fullcategory;
} else {
$temprow['v_categories_name_' . $categorylevel] = '';
}
}
// now trim off the last ">" from the category stack
$row['v_category_fullpath'] = substr($fullcategory,0,strlen($fullcategory)-3);

// temprow has the old style low to high level categories.
$newlevel = 1;
// let's turn them into high to low level categories
for( $categorylevel=6; $categorylevel>0; $categorylevel--){
if ($temprow['v_categories_name_' . $categorylevel] != ''){
$row['v_categories_name_' . $newlevel++] = $temprow['v_categories_name_' . $categorylevel];
}
}
// if the filelayout says we need a manufacturers name, get it
if (isset($filelayout['v_manufacturers_name'])){
if ($row['v_manufacturers_id'] != ''){
$sql2 = "SELECT manufacturers_name
FROM ".TABLE_MANUFACTURERS."
WHERE
manufacturers_id = " . $row['v_manufacturers_id']
;
$result2 = tep_db_query($sql2);
$row2 = tep_db_fetch_array($result2);
$row['v_manufacturers_name'] = $row2['manufacturers_name'];
}
}
// If you have other modules that need to be available, put them here

// VJ product attribs begin
if (isset($filelayout['v_attribute_options_id_1'])){
$languages = tep_get_languages();

$attribute_options_count = 1;
foreach ($attribute_options_array as $attribute_options) {
$row['v_attribute_options_id_' . $attribute_options_count] = $attribute_options['products_options_id'];

for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
$lid = $languages[$i]['id'];

$attribute_options_languages_query = "select products_options_name from " . TABLE_PRODUCTS_OPTIONS . " where products_options_id = '" . (int)$attribute_options['products_options_id'] . "' and language_id = '" . (int)$lid . "'";

$attribute_options_languages_values = tep_db_query($attribute_options_languages_query);

$attribute_options_languages = tep_db_fetch_array($attribute_options_languages_values);

$row['v_attribute_options_name_' . $attribute_options_count . '_' . $lid] = $attribute_options_languages['products_options_name'];
}

$attribute_values_query = "select products_options_values_id from " . TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS . " where products_options_id = '" . (int)$attribute_options['products_options_id'] . "' order by products_options_values_id";

$attribute_values_values = tep_db_query($attribute_values_query);

$attribute_values_count = 1;
while ($attribute_values = tep_db_fetch_array($attribute_values_values)) {
$row['v_attribute_values_id_' . $attribute_options_count . '_' . $attribute_values_count] = $attribute_values['products_options_values_id'];

$attribute_values_price_query = "select options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int)$row['v_products_id'] . "' and options_id = '" . (int)$attribute_options['products_options_id'] . "' and options_values_id = '" . (int)$attribute_values['products_options_values_id'] . "'";

$attribute_values_price_values = tep_db_query($attribute_values_price_query);

$attribute_values_price = tep_db_fetch_array($attribute_values_price_values);

$row['v_attribute_values_price_' . $attribute_options_count . '_' . $attribute_values_count] = $attribute_values_price['price_prefix'] . $attribute_values_price['options_values_price'];

//// attributes stock add start 
if ( $products_attributes_stock == true ) { 
$stock_attributes = $attribute_options['products_options_id'].'-'.$attribute_values['products_options_values_id'];

$stock_quantity_query = tep_db_query("select products_stock_quantity from " . TABLE_PRODUCTS_STOCK . " where products_id = '" . (int)$row['v_products_id'] . "' and products_stock_attributes = '" . $stock_attributes . "'");
$stock_quantity = tep_db_fetch_array($stock_quantity_query);

$row['v_attribute_values_stock_' . $attribute_options_count . '_' . $attribute_values_count] = $stock_quantity['products_stock_quantity'];
}
//// attributes stock add end 


for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
$lid = $languages[$i]['id'];

$attribute_values_languages_query = "select products_options_values_name from " . TABLE_PRODUCTS_OPTIONS_VALUES . " where products_options_values_id = '" . (int)$attribute_values['products_options_values_id'] . "' and language_id = '" . (int)$lid . "'";

$attribute_values_languages_values = tep_db_query($attribute_values_languages_query);

$attribute_values_languages = tep_db_fetch_array($attribute_values_languages_values);

$row['v_attribute_values_name_' . $attribute_options_count . '_' . $attribute_values_count . '_' . $lid] = $attribute_values_languages['products_options_values_name'];
}

$attribute_values_count++;
}

$attribute_options_count++;
}
}
// VJ product attribs end

// this is for the separate price per customer module
if (isset($filelayout['v_customer_price_1'])){
$sql2 = "SELECT
customers_group_price,
customers_group_id
FROM
".TABLE_PRODUCTS_GROUPS."
WHERE
products_id = " . $row['v_products_id'] . "
ORDER BY
customers_group_id"
;
$result2 = tep_db_query($sql2);
$ll = 1;
$row2 = tep_db_fetch_array($result2);
while( $row2 ){
$row['v_customer_group_id_' . $ll] = $row2['customers_group_id'];
$row['v_customer_price_' . $ll] = $row2['customers_group_price'];
$row2 = tep_db_fetch_array($result2);
$ll++;
}
}
if ($dltype == 'froogle'){
// For froogle, we check the specials prices for any applicable specials, and use that price
// by grabbing the specials id descending, we always get the most recently added special price
// I'm checking status because I think you can turn off specials
$sql2 = "SELECT
specials_new_products_price
FROM
".TABLE_SPECIALS."
WHERE
products_id = " . $row['v_products_id'] . " and
status = 1 and
expires_date < CURRENT_TIMESTAMP
ORDER BY
specials_id DESC"
;
$result2 = tep_db_query($sql2);
$ll = 1;
$row2 = tep_db_fetch_array($result2);
if( $row2 ){
// reset the products price to our special price if there is one for this product
$row['v_products_price'] = $row2['specials_new_products_price'];
}
}

//elari -
//We check the value of tax class and title instead of the id
//Then we add the tax to price if $price_with_tax is set to 1
$row_tax_multiplier = tep_get_tax_class_rate($row['v_tax_class_id']);
$row['v_tax_class_title'] = tep_get_tax_class_title($row['v_tax_class_id']);
$row['v_products_price'] = round($row['v_products_price'] +
($price_with_tax * $row['v_products_price'] * $row_tax_multiplier / 100),2);


// Now set the status to a word the user specd in the config vars
if ( $row['v_status'] == '1' ){
$row['v_status'] = EP_STATUS_ACTIVE;
} else {
$row['v_status'] = EP_STATUS_INACTIVE;
}

// remove any bad things in the texts that could confuse EasyPopulate
$therow = '';
foreach( $filelayout as $key => $value ){
//echo "The field was $key<br>";

$thetext = $row[$key];
// kill the carriage returns and tabs in the descriptions, they're killing me!
$thetext = str_replace("\r",' ',$thetext);
$thetext = str_replace("\n",' ',$thetext);
$thetext = str_replace("\t",' ',$thetext);
// and put the text into the output separated by tabs
$therow .= $thetext . $separator;
}

// lop off the trailing tab, then append the end of row indicator
$therow = substr($therow,0,strlen($therow)-1) . $endofrow;

$filestring .= $therow;
// grab the next row from the db
$row = tep_db_fetch_array($result);
}

#$EXPORT_TIME=time();
$EXPORT_TIME = strftime('%Y%b%d-%H%I');
if ($dltype=="froogle"){
$EXPORT_TIME = "FroogleEP" . $EXPORT_TIME;
} else {
$EXPORT_TIME = "EP" . $EXPORT_TIME;
}

// now either stream it to them or put it in the temp directory
if ($download == 'stream'){
//*******************************
// STREAM FILE
//*******************************
header("Content-type: application/vnd.ms-excel");
header("Content-disposition: attachment; filename=$EXPORT_TIME.txt");
// Changed if using SSL, helps prevent program delay/timeout (add to backup.php also)
// header("Pragma: no-cache");
if ($request_type== 'NONSSL'){
header("Pragma: no-cache");
} else {
header("Pragma: ");
}
header("Expires: 0");
echo $filestring;
die();
} else {
//*******************************
// PUT FILE IN TEMP DIR
//*******************************
$tmpfname = DIR_FS_DOCUMENT_ROOT . EP_TEMP_DIR . "$EXPORT_TIME.txt";
//unlink($tmpfname);
$fp = fopen( $tmpfname, "w+");
fwrite($fp, $filestring);
fclose($fp);
echo "You can get your file in the Tools/Files under " . EP_TEMP_DIR . "EP" . $EXPORT_TIME . ".txt";
die();
}
}
//*******************************
// E N D
// DOWNLOAD FILE
//*******************************
?>

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<link rel="stylesheet" type="text/css" href="includes/stylesheet.css">
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0" bgcolor="#FFFFFF">
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>

<table border="0" width="100%" cellspacing="2" cellpadding="2">
<tr>
<td width="<?php echo BOX_WIDTH; ?>" valign="top" height="844">
<table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="1" cellpadding="1" class="columnLeft">
<?php require(DIR_WS_INCLUDES . 'column_left.php');?>
</table></td>
<td class="pageHeading" valign="top">
<?php echo HEADING_TITLE_EP . "<p>" .DEFAUL_LANGUAGE_EP . " " . $epdlanguage_name; ?>
<table width="75%" border="2">
<tr>
<td width="75%">
<FORM ENCTYPE="multipart/form-data" ACTION="easypopulate.php?split=0" METHOD=POST>
<p>
<div align = "left">
<p><b><?php echo IMPORT_EP; ?></b></p>
<p>
<INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="100000000">
<p></p>
<input name="usrfl" type="file" size="50">
<input type="submit" name="buttoninsert" value="Insert into db">
<br>
</p>
</div>

</form>

<FORM ENCTYPE="multipart/form-data" ACTION="easypopulate.php?split=1" METHOD=POST>
<p>
<div align = "left">
<p><b><?php echo SPLIT_EP; ?></b></p>
<p>
<INPUT TYPE="hidden" name="MAX_FILE_SIZE" value="1000000000">
<p></p>
<input name="usrfl" type="file" size="50">
<input type="submit" name="buttonsplit" value="Split file">
<br>
</p>
</div>

</form>

<FORM ENCTYPE="multipart/form-data" ACTION="easypopulate.php" METHOD=POST>
<p>
<div align = "left">
<p><b><?php echo IMPORT_TMP_EP; ?><? echo EP_TEMP_DIR; ?><? echo " :" ?></b></p>
<p class="smallText">
<INPUT TYPE="text" name="localfile" size="50">
<input type="submit" name="buttoninsert" value="Insert into db">
<br>
</p>
</div>

</form>




<p><b><?php echo DOWNLOAD_EP; ?></b></p>

<!-- Download file links - Add your custom fields here -->
<a href="easypopulate.php?download=stream&dltype=full"><?php echo DOWNLOAD_EP_2; ?><b><?php echo COMPLETE_EP; ?></b></a><br>
<a href="easypopulate.php?download=stream&dltype=priceqty"><?php echo DOWNLOAD_EP_2; ?><b><?php echo MODEL_PRICE_QUANTITY_EP; ?></b></a><br>
<a href="easypopulate.php?download=stream&dltype=category"><?php echo DOWNLOAD_EP_2; ?><b><?php echo MODEL_CATEGORY_EP; ?></b></a><br>
<!-- VJ product attributes begin //-->
<?php if (EP_PROD_ATTR == 'true') {?>
<a href="easypopulate.php?download=stream&dltype=attrib"><?php echo DOWNLOAD_EP_2; ?><b><?php echo MODEL_ATTRIBUTES_EP; ?></b></a><br>
<?php }?>
<!-- VJ product attributes end //-->
<a href="easypopulate.php?download=stream&dltype=extra_field"><?php echo DOWNLOAD_EP_2; ?><b><?php echo EXTRA_FIELD_EP; ?></b></a><br>
<a href="easypopulate.php?download=stream&dltype=froogle"><?php echo DOWNLOAD_EP_2; ?><b><?php echo FROOGLE_EP; ?></b></a><br>


<p><b><?php echo CREATE_EP; ?><? echo EP_TEMP_DIR; ?><? echo " :" ?></b></p>
<a href="easypopulate.php?download=tempfile&dltype=full"><?php echo CREATE_EP_2; ?><b><?php echo COMPLETE_EP; ?></b></a><br>
<a href="easypopulate.php?download=tempfile&dltype=priceqty"><?php echo CREATE_EP_2; ?><b><?php echo MODEL_PRICE_QUANTITY_EP; ?></b></a><br>
<a href="easypopulate.php?download=tempfile&dltype=category"><?php echo CREATE_EP_2; ?><b><?php echo MODEL_CATEGORY_EP; ?></b></a><br>
<!-- VJ product attributes begin //-->
<a href="easypopulate.php?download=tempfile&dltype=attrib"><?php echo CREATE_EP_2; ?><b><?php echo MODEL_ATTRIBUTES_EP; ?></b></a><br>
<!-- VJ product attributes end //-->
<a href="easypopulate.php?download=tempfile&dltype=extra_field"><?php echo CREATE_EP_2; ?><b><?php echo EXTRA_FIELD_EP; ?></b></a><br> 
<a href="easypopulate.php?download=tempfile&dltype=froogle"><?php echo CREATE_EP_2; ?><b><?php echo FROOGLE_EP; ?></b></a><br>

</td>
</tr>
</table>
<p class="smallText"> </p>
<p class="smallText">
<?php

//*******************************
// UPLOAD AND INSERT FILE
//*******************************
if ($localfile or (is_uploaded_file($usrfl) && $split==0)) {
if ($usrfl){
// move the file to where we can work with it
$file = tep_get_uploaded_file('usrfl');
if (is_uploaded_file($file['tmp_name'])) {
tep_copy_uploaded_file($file, DIR_FS_DOCUMENT_ROOT . EP_TEMP_DIR);
}
echo "<p class=smallText>";
echo FILE_UPLOAD_EP . "<br>";
echo TEMPORARY_FILENAME_EP . $usrfl . "<br>";
echo USER_FILENAME_EP . $usrfl_name . "<br>";
echo SIZE_EP . $usrfl_size . "<br>";

// get the entire file into an array
$readed = file(DIR_FS_DOCUMENT_ROOT . EP_TEMP_DIR . $usrfl_name);
}
if ($localfile){
// move the file to where we can work with it
$file = tep_get_uploaded_file('usrfl');
$attribute_options_query = "select distinct products_options_id from " . TABLE_PRODUCTS_OPTIONS . " order by products_options_id";
$attribute_options_values = tep_db_query($attribute_options_query);
$attribute_options_count = 1;
//while ($attribute_options = tep_db_fetch_array($attribute_options_values)){
if (is_uploaded_file($file['tmp_name'])) {
tep_copy_uploaded_file($file, DIR_FS_DOCUMENT_ROOT . EP_TEMP_DIR);
}

echo "<p class=smallText>";
echo "Filename: " . $localfile . "<br>";

// get the entire file into an array
$readed = file(DIR_FS_DOCUMENT_ROOT . EP_TEMP_DIR . $localfile);
}

// now we string the entire thing together in case there were carriage returns in the data
$newreaded = "";
foreach ($readed as $read){
$newreaded .= $read;
}

// now newreaded has the entire file together without the carriage returns.
// if for some reason excel put qoutes around our EOREOR, remove them then split into rows
$newreaded = str_replace('"EOREOR"', 'EOREOR', $newreaded);
$readed = explode( $separator . 'EOREOR',$newreaded);


// Now we'll populate the filelayout based on the header row.
$theheaders_array = explode( $separator, $readed[0] ); // explode the first row, it will be our filelayout
$lll = 0;
$filelayout = array();
foreach( $theheaders_array as $header ){
$cleanheader = str_replace( '"', '', $header);
// echo "Fileheader was $header<br><br><br>";
$filelayout[ $cleanheader ] = $lll++; //
}
unset($readed[0]); // we don't want to process the headers with the data

// now we've got the array broken into parts by the expicit end-of-row marker.
array_walk($readed, 'walk');
}

//*******************************
// UPLOAD AND SPLIT FILE
//*******************************
if (is_uploaded_file($usrfl) && $split==1) {
// move the file to where we can work with it
$file = tep_get_uploaded_file('usrfl');
//echo "Trying to move file...";
if (is_uploaded_file($file['tmp_name'])) {
tep_copy_uploaded_file($file, DIR_FS_DOCUMENT_ROOT . EP_TEMP_DIR);
}

$infp = fopen(DIR_FS_DOCUMENT_ROOT . EP_TEMP_DIR . $usrfl_name, "r");

//toprow has the field headers
$toprow = fgets($infp,32768);

$filecount = 1;

echo "Creating file EP_Split" . $filecount . ".txt ... ";
$tmpfname = DIR_FS_DOCUMENT_ROOT . EP_TEMP_DIR . "EP_Split" . $filecount . ".txt";
$fp = fopen( $tmpfname, "w+");
fwrite($fp, $toprow);

$linecount = 0;
$line = fgets($infp,32768);
while ($line){
// walking the entire file one row at a time
// but a line is not necessarily a complete row, we need to split on rows that have "EOREOR" at the end
$line = str_replace('"EOREOR"', 'EOREOR', $line);
fwrite($fp, $line);
if (strpos($line, 'EOREOR')){
// we found the end of a line of data, store it
$linecount++; // increment our line counter
if ($linecount >= EP_MAX_RECS){
echo "Added $linecount records and closing file... <Br>";
$linecount = 0; // reset our line counter
// close the existing file and open another;
fclose($fp);
// increment filecount
$filecount++;
echo "Creating file EP_Split" . $filecount . ".txt ... ";
$tmpfname = DIR_FS_DOCUMENT_ROOT . EP_TEMP_DIR . "EP_Split" . $filecount . ".txt";
//Open next file name
$fp = fopen( $tmpfname, "w+");
fwrite($fp, $toprow);
}
}
$line=fgets($infp,32768);
}
echo "Added $linecount records and closing file...<br><br> ";
fclose($fp);
fclose($infp);

echo "You can download your split files in the Tools/Files under /catalog/temp/";

}

?>
</p></td>
</tr>
</table>

<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>

<p> </p>
<p> </p><p><br>
</p></body>
</html>

<?php

function ep_get_languages() {
$languages_query = tep_db_query("select languages_id, code from " . TABLE_LANGUAGES . " order by sort_order");
// start array at one, the rest of the code expects it that way
$ll =1;
while ($ep_languages = tep_db_fetch_array($languages_query)) {
//will be used to return language_id en language code to report in product_name_code instead of product_name_id
$ep_languages_array[$ll++] = array(
'id' => $ep_languages['languages_id'],
'code' => $ep_languages['code']
);
}
return $ep_languages_array;
};

function tep_get_tax_class_rate($tax_class_id) {
$tax_multiplier = 0;
$tax_query = tep_db_query("select SUM(tax_rate) as tax_rate from " . TABLE_TAX_RATES . " WHERE tax_class_id = '" . $tax_class_id . "' GROUP BY tax_priority");
if (tep_db_num_rows($tax_query)) {
while ($tax = tep_db_fetch_array($tax_query)) {
$tax_multiplier += $tax['tax_rate'];
}
}
return $tax_multiplier;
};

function tep_get_tax_title_class_id($tax_class_title) {
$classes_query = tep_db_query("select tax_class_id from " . TABLE_TAX_CLASS . " WHERE tax_class_title = '" . $tax_class_title . "'" );
$tax_class_array = tep_db_fetch_array($classes_query);
$tax_class_id = $tax_class_array['tax_class_id'];
return $tax_class_id;
}

function print_el( $item2 ) {
echo " | " . substr(strip_tags($item2), 0, 10);
};

function print_el1( $item2 ) {
echo sprintf("| %'.4s ", substr(strip_tags($item2), 0, 80));
};
function ep_create_filelayout($dltype){
global $filelayout, $filelayout_count, $filelayout_sql, $langcode, $fileheaders;
// depending on the type of the download the user wanted, create a file layout for it.
$fieldmap = array(); // default to no mapping to change internal field names to external.
switch( $dltype ){

case 'full':
// The file layout is dynamically made depending on the number of languages
$iii = 0;
$filelayout = array(
'v_products_model' => $iii++,
'v_products_image' => $iii++,
);

foreach ($langcode as $key => $lang){
$l_id = $lang['id'];
// uncomment the head_title, head_desc, and head_keywords to use
// Linda's Header Tag Controller 2.0
//echo $langcode['id'] . $langcode['code'];
$filelayout = array_merge($filelayout , array(
'v_products_name_' . $l_id => $iii++,
'v_products_description_' . $l_id => $iii++,
'v_products_url_' . $l_id => $iii++,
'v_products_head_title_tag_'.$l_id => $iii++,
'v_products_head_desc_tag_'.$l_id => $iii++,
'v_products_head_keywords_tag_'.$l_id => $iii++,
));
}


// uncomment the customer_price and customer_group to support multi-price per product contrib

// VJ product attribs begin
$header_array = array(
'v_products_price' => $iii++,
'v_products_weight' => $iii++,
'v_date_avail' => $iii++,
'v_date_added' => $iii++,
'v_products_quantity' => $iii++,
);

$languages = tep_get_languages();

global $attribute_options_array;

$attribute_options_count = 1;
foreach ($attribute_options_array as $attribute_options_values) {
$key1 = 'v_attribute_options_id_' . $attribute_options_count;
$header_array[$key1] = $iii++;

for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
$l_id = $languages[$i]['id'];

$key2 = 'v_attribute_options_name_' . $attribute_options_count . '_' . $l_id;
$header_array[$key2] = $iii++;
}

$attribute_values_query = "select products_options_values_id from " . TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS . " where products_options_id = '" . (int)$attribute_options_values['products_options_id'] . "' order by products_options_values_id";

$attribute_values_values = tep_db_query($attribute_values_query);

$attribute_values_count = 1;
while ($attribute_values = tep_db_fetch_array($attribute_values_values)) {
$key3 = 'v_attribute_values_id_' . $attribute_options_count . '_' . $attribute_values_count;
$header_array[$key3] = $iii++;

$key4 = 'v_attribute_values_price_' . $attribute_options_count . '_' . $attribute_values_count;
$header_array[$key4] = $iii++;

for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
$l_id = $languages[$i]['id'];

$key5 = 'v_attribute_values_name_' . $attribute_options_count . '_' . $attribute_values_count . '_' . $l_id;
$header_array[$key5] = $iii++;
}



//// attributes stock add start
if ( $products_attributes_stock == true ) { 
$key6 = 'v_attribute_values_stock_' . $attribute_options_count . '_' . $attribute_values_count;
$header_array[$key6] = $iii++;
}
//// attributes stock add end

$attribute_values_count++;
}

$attribute_options_count++;
}

$header_array['v_manufacturers_name'] = $iii++;

$filelayout = array_merge($filelayout, $header_array);
// VJ product attribs end

// build the categories name section of the array based on the number of categores the user wants to have
for($i=1;$i<EP_MAX_CAT+1;$i++){
$filelayout = array_merge($filelayout, array('v_categories_name_' . $i => $iii++));
}

$filelayout = array_merge($filelayout, array(
'v_tax_class_title' => $iii++,
'v_status' => $iii++,
'v_sku' => $iii++,
));

$filelayout_sql = "SELECT
p.products_sku as v_products_sku,
p.products_id as v_products_id,
p.products_model as v_products_model,
p.products_image as v_products_image,
p.products_price as v_products_price,
p.products_weight as v_products_weight,
p.products_date_available as v_date_avail,
p.products_date_added as v_date_added,
p.products_tax_class_id as v_tax_class_id,
p.products_quantity as v_products_quantity,
p.manufacturers_id as v_manufacturers_id,
subc.categories_id as v_categories_id,
p.products_status as v_status
FROM
".TABLE_PRODUCTS." as p,
".TABLE_CATEGORIES." as subc,
".TABLE_PRODUCTS_TO_CATEGORIES." as ptoc
WHERE
p.products_id = ptoc.products_id AND
ptoc.categories_id = subc.categories_id
";
break;
case 'priceqty':
$iii = 0;
// uncomment the customer_price and customer_group to support multi-price per product contrib
$filelayout = array(
'v_products_model' => $iii++,
'v_products_price' => $iii++,
'v_products_quantity' => $iii++,
'v_customer_price_1' => $iii++,
'v_customer_group_id_1' => $iii++,
'v_customer_price_2' => $iii++,
'v_customer_group_id_2' => $iii++,
#'v_customer_price_3' => $iii++,
#'v_customer_group_id_3' => $iii++,
#'v_customer_price_4' => $iii++,
#'v_customer_group_id_4' => $iii++,
#'v_customer_price_5' => $iii++,
#'v_customer_group_id_5' => $iii++,
#'v_customer_price_6' => $iii++,
#'v_customer_group_id_6' => $iii++,
);
$filelayout_sql = "SELECT
p.products_id as v_products_id,
p.products_model as v_products_model,
p.products_price as v_products

Share this post


Link to post
Share on other sites

...CONTINUED CODE FROM LAST POST

 

My code was too long so I have to cut it in half. This the second part of the same page.

 

 //elari -
//We check the value of tax class and title instead of the id
//Then we add the tax to price if $price_with_tax is set to true
$row_tax_multiplier = tep_get_tax_class_rate($row['v_tax_class_id']);
$row['v_tax_class_title'] = tep_get_tax_class_title($row['v_tax_class_id']);
if ($price_with_tax){
$row['v_products_price'] = round($row['v_products_price'] + ($row['v_products_price'] * $row_tax_multiplier / 100),2);
}

// now create the internal variables that will be used
// the $$thisvar is on purpose: it creates a variable named what ever was in $thisvar and sets the value
foreach ($default_these as $thisvar){
$$thisvar = $row[$thisvar];
}

$row = tep_db_fetch_array($result);
}

// this is an important loop. What it does is go thru all the fields in the incoming file and set the internal vars.
// Internal vars not set here are either set in the loop above for existing records, or not set at all (null values)
// the array values are handled separatly, although they will set variables in this loop, we won't use them.
foreach( $filelayout as $key => $value ){
$$key = $items[ $value ];
}

// so how to handle these? we shouldn't built the array unless it's been giving to us.
// The assumption is that if you give us names and descriptions, then you give us name and description for all applicable languages
foreach ($langcode as $lang){
//echo "Langid is " . $lang['id'] . "<br>";
$l_id = $lang['id'];
if (isset($filelayout['v_products_name_' . $l_id ])){
//we set dynamically the language values
$v_products_name[$l_id] = $items[$filelayout['v_products_name_' . $l_id]];
$v_products_description[$l_id] = $items[$filelayout['v_products_description_' . $l_id ]];
$v_products_url[$l_id] = $items[$filelayout['v_products_url_' . $l_id ]];
// support for Linda's Header Controller 2.0 here
if(isset($filelayout['v_products_head_title_tag_' . $l_id])){
$v_products_head_title_tag[$l_id] = $items[$filelayout['v_products_head_title_tag_' . $l_id]];
$v_products_head_desc_tag[$l_id] = $items[$filelayout['v_products_head_desc_tag_' . $l_id]];
$v_products_head_keywords_tag[$l_id] = $items[$filelayout['v_products_head_keywords_tag_' . $l_id]];
}
// end support for Header Controller 2.0
}
}
//elari... we get the tax_clas_id from the tax_title
//on screen will still be displayed the tax_class_title instead of the id....
if ( isset( $v_tax_class_title) ){
$v_tax_class_id = tep_get_tax_title_class_id($v_tax_class_title);
}
//we check the tax rate of this tax_class_id
$row_tax_multiplier = tep_get_tax_class_rate($v_tax_class_id);

//And we recalculate price without the included tax...
//Since it seems display is made before, the displayed price will still include tax
//This is same problem for the tax_clas_id that display tax_class_title
if ($price_with_tax){
$v_products_price = round( $v_products_price / (1 + ( $row_tax_multiplier * $price_with_tax/100) ), 4);
}

// if they give us one category, they give us all 6 categories
unset ($v_categories_name); // default to not set.
if ( isset( $filelayout['v_categories_name_1'] ) ){
$newlevel = 1;
for( $categorylevel=6; $categorylevel>0; $categorylevel--){
if ( $items[$filelayout['v_categories_name_' . $categorylevel]] != ''){
$v_categories_name[$newlevel++] = $items[$filelayout['v_categories_name_' . $categorylevel]];
}
}
while( $newlevel < EP_MAX_CAT+1){
$v_categories_name[$newlevel++] = ''; // default the remaining items to nothing
}
}

if (ltrim(rtrim($v_products_quantity)) == '') {
$v_products_quantity = 1;
}
if ($v_date_avail == '') {
// $v_date_avail = "CURRENT_TIMESTAMP";
$v_date_avail = "NULL";
} else {
// we put the quotes around it here because we can't put them into the query, because sometimes
// we will use the "current_timestamp", which can't have quotes around it.
$v_date_avail = '"' . $v_date_avail . '"';
}

if ($v_date_added == '') {
$v_date_added = "CURRENT_TIMESTAMP";
} else {
// we put the quotes around it here because we can't put them into the query, because sometimes
// we will use the "current_timestamp", which can't have quotes around it.
$v_date_added = '"' . $v_date_added . '"';
}


// default the stock if they spec'd it or if it's blank
$v_db_status = '1'; // default to active
if ($v_status == EP_STATUS_INACTIVE){
// they told us to deactivate this item
$v_db_status = '0';
}
if (EP_ZERO_QTY == 'true' && $v_products_quantity == 0) {
// if they said that zero qty products should be deactivated, let's deactivate if the qty is zero
$v_db_status = '0';
}

if ($v_manufacturer_id==''){
$v_manufacturer_id="NULL";
}

if (trim($v_products_image)==''){
$v_products_image = EP_PROD_IMAGE;
}

if (strlen($v_products_model) > $modelsize ){
echo "<font color='red'>" . strlen($v_products_model) . $v_products_model . "... ERROR! - Too many characters in the model number.<br>
12 is the maximum on a standard OSC install.<br>
Your maximum product_model length is set to $modelsize<br>
You can either shorten your model numbers or increase the size of the field in the database.</font>";
die();
}

// OK, we need to convert the manufacturer's name into id's for the database
if ( isset($v_manufacturers_name) && $v_manufacturers_name != '' ){
$sql = "SELECT man.manufacturers_id
FROM ".TABLE_MANUFACTURERS." as man
WHERE
man.manufacturers_name = '" . $v_manufacturers_name . "'";
$result = tep_db_query($sql);
$row = tep_db_fetch_array($result);
if ( $row != '' ){
foreach( $row as $item ){
$v_manufacturer_id = $item;
}
} else {
// to add, we need to put stuff in categories and categories_description
$sql = "SELECT MAX( manufacturers_id) max FROM ".TABLE_MANUFACTURERS;
$result = tep_db_query($sql);
$row = tep_db_fetch_array($result);
$max_mfg_id = $row['max']+1;
// default the id if there are no manufacturers yet
if (!is_numeric($max_mfg_id) ){
$max_mfg_id=1;
}

// Uncomment this query if you have an older 2.2 codebase
/*
$sql = "INSERT INTO ".TABLE_MANUFACTURERS."(manufacturers_id, manufacturers_name, manufacturers_image) VALUES ('".$max_mfg_id."','".$v_manufacturers_name."','".EP_MANF_IMAGE."')";
*/

// Comment this query out if you have an older 2.2 codebase
$sql = "INSERT INTO ".TABLE_MANUFACTURERS."(manufacturers_id, manufacturers_name, manufacturers_image, date_added, last_modified) VALUES ('" . $max_mfg_id . "', '" . $v_manufacturers_name . "','" . EP_MANF_IMAGE . "', " . CURRENT_TIMESTAMP . "," . CURRENT_TIMESTAMP . ")";
$result = tep_db_query($sql);
$v_manufacturer_id = $max_mfg_id;
}
}
// if the categories names are set then try to update them
if ( isset($v_categories_name_1)){
// start from the highest possible category and work our way down from the parent
$v_categories_id = 0;
$theparent_id = 0;
for ( $categorylevel=EP_MAX_CAT+1; $categorylevel>0; $categorylevel-- ){
$thiscategoryname = $v_categories_name[$categorylevel];
if ( $thiscategoryname != ''){
// we found a category name in this field

// now the subcategory
$sql = "SELECT cat.categories_id
FROM ".TABLE_CATEGORIES." as cat, 
".TABLE_CATEGORIES_DESCRIPTION." as des
WHERE
cat.categories_id = des.categories_id AND
des.language_id = $epdlanguage_id AND
cat.parent_id = " . $theparent_id . " AND
des.categories_name = '" . $thiscategoryname . "'";
$result = tep_db_query($sql);
$row = tep_db_fetch_array($result);
if ( $row != '' ){
foreach( $row as $item ){
$thiscategoryid = $item;
}
} else {
// to add, we need to put stuff in categories and categories_description
$sql = "SELECT MAX( categories_id) max FROM ".TABLE_CATEGORIES;
$result = tep_db_query($sql);
$row = tep_db_fetch_array($result);
$max_category_id = $row['max']+1;
if (!is_numeric($max_category_id) ){
$max_category_id=1;
}
$sql = "INSERT INTO ".TABLE_CATEGORIES."& #40;categories_id,categories_image,parent_id,sort_order,date_added,last_modified
) VALUES ($max_category_id,'".EP_CAT_IMAGE."',$theparent_id,0,CURRENT_TIMESTAMP,CURRENT_TIMESTAMP)";
$result = tep_db_query($sql);
$sql = "INSERT INTO ".TABLE_CATEGORIES_DESCRIPTION."(
categories_id,
language_id,
categories_name
) VALUES (
$max_category_id,
'$epdlanguage_id',
'$thiscategoryname'
)";
$result = tep_db_query($sql);
$thiscategoryid = $max_category_id;
}
// the current catid is the next level's parent
$theparent_id = $thiscategoryid;
$v_categories_id = $thiscategoryid; // keep setting this, we need the lowest level category ID later
}
}
}

if ($v_products_model != "") {
// products_model exists!
array_walk($items, 'print_el');

// First we check to see if this is a product in the current db.
$result = tep_db_query("SELECT products_id FROM ".TABLE_PRODUCTS." WHERE (products_model = '". $v_products_model . "')");

if (tep_db_num_rows($result) == 0) {
// insert into products

$sql = "SHOW TABLE STATUS LIKE '".TABLE_PRODUCTS."'";
$result = tep_db_query($sql);
$row = tep_db_fetch_array($result);
$max_product_id = $row['Auto_increment'];
if (!is_numeric($max_product_id) ){
$max_product_id=1;
}
$v_products_id = $max_product_id;
echo "<font color='green'>" . NEW_PRODUCT_EP . "</font><br>";
$query = "INSERT INTO ".TABLE_PRODUCTS." (
products_sku,
products_image,
products_model,
products_price,
products_status,
products_last_modified,
products_date_added,
products_date_available,
products_tax_class_id,
products_weight,
products_quantity,
manufacturers_id)
VALUES (
'$v_products_image',";

// unmcomment these lines if you are running the image mods
/*
$query .= . $v_products_mimage . '", "'
. $v_products_bimage . '", "'
. $v_products_subimage1 . '", "'
. $v_products_bsubimage1 . '", "'
. $v_products_subimage2 . '", "'
. $v_products_bsubimage2 . '", "'
. $v_products_subimage3 . '", "'
. $v_products_bsubimage3 . '", "'
*/

$query .=" '$v_products_model',
'$v_products_price',
'$v_db_status',
CURRENT_TIMESTAMP,
$v_date_added,
$v_date_avail,
'$v_tax_class_id',
'$v_products_weight',
'$v_products_quantity',
'$v_products_sku'
'$v_manufacturer_id')
";

$result = tep_db_query($query);
} else {
// existing product, get the id from the query
// and update the product data
$row = tep_db_fetch_array($result);
$v_products_id = $row['products_id'];
echo "<font color='black'>" . UPDATE_EP . "</font><br>";
$row = tep_db_fetch_array($result);
$query = 'UPDATE '.TABLE_PRODUCTS.'
SET
products_price="'.$v_products_price.
'" ,products_image="'.$v_products_image;

// uncomment these lines if you are running the image mods
/*
$query .=
'" ,products_mimage="'.$v_products_mimage.
'" ,products_bimage="'.$v_products_bimage.
'" ,products_subimage1="'.$v_products_subimage1.
'" ,products_bsubimage1="'.$v_products_bsubimage1.
'" ,products_subimage2="'.$v_products_subimage2.
'" ,products_bsubimage2="'.$v_products_bsubimage2.
'" ,products_subimage3="'.$v_products_subimage3.
'" ,products_bsubimage3="'.$v_products_bsubimage3;
*/

$query .= '", products_weight="'.$v_products_weight .
'", products_tax_class_id="'.$v_tax_class_id . 
'", products_date_available= ' . $v_date_avail .
', products_date_added= ' . $v_date_added .
', products_last_modified=CURRENT_TIMESTAMP
, products_quantity="' . $v_products_quantity . 
'", products_sku="' . $v_products_sku . 
'" ,manufacturers_id=' . $v_manufacturer_id . 
' , products_status=' . $v_db_status . '
WHERE
(products_id = "'. $v_products_id . '")';

$result = tep_db_query($query);
}

// the following is common in both the updating an existing product and creating a new product
if ( isset($v_products_name)){
foreach( $v_products_name as $key => $name){
if ($name!=''){
$sql = "SELECT * FROM ".TABLE_PRODUCTS_DESCRIPTION." WHERE
products_id = $v_products_id AND
language_id = " . $key;
$result = tep_db_query($sql);
if (tep_db_num_rows($result) == 0) {
// nope, this is a new product description
$result = tep_db_query($sql);
$sql =
"INSERT INTO ".TABLE_PRODUCTS_DESCRIPTION."
(products_id,
language_id,
products_name,
products_description,
products_url)
VALUES (
'" . $v_products_id . "',
" . $key . ",
'" . $name . "',
'". $v_products_description[$key] . "',
'". $v_products_url[$key] . "'
)";
// support for Linda's Header Controller 2.0
if (isset($v_products_head_title_tag)){
// override the sql if we're using Linda's contrib
$sql =
"INSERT INTO ".TABLE_PRODUCTS_DESCRIPTION."
(products_id,
language_id,
products_name,
products_description,
products_url,
products_head_title_tag,
products_head_desc_tag,
products_head_keywords_tag)
VALUES (
'" . $v_products_id . "',
" . $key . ",
'" . $name . "',
'". $v_products_description[$key] . "',
'". $v_products_url[$key] . "',
'". $v_products_head_title_tag[$key] . "',
'". $v_products_head_desc_tag[$key] . "',
'". $v_products_head_keywords_tag[$key] . "')";
}
// end support for Linda's Header Controller 2.0
$result = tep_db_query($sql);
} else {
// already in the description, let's just update it
$sql =
"UPDATE ".TABLE_PRODUCTS_DESCRIPTION." SET
products_name='$name',
products_description='".$v_products_description[$key] . "',
products_url='" . $v_products_url[$key] . "'
WHERE
products_id = '$v_products_id' AND
language_id = '$key'";
// support for Lindas Header Controller 2.0
if (isset($v_products_head_title_tag)){
// override the sql if we're using Linda's contrib
$sql =
"UPDATE ".TABLE_PRODUCTS_DESCRIPTION." SET
products_name = '$name',
products_description = '".$v_products_description[$key] . "',
products_url = '" . $v_products_url[$key] ."',
products_head_title_tag = '" . $v_products_head_title_tag[$key] ."',
products_head_desc_tag = '" . $v_products_head_desc_tag[$key] ."',
products_head_keywords_tag = '" . $v_products_head_keywords_tag[$key] ."'
WHERE
products_id = '$v_products_id' AND
language_id = '$key'";
}
// end support for Linda's Header Controller 2.0
$result = tep_db_query($sql);
}
}
}
}
if (isset($v_categories_id)){
//find out if this product is listed in the category given
$result_incategory = tep_db_query('SELECT
'.TABLE_PRODUCTS_TO_CATEGORIES.'.products_id,
'.TABLE_PRODUCTS_TO_CATEGORIES.'.categories_id
FROM
'.TABLE_PRODUCTS_TO_CATEGORIES.'
WHERE
'.TABLE_PRODUCTS_TO_CATEGORIES.'.products_id='.$v_products_id.' AND
'.TABLE_PRODUCTS_TO_CATEGORIES.'.categories_id='.$v_categories_id);

if (tep_db_num_rows($result_incategory) == 0) {
// nope, this is a new category for this product
$res1 = tep_db_query('INSERT INTO '.TABLE_PRODUCTS_TO_CATEGORIES.' (products_id, categories_id)
VALUES ("' . $v_products_id . '", "' . $v_categories_id . '")');
} else {
// already in this category, nothing to do!
}
}
// for the separate prices per customer module
$ll=1;

if (isset($v_customer_price_1)){

if (($v_customer_group_id_1 == '') AND ($v_customer_price_1 != '')) {
echo "<font color=red>" . ERROR_EP . "</font>";
die();
}
// they spec'd some prices, so clear all existing entries
$result = tep_db_query('
DELETE
FROM
'.TABLE_PRODUCTS_GROUPS.'
WHERE
products_id = ' . $v_products_id
);
// and insert the new record
if ($v_customer_price_1 != ''){
$result = tep_db_query('
INSERT INTO
'.TABLE_PRODUCTS_GROUPS.'
VALUES
(
' . $v_customer_group_id_1 . ',
' . $v_customer_price_1 . ',
' . $v_products_id . '
)'
);
}
if ($v_customer_price_2 != ''){
$result = tep_db_query('
INSERT INTO
'.TABLE_PRODUCTS_GROUPS.'
VALUES
(
' . $v_customer_group_id_2 . ',
' . $v_customer_price_2 . ',
' . $v_products_id . '
)'
);
}
if ($v_customer_price_3 != ''){
$result = tep_db_query('
INSERT INTO
'.TABLE_PRODUCTS_GROUPS.'
VALUES
(
' . $v_customer_group_id_3 . ',
' . $v_customer_price_3 . ',
' . $v_products_id . '
)'
);
}
if ($v_customer_price_4 != ''){
$result = tep_db_query('
INSERT INTO
'.TABLE_PRODUCTS_GROUPS.'
VALUES
(
' . $v_customer_group_id_4 . ',
' . $v_customer_price_4 . ',
' . $v_products_id . '
)'
);
}
if ($v_customer_price_5 != ''){
$result = tep_db_query('
INSERT INTO
'.TABLE_PRODUCTS_GROUPS.'
VALUES
(
' . $v_customer_group_id_5 . ',
' . $v_customer_price_5 . ',
' . $v_products_id . '
)'
);
}
if ($v_customer_price_6 != ''){
$result = tep_db_query('
INSERT INTO
'.TABLE_PRODUCTS_GROUPS.'
VALUES
(
' . $v_customer_group_id_6 . ',
' . $v_customer_price_6 . ',
' . $v_products_id . '
)'
);
}
}
// VJ product attribs begin
if (isset($v_attribute_options_id_1)){
$attribute_rows = 1; // master row count

$languages = tep_get_languages();

// product options count
$attribute_options_count = 1;
$v_attribute_options_id_var = 'v_attribute_options_id_' . $attribute_options_count;

while (isset($$v_attribute_options_id_var) && !empty($$v_attribute_options_id_var)) {
// remove product attribute options linked to this product before proceeding further
// this is useful for removing attributes linked to a product
$attributes_clean_query = "delete from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int)$v_products_id . "' and options_id = '" . (int)$$v_attribute_options_id_var . "'";

tep_db_query($attributes_clean_query);

$attribute_options_query = "select products_options_name from " . TABLE_PRODUCTS_OPTIONS . " where products_options_id = '" . (int)$$v_attribute_options_id_var . "'";

$attribute_options_values = tep_db_query($attribute_options_query);

// option table update begin
if ($attribute_rows == 1) {
// insert into options table if no option exists
if (tep_db_num_rows($attribute_options_values) <= 0) {
for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
$lid = $languages[$i]['id'];

$v_attribute_options_name_var = 'v_attribute_options_name_' . $attribute_options_count . '_' . $lid;

if (isset($$v_attribute_options_name_var)) {
$attribute_options_insert_query = "insert into " . TABLE_PRODUCTS_OPTIONS . " (products_options_id, language_id, products_options_name) values ('" . (int)$$v_attribute_options_id_var . "', '" . (int)$lid . "', '" . $$v_attribute_options_name_var . "')";

$attribute_options_insert = tep_db_query($attribute_options_insert_query);
}
}
} else { // update options table, if options already exists
for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
$lid = $languages[$i]['id'];

$v_attribute_options_name_var = 'v_attribute_options_name_' . $attribute_options_count . '_' . $lid;

if (isset($$v_attribute_options_name_var)) {
$attribute_options_update_lang_query = "select products_options_name from " . TABLE_PRODUCTS_OPTIONS . " where products_options_id = '" . (int)$$v_attribute_options_id_var . "' and language_id ='" . (int)$lid . "'";

$attribute_options_update_lang_values = tep_db_query($attribute_options_update_lang_query);

// if option name doesn't exist for particular language, insert value
if (tep_db_num_rows($attribute_options_update_lang_values) <= 0) {
$attribute_options_lang_insert_query = "insert into " . TABLE_PRODUCTS_OPTIONS . " (products_options_id, language_id, products_options_name) values ('" . (int)$$v_attribute_options_id_var . "', '" . (int)$lid . "', '" . $$v_attribute_options_name_var . "')";

$attribute_options_lang_insert = tep_db_query($attribute_options_lang_insert_query);
} else { // if option name exists for particular language, update table
$attribute_options_update_query = "update " . TABLE_PRODUCTS_OPTIONS . " set products_options_name = '" . $$v_attribute_options_name_var . "' where products_options_id ='" . (int)$$v_attribute_options_id_var . "' and language_id = '" . (int)$lid . "'";

$attribute_options_update = tep_db_query($attribute_options_update_query);
}
}
}
}
}
// option table update end

// product option values count
$attribute_values_count = 1;
$v_attribute_values_id_var = 'v_attribute_values_id_' . $attribute_options_count . '_' . $attribute_values_count;

while (isset($$v_attribute_values_id_var) && !empty($$v_attribute_values_id_var)) {
$attribute_values_query = "select products_options_values_name from " . TABLE_PRODUCTS_OPTIONS_VALUES . " where products_options_values_id = '" . (int)$$v_attribute_values_id_var . "'";

$attribute_values_values = tep_db_query($attribute_values_query);

// options_values table update begin
if ($attribute_rows == 1) {
// insert into options_values table if no option exists
if (tep_db_num_rows($attribute_values_values) <= 0) {
for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
$lid = $languages[$i]['id'];

$v_attribute_values_name_var = 'v_attribute_values_name_' . $attribute_options_count . '_' . $attribute_values_count . '_' . $lid;

if (isset($$v_attribute_values_name_var)) {
$attribute_values_insert_query = "insert into " . TABLE_PRODUCTS_OPTIONS_VALUES . " (products_options_values_id, language_id, products_options_values_name) values ('" . (int)$$v_attribute_values_id_var . "', '" . (int)$lid . "', '" . $$v_attribute_values_name_var . "')";

$attribute_values_insert = tep_db_query($attribute_values_insert_query);
}
}


// insert values to pov2po table
$attribute_values_pov2po_query = "insert into " . TABLE_PRODUCTS_OPTIONS_VALUES_TO_PRODUCTS_OPTIONS . " (products_options_id, products_options_values_id) values ('" . (int)$$v_attribute_options_id_var . "', '" . (int)$$v_attribute_values_id_var . "')";

$attribute_values_pov2po = tep_db_query($attribute_values_pov2po_query);
} else { // update options table, if options already exists
for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
$lid = $languages[$i]['id'];

$v_attribute_values_name_var = 'v_attribute_values_name_' . $attribute_options_count . '_' . $attribute_values_count . '_' . $lid;

if (isset($$v_attribute_values_name_var)) {
$attribute_values_update_lang_query = "select products_options_values_name from " . TABLE_PRODUCTS_OPTIONS_VALUES . " where products_options_values_id = '" . (int)$$v_attribute_values_id_var . "' and language_id ='" . (int)$lid . "'";

$attribute_values_update_lang_values = tep_db_query($attribute_values_update_lang_query);

// if options_values name doesn't exist for particular language, insert value
if (tep_db_num_rows($attribute_values_update_lang_values) <= 0) {
$attribute_values_lang_insert_query = "insert into " . TABLE_PRODUCTS_OPTIONS_VALUES . " (products_options_values_id, language_id, products_options_values_name) values ('" . (int)$$v_attribute_values_id_var . "', '" . (int)$lid . "', '" . $$v_attribute_values_name_var . "')";

$attribute_values_lang_insert = tep_db_query($attribute_values_lang_insert_query);
} else { // if options_values name exists for particular language, update table
$attribute_values_update_query = "update " . TABLE_PRODUCTS_OPTIONS_VALUES . " set products_options_values_name = '" . $$v_attribute_values_name_var . "' where products_options_values_id ='" . (int)$$v_attribute_values_id_var . "' and language_id = '" . (int)$lid . "'";

$attribute_values_update = tep_db_query($attribute_values_update_query);
}
}
}
}
}
// options_values table update end

// options_values price update begin
$v_attribute_values_price_var = 'v_attribute_values_price_' . $attribute_options_count . '_' . $attribute_values_count;

if (isset($$v_attribute_values_price_var) && ($$v_attribute_values_price_var != '')) {
$attribute_prices_query = "select options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int)$v_products_id . "' and options_id ='" . (int)$$v_attribute_options_id_var . "' and options_values_id = '" . (int)$$v_attribute_values_id_var . "'";

$attribute_prices_values = tep_db_query($attribute_prices_query);

$attribute_values_price_prefix = ($$v_attribute_values_price_var < 0) ? '-' : '+';

// options_values_prices table update begin
// insert into options_values_prices table if no price exists
if (tep_db_num_rows($attribute_prices_values) <= 0) {
$attribute_prices_insert_query = "insert into " . TABLE_PRODUCTS_ATTRIBUTES . " (products_id, options_id, options_values_id, options_values_price, price_prefix) values ('" . (int)$v_products_id . "', '" . (int)$$v_attribute_options_id_var . "', '" . (int)$$v_attribute_values_id_var . "', '" . (float)$$v_attribute_values_price_var . "', '" . $attribute_values_price_prefix . "')";

$attribute_prices_insert = tep_db_query($attribute_prices_insert_query);
} else { // update options table, if options already exists
$attribute_prices_update_query = "update " . TABLE_PRODUCTS_ATTRIBUTES . " set options_values_price = '" . $$v_attribute_values_price_var . "', price_prefix = '" . $attribute_values_price_prefix . "' where products_id = '" . (int)$v_products_id . "' and options_id = '" . (int)$$v_attribute_options_id_var . "' and options_values_id ='" . (int)$$v_attribute_values_id_var . "'";

$attribute_prices_update = tep_db_query($attribute_prices_update_query);
}
}
// options_values price update end

$attribute_values_count++;
$v_attribute_values_id_var = 'v_attribute_values_id_' . $attribute_options_count . '_' . $attribute_values_count;
}

$attribute_options_count++;
$v_attribute_options_id_var = 'v_attribute_options_id_' . $attribute_options_count;
}

$attribute_rows++;
}
// VJ product attribs end

} else {
// this record was missing the product_model
array_walk($items, 'print_el');
echo "<p class=smallText>" . NO_NEW_PRODUCT_EP . "<br>";
echo "<br>";
}
// end of row insertion code
}


require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

Share this post


Link to post
Share on other sites
I have never had this error happen. When I go to upload a txt file this is the error:

File uploaded.

Temporary filename: /tmp/phpIqmYQd

User filename: electrical.txt

Size: 82521

| T-9006M | ELECTRONIC | ROSTRA | | ROSTRA | | 15 Pin Ma | 15 Pin Ma | 15 Pin Ma | Miscellane | 121.25 | 100.32 | 3 | 1000 | Taxable Go | Active | 1/1/2006 1 !New Product!

1048 - Column 'products_date_added' cannot be null

 

INSERT INTO products ( products_retail_price, products_image, products_model, products_price, products_status, products_last_modified, products_date_added, products_date_available, products_tax_class_id, products_weight, products_quantity, manufacturers_id) VALUES ( '', 'T-9006M', '94.6415', '1', CURRENT_TIMESTAMP, CURRENT_TIMESTAMP, NULL, '1', '3', '1000', '121.25', '21')

 

And when I try to download a text file this is the error:

 

1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'FROM products as p, categories as subc, products_to

 

SELECT p.products_id as v_products_id, p.products_model as v_products_model, p.products_image as v_products_image, p.products_price as v_products_price, p.products_weight as v_products_weight, p.products_date_available as v_date_avail, p.products_date_added as v_date_added, p.products_tax_class_id as v_tax_class_id, p.products_quantity as v_products_quantity, p.manufacturers_id as v_manufacturers_id, subc.categories_id as v_categories_id, p.products_status as v_status, p.products_retail_price as v_products_retail_price, FROM products as p, categories as subc, products_to_categories as ptoc WHERE p.products_id = ptoc.products_id AND ptoc.categories_id = subc.categories_id

 

Anyone have any idea?

 

Steven

 

Did you ever figure out this issue? I had this one pop up on me too.

Share this post


Link to post
Share on other sites
I tryed to post this before and no answer... If this is not the right place, please let me know. "I have easy populate installed and cannot find out how to upload just a price change. If I upload only data in the model number field and price field and the EOREOR field it erases the data in all other fields. Is there a way to only update the fields you want to update without over writing the other fields?" Please help.

 

mrjkb, You need to download a txt file of your store contents, update the pricing and then re-import the file. If you only have the model number, price and EOREOR fields, it will consider the other blank cells as updated data and overwrite the existing database values with the new (blank) data.

Share this post


Link to post
Share on other sites

Hello all.

 

I have EP installed and working. The last time I used it was sometime last fall. I'm now trying to update my catalog and can't get the file to upload completely. When I try to upload, it only uploads 1/4 of the products and then I get this message:

 

| BCA:BB | 4 | 0 | 3 | 1 | 2 | 2 | | 3 | | Updated

1136 - Column count doesn't match value count at row 1

 

INSERT INTO products_groups VALUES ( 1, 3, 351, 4 )

 

I'm getting the same message when I download the file & immediately upload it with no changes. Is there a fix for this?


Thanks!

Clesha

Share this post


Link to post
Share on other sites
try "EP & PA 2.79b-MS2 (bug fixes,CIP,options in admin for AO,SPPC,QTpro. en,ge,it,fi,ru)"

 

Alex, thanks for all the info you've supplied in these forums. I've been searching for many answers and have run across a few of your posts. So, I have a question for you. I've activated support for QTF (in Easy Populate) and it seems like it works fine for products with single attributes. How may I use Easy Populate + QTF for products that have multiple attributes?

 

The v_attribute_values_stock_x_y is not populated for products with multiple attribs, and I'm not sure how this would work. Ex: product 1 has different sizes and colors - size: Small color: Black, size: Small color: White, etc. How to differentiate between the different attributes of the same product from within the csv file?

 

Any help would be greatly appreciated. thanks! :thumbsup:

Share this post


Link to post
Share on other sites
Hi,

 

I want to install easy populate on my oscommerce shop, but I also want to install individual shipping prices.

Can these two contributions work together? And can EP include the extra characters that are created for individual product shipping prices?

 

 

In the meantime I got EP 2.4 installed, I have my problem solved concerning the "default language" (without any help/reply from the forum!!).

 

But now I would appreciate any help on my above question. Where to put the info so EP knows it has to download/upload my extra created fields for individual product shipping.

Share this post


Link to post
Share on other sites
mrjkb, You need to download a txt file of your store contents, update the pricing and then re-import the file. If you only have the model number, price and EOREOR fields, it will consider the other blank cells as updated data and overwrite the existing database values with the new (blank) data.

 

The problem I have with downloading the entire store is that I have some HTML in the descriptions and some really long descriptions that get cut off. So when I upload the new price my descriptions get all messed up. That is why I don't want to have to overwrite the descriptions. Either that or how do I keep the html from getting all messed up?


Laser labels, barcode labels, custom labels

Share this post


Link to post
Share on other sites
Did you ever figure out this issue? I had this one pop up on me too.

 

should there be a comma before the FROM in the select?

Share this post


Link to post
Share on other sites

Any help here???

 

I have a question and it doesn't seem to have been covered here yet. I am using 2 images, thumbnail and reg size. I have not seen anything in the documentation about what the field name is for the thumbnail. I'm sorry if I missed it in this thread.

 

Also, is this a bug or not. I have a fully working store with the images on my server already. I go to upload the EP file and all the sudden...all the images disappear as if they aren't even there but yet they are still on the server. Unless I upload all 5000 of them again overwriting the others, they won't come up.

Share this post


Link to post
Share on other sites
HEllo all,

 

have not seen this on here yet but hoping some on has the answer?

 

My client has been using easy populate, and the on day, no can download text file. is it possible to have to many Attributes for Easy populate to handle?

 

we get CGI time outs

 

Any insight would be appreciated.

Adam kinney

 

Is Anyone out there having this problem ? I have now upgraded to 2.8 adn I When trying to download the entire store contents with attributes, or modle and attributes, the admin times out and I get a page not found. But if I do the

Download .txt file with TAB delimited to edit ( Model / Price / Quantity )

Download .txt file with TAB delimited to edit ( Model / Category )

then the download come up instantly.

 

Any insight would be appreciated.

Share this post


Link to post
Share on other sites
Is Anyone out there having this problem ? I have now upgraded to 2.8 adn I When trying to download the entire store contents with attributes, or modle and attributes, the admin times out and I get a page not found. But if I do the

Download .txt file with TAB delimited to edit ( Model / Price / Quantity )

Download .txt file with TAB delimited to edit ( Model / Category )

then the download come up instantly.

 

Any insight would be appreciated.

 

Re your comments on size, timeout. suggest you refer to manual

SPECIAL INSTRUCTIONS FOR LARGE STORES

 

If your store has over 300 products, you will likely run into PHP timeout issues. The maximum time that a script can run is set in the php.ini file. The default is 30 seconds, and it seems that most people can upload about 300 items within that time.

 

If your store is over 300 items, you must split the file before it can be uploaded. You can do this by hand, or you can use the file-splitting feature of EP. If you split by hand remember that EP expects the first row in every file to be the headers, and will throw this line out. So if you don't have headers, it's going to throw out the first row of data.

 

Breaking it up should not be a problem as loading the database will be cumulative

 

My own experience is it works fine so long as you heed the above. I have found I am more likely to have issues with attribute length and the max size of spreadsheets (eg excell 256 columns etc)

 

Regards

 

Nossum

Share this post


Link to post
Share on other sites

When I upload an EP file all my products are loaded correctly, but for one thing... they are mostly, and it appears ramdonly, listed as inactive, even though they have v_status Active in the file.

 

I have to go through every one and switch it to Active. Can anyone suggest what causes this and how to stop this happening?

 

Regards,

 

Graham

Share this post


Link to post
Share on other sites

Easy Populate is a great tool, but there seems to be a shortcoming when dealing with inventory of products having multiple attributes -- even with the QTPro switch turned on.

 

How does one specify in the tab-delimited csv file (on one row w/o having to create multiple products/ids/rows):

Product: Shirt , colorAttribute: Red , sizeAttribute: Medium , stock level: 2

Product: Shirt , colorAttribute: Red , sizeAttribute: Large , stock level: 4

Product: Shirt , colorAttribute: Blue , sizeAttribute: Medium , stock level: 3

Product: Shirt , colorAttribute: Blue , sizeAttribute: Large , stock level: 5

...where one attribute value is unique, or changes, with every stock level.

 

Many Thanks! You'll be solving a huge problem if there is a solution. I'm surprised others have not had this problem? I haven't been able to find it in these forums.

Edited by MarkMan

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×