Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Easy Populate & Products Attributes


VJ

Recommended Posts

Hello,

 

Need some help with 2.76g-MS2. When I activate SPPC and download the file to edit a, add into SPPC fields and upload, I get the following error,

 

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

 

INSERT INTO products_groups VALUES ( 1, 7, 34 )

 

But, if I upload the file with SPPC fields blank it uploads fine?

 

Thanks JR

 

The SPPC supprt is for an older version of SPPC. If you are using the latest version being worked on by Jan Zonjee, it as changed quite a bit and probably won't work for you.

Link to comment
Share on other sites

# $Id: $ # # osCommerce, Open Source E-Commerce Solutions # http://www.oscommerce.com # # Copyright © 2007 osCommerce # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License v2 (1991) # as published by the Free Software Foundation. ezpopulate_online_title = EZ Populate

Fatal error: Class 'osC_Application_Ezpopulate' not found in X:\home\osc\www\admin\includes\classes\template.php on line 31

 

 

system kick down with this message

Link to comment
Share on other sites

Denis

 

This is the support thread for Easy Populate not EaZy Populate. Try the v3.x forum.

Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile

 

Virus Threat Scanner

My Contributions

Basic install answers.

Click here for Contributions / Add Ons.

UK your site.

Site Move.

Basic design info.

 

For links mentioned in old answers that are no longer here follow this link Useful Threads.

 

If this post was useful, click the Like This button over there ======>>>>>.

Link to comment
Share on other sites

OK...I have Eazy Populate 2.76h that I downloaded from the community/contributions.

 

I have tried to install this every which way but nothing shows up either under tools or catalog.

 

I would love to get this installed so any help would be greatly appreciated.

 

Best,

 

Elio

Link to comment
Share on other sites

The SPPC supprt is for an older version of SPPC. If you are using the latest version being worked on by Jan Zonjee, it as changed quite a bit and probably won't work for you.

 

 

Thank you for the answer.

 

JR

Link to comment
Share on other sites

This is the support thread for Easy Populate not EaZy Populate. Try the v3.x forum.

 

 

I am sorry. They really should update their documentation.

 

The last line of the instructions read...

 

Post all the info and your problem description in the support thread:

http://www.oscommerce.com/forums/index.php?showtopic=162244

 

Sigh....

 

Thanks again.

 

Best

Link to comment
Share on other sites

Working, but a couple questions?

 

All, Firstly, if this is posted elsewhere I apologize... this forum for some reason will not allow me to search for anything. So please don't chastize me!

 

Okay, so I have installed it and I have downloaded and uploaded a sample file with no changes - no problem. I have downloaded, changed and uploaded the sample file and no problem... well no errors.

 

So what I changed was I added the custom fields:

$custom_fields[TABLE_PRODUCTS] = array( 'products_size' => 'Product Size', 'products_uom' => 'U.O.M.' );
$custom_fields[TABLE_PRODUCTS_DESCRIPTION] = array( 'products_size' => 'Product Size', 'products_uom' => 'U.O.M.' );

 

(Now I beleive this may be an error in itself, as looking at it I am guessing that it should only be added to the second and not the first. Confirm?)

 

Now it uploaded it just fine, but (and maybe I am unclear on whether this is supposed to happen or not) I cannot see the fields in my add product form, nor can I see the fields in the product details on the front end. Again, I might be mistaken on the functionality of this. Am I missing or incorrectly assuming something here?

 

here is the shortened, changed sample file: http://spog.bz/temp/shortened.csv

 

Now the next question I have is that I want to upload extra fields that will be visible to the public in the product details and others that are to be invisible to the public, but included in the export of orders.

The sample file of our current product spreadsheet is here: http://spog.bz/temp/sample_our_products.csv

I have not changed the headers to match, but know how to do this. But the fields that I am concerned about hiding are:

DISTRIBUTORS, SBT, PRODUCT CODE, CASE QTY and CASE PRICE.

The feilds that I want visible are:

SIZE and U.O.M.

 

Is there a way to choose if they are hidden or shown (Again assuming here)?

 

Also is there a way to hide the model number from being displayed on public end and to change the model numbering sequence to strictly numerical?

 

Thanks for any help you can provide.

Link to comment
Share on other sites

So what I changed was I added the custom fields:

$custom_fields[TABLE_PRODUCTS] = array( 'products_size' => 'Product Size', 'products_uom' => 'U.O.M.' );
$custom_fields[TABLE_PRODUCTS_DESCRIPTION] = array( 'products_size' => 'Product Size', 'products_uom' => 'U.O.M.' );

 

(Now I beleive this may be an error in itself, as looking at it I am guessing that it should only be added to the second and not the first. Confirm?)

I think you are giving this contribution much more credit than it deserves. Adding those fields to easypopulate.php will do nothing to the database, the product_info.php, or the admin/categories.php (product edit page). All those changes need to be completed by you before easypopulate will do it's job.

 

so knowing that you can understand why there is no way to specify whether they would be public visible or not. That is done by manually adding the fields to the correct tables in the database and coding data retrievals in the product_info.php display and the product edit page (admin/categories.php).

 

That portion of easypopulate is there to help those that have added contributions to their shop and with to incorporate the contribution with easypopulate.

Link to comment
Share on other sites

mayb someone can help me i have uploaded the .csv file that has my products on it went to the temp folder. now what am i supposed to do with it to make my products appear in the catalog? you answer here or by email

Link to comment
Share on other sites

Hmmm... it would appear so... Guess I can scrap that...

 

Can anyone recommend a contribution that does this already?

 

there is a contribution that helps you add extra fields to both the product info page and the product edit page and also has support in this contribution. Look up Product Extra Fields.

 

I don't like how support was implemented in this contribution though. You have to use two separate import/export files. One for the extra fields contribution and one for everything else. Makes coordination across the two a bit of a pain. But you make your own decision.

 

You won't be using the settings you posted above, so you can return those settings to the original.

Edited by surfalot
Link to comment
Share on other sites

mayb someone can help me i have uploaded the .csv file that has my products on it went to the temp folder. now what am i supposed to do with it to make my products appear in the catalog? you answer here or by email

 

I'm going to assume you are using the latest version I have uploaded since you didn't mention that. With that version you will find a link to the documentation in the upper right of the easypopulate page. There is a step by step How to Use Easy Populate section there for you to read. And if you haven't yet, please do read the entire docs through once, and again each time you have a problem just in case you missed something. If after that you still have questions, I'll help with what I can.

Link to comment
Share on other sites

Hi is there any way to increase the number of default attributes/attribute values that download?

 

I have excel 2007 and this apparently has 16,384 columns versus the old 256, this would make the attrbute extension feasable?

 

 

Thanks

 

Johnny

Getting better with mods but no programmer am I.

Link to comment
Share on other sites

Hi is there any way to increase the number of default attributes/attribute values that download?

 

I have excel 2007 and this apparently has 16,384 columns versus the old 256, this would make the attrbute extension feasable?

I'm not sure I understand the question. the attributes (if enabled) will fully populate without regard to any limit.

Link to comment
Share on other sites

I'm not sure I understand the question. the attributes (if enabled) will fully populate without regard to any limit.

 

Hi Todd,

 

the categories I can set to a number to download regardless of actual values in the system, so with the options it downloads as many as are already inthe system? I will have another look and enter a few and see how I get on.

 

Thanks

 

Johnny

Getting better with mods but no programmer am I.

Link to comment
Share on other sites

Hi Todd,

 

the categories I can set to a number to download regardless of actual values in the system, so with the options it downloads as many as are already inthe system? I will have another look and enter a few and see how I get on.

 

Thanks

 

Johnny

 

The attributes will populate every attribute available in the shop in the download each and every time. the attribute support seems to me to be a bit of a hack then something with much forethought.

Link to comment
Share on other sites

H Todd,

 

had a play with the counts in the easy populate file, and got some odd results, as I dont know what I am doing I am changing things blind and hoping I will get the answer....... not recommended.

 

 

I suspect that its now possible given th results I have obtained, but its an issue of being able to set them properly and or download them.

 

None the less it still rmains as it stands an outstanding contribution which will serve everyone well.

 

I hope that some looks at addressing the attributes issue now that things have moved on and more colmuns are available in excel.

 

for importing I would just create the extra headers and upload it not a major issue, or and several lines tfor the same product and have more options on each line.

 

hope everyone is having a nice evening/morning/afternoon.

 

Thanks

Johnny

Getting better with mods but no programmer am I.

Link to comment
Share on other sites

My Question:

 

I have an online oscommerce store with easy populate installed. I also have another contrib that allows me to give MSRPs for each product (found here). When I prepare an excel spreadsheet with thousands of products to upload into easy populate (as a csv), there is no field (column) to add the MSRPs into. So, after I upload a large database of products, I must go through each product in the oscommerce admin panel and add each individual MSRP separately. I was wondering if there is any way to add another field into my csv files where I can give the MSRP for each product before I upload it all into easy populate.

 

Thanks in advance,

 

Matt

Link to comment
Share on other sites

Hi Matt I have done this already for easy populate.

 

this part of the easypopulate.php file, contains all the msrp settings, there is also a products_trade, you should remove that reference

 

   // /////////////////////////////////////////////////////////////////////
// End: Support for other contributions
// /////////////////////////////////////////////////////////////////////
switch( $dltype ){
case 'full':
	// The file layout is dynamically made depending on the number of languages
	$iii = 0;
	$filelayout = array();
	$filelayout['v_products_model'] = $iii++;
	foreach ($languages as $key => $lang){
		$filelayout['v_products_name_'.$lang['id']]		= $iii++;
		$filelayout['v_products_description_'.$lang['id']] = $iii++;
		$filelayout['v_products_url_'.$lang['id']]		 = $iii++;
		foreach ($custom_fields[TABLE_PRODUCTS_DESCRIPTION] as $key => $name) { 
		  $filelayout['v_' . $key . '_'.$lang['id']]		 = $iii++;
		}
		if (!empty($ep_additional_layout_product_description)) {
		  eval($ep_additional_layout_product_description);
		}
	}
	$filelayout['v_products_image'] = $iii++;
	if (!empty($ep_additional_layout_product)) {
	  eval($ep_additional_layout_product);
	}
	$filelayout['v_products_trade']	= $iii++;
	$filelayout['v_products_price']	= $iii++;
	$filelayout['v_products_msrp']	= $iii++;
	if (!empty($ep_additional_layout_pricing)) {
	  eval($ep_additional_layout_pricing);
	}
	$filelayout['v_products_quantity'] = $iii++;
	$filelayout['v_products_weight']   = $iii++;
	$filelayout['v_date_avail']		= $iii++;
	$filelayout['v_date_added']		= $iii++;
	// 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_CATEGORIES+1; $i++){
		$filelayout['v_categories_image_' . $i] = $iii++;
		foreach ($languages as $key => $lang){
			$filelayout['v_categories_name_' . $i . '_' . $lang['id']] = $iii++;
		}
	}
	$filelayout['v_manufacturers_name'] = $iii++;
	// VJ product attribs begin
	$attribute_options_count = 1;
	foreach ($attribute_options_array as $tkey => $attribute_options_values) {
		$filelayout['v_attribute_options_id_'.$attribute_options_count] = $iii++;
		foreach ($languages as $tkey => $lang ) {
			$filelayout['v_attribute_options_name_'.$attribute_options_count.'_'.$lang['id']] = $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)) {
			$filelayout['v_attribute_values_id_'.$attribute_options_count.'_'.$attribute_values_count] = $iii++;
			foreach ($languages as $tkey => $lang ) {
				$filelayout['v_attribute_values_name_'.$attribute_options_count.'_'.$attribute_values_count.'_'.$lang['id']] = $iii++;
			}
			$filelayout['v_attribute_values_price_'.$attribute_options_count.'_'.$attribute_values_count] = $iii++;
			//// attributes stock add start		
			if ( EP_PRODUCTS_ATTRIBUTES_STOCK == true ) { 
				$filelayout['v_attribute_values_stock_'.$attribute_options_count.'_'.$attribute_values_count] = $iii++;
			}				
			//// attributes stock add end		 
			$attribute_values_count++;
		 }
		$attribute_options_count++;
	}
	// VJ product attribs end
	$filelayout['v_tax_class_title']  = $iii++;
	$filelayout['v_status']		   = $iii++;
	$filelayout_sql = "SELECT
		p.products_id as v_products_id,
		p.products_model as v_products_model,
		p.products_image as v_products_image,
		$ep_additional_layout_product_select
		p.products_trade as v_products_trade,
		p.products_price as v_products_price,
		p.products_msrp as v_products_msrp,
		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
		" . $sql_filter;
	break;
case 'priceqty':
	$iii = 0;
	$filelayout = array();
	$filelayout['v_products_model']	= $iii++;
	$filelayout['v_products_trade']	= $iii++;
	$filelayout['v_products_price']	= $iii++;
	$filelayout['v_products_msrp']	= $iii++;
	$filelayout['v_products_quantity'] = $iii++;
	if (!empty($ep_additional_layout_pricing)) {
	  eval($ep_additional_layout_pricing);
	}
	$filelayout_sql = "SELECT
		p.products_id as v_products_id,
		p.products_model as v_products_model,
		p.products_trade as v_products_trade,
		p.products_price as v_products_price,
		p.products_msrp as v_products_msrp,
		p.products_tax_class_id as v_tax_class_id,
		p.products_quantity as v_products_quantity
		FROM
		".TABLE_PRODUCTS." as p
		";
	break;
case 'custom':
	$iii = 0;
	$filelayout = array();
	$filelayout['v_products_model'] = $iii++;
	if (!empty($_GET['epcust_status'])) { $filelayout['v_status'] = $iii++; }
	foreach ($languages as $key => $lang){
		if (!empty($_GET['epcust_name'])) { $filelayout['v_products_name_'.$lang['id']] = $iii++; }
		if (!empty($_GET['epcust_description'])) { $filelayout['v_products_description_'.$lang['id']] = $iii++; }
		if (!empty($_GET['epcust_url'])) { $filelayout['v_products_url_'.$lang['id']] = $iii++; }
		foreach ($custom_fields[TABLE_PRODUCTS_DESCRIPTION] as $key => $name) { 
		  if (!empty($_GET['epcust_' . $key])) { $filelayout['v_' . $key . '_'.$lang['id']] = $iii++; }
		}
	}
	if (!empty($_GET['epcust_image'])) {
	  $filelayout['v_products_image'] = $iii++;
	  if (!empty($ep_additional_layout_product)) {
		eval($ep_additional_layout_product);
	  }
	}
	foreach ($custom_fields[TABLE_PRODUCTS] as $key => $name) { 
		if (!empty($_GET['epcust_' . $key])) {
			$filelayout['v_' . $key] = $iii++;
			$ep_additional_layout_product_select .= 'p.' . $key . ' as v_' . $key . ',';
		}
	}
	if (!empty($_GET['epcust_trade'])) { $filelayout['v_products_trade'] = $iii++; }
	if (!empty($_GET['epcust_price'])) { $filelayout['v_products_price'] = $iii++; }
	if (!empty($_GET['epcust_msrp'])) { $filelayout['v_products_msrp'] = $iii++; }
	if (!empty($_GET['epcust_quantity'])) { $filelayout['v_products_quantity'] = $iii++; }
	if (!empty($_GET['epcust_weight'])) { $filelayout['v_products_weight'] = $iii++; }
	if (!empty($_GET['epcust_avail'])) { $filelayout['v_date_avail'] = $iii++; }
	if (!empty($_GET['epcust_date_added'])) { $filelayout['v_date_added'] = $iii++; }
	if (!empty($_GET['epcust_category'])) {
	  // 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_CATEGORIES; $i++){
		$filelayout['v_categories_image_'.$i] = $iii++;
		foreach ($languages as $key => $lang){
		  $filelayout['v_categories_name_'.$i.'_'.$lang['id']] = $iii++;
		}
	  }
	}
	if (!empty($_GET['epcust_manufacturer'])) { $filelayout['v_manufacturers_name'] = $iii++; }
	if (!empty($_GET['epcust_attributes'])) {
	  // VJ product attribs begin
	  $attribute_options_count = 1;
	  foreach ($attribute_options_array as $tkey => $attribute_options_values) {
		$filelayout['v_attribute_options_id_'.$attribute_options_count] = $iii++;
		foreach ($languages as $tkey => $lang ) {
			$filelayout['v_attribute_options_name_'.$attribute_options_count.'_'.$lang['id']] = $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)) {
			$filelayout['v_attribute_values_id_'.$attribute_options_count.'_'.$attribute_values_count] = $iii++;
			foreach ($languages as $tkey => $lang ) {
				$filelayout['v_attribute_values_name_'.$attribute_options_count.'_'.$attribute_values_count.'_'.$lang['id']] = $iii++;
			}
			$filelayout['v_attribute_values_price_'.$attribute_options_count.'_'.$attribute_values_count] = $iii++;
			//// attributes stock add start		
			if ( EP_PRODUCTS_ATTRIBUTES_STOCK == true ) { 
				$filelayout['v_attribute_values_stock_'.$attribute_options_count.'_'.$attribute_values_count] = $iii++;
			}				
			//// attributes stock add end		 
			$attribute_values_count++;
		 }
		$attribute_options_count++;
	  }
	  // VJ product attribs end
	}
	if (!empty($_GET['epcust_tax_class'])) { $filelayout['v_tax_class_title'] = $iii++; }
	if (!empty($_GET['epcust_comment'])) { $filelayout['v_products_comment'] = $iii++; }
	$filelayout_sql = "SELECT
		p.products_id as v_products_id,
		p.products_model as v_products_model,
		p.products_status as v_status,
		p.products_trade as v_products_trade,
		p.products_price as v_products_price,
		p.products_msrp as v_products_msrp,
		p.products_quantity as v_products_quantity,
		p.products_weight as v_products_weight,
		p.products_image as v_products_image,
		$ep_additional_layout_product_select
		p.manufacturers_id as v_manufacturers_id,
		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,
		subc.categories_id as v_categories_id
		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
		" . $sql_filter;
	break;
case 'category':
	$iii = 0;
	$filelayout = array();
	$filelayout['v_products_model'] = $iii++;
	for($i=1; $i<EP_MAX_CATEGORIES+1; $i++){
		$filelayout['v_categories_image_'.$i] = $iii++;
		foreach ($languages as $key => $lang){
				$filelayout['v_categories_name_'.$i.'_'.$lang['id']] = $iii++;
		}
	}
	$filelayout_sql = "SELECT
		p.products_id as v_products_id,
		p.products_model as v_products_model,
		subc.categories_id as v_categories_id
		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 'extra_fields':
// start EP for product extra field ============================= DEVSOFTVN - 10/20/2005	 
	$iii = 0;
	$filelayout = array(
		'v_products_model'		=> $iii++,
		'v_products_extra_fields_name'		=> $iii++, 
		'v_products_extra_fields_id'		=> $iii++,
//			'v_products_id'		=> $iii++,
		'v_products_extra_fields_value'		=> $iii++,
					);
	$filelayout_sql = "SELECT
					p.products_id as v_products_id,
					p.products_model as v_products_model,
					subc.products_extra_fields_id as v_products_extra_fields_id,
					subc.products_extra_fields_value as v_products_extra_fields_value,
					ptoc.products_extra_fields_name as v_products_extra_fields_name
					FROM
					".TABLE_PRODUCTS." as p,
					".TABLE_PRODUCTS_TO_PRODUCTS_EXTRA_FIELDS." as subc,
					".TABLE_PRODUCTS_EXTRA_FIELDS." as ptoc
					WHERE
					p.products_id = subc.products_id AND
					ptoc.products_extra_fields_id = subc.products_extra_fields_id
					";	
// end of EP for extra field code ======= DEVSOFTVN================	   
	break;
case 'froogle':
	// this is going to be a little interesting because we need
	// a way to map from internal names to external names
	//
	// Before it didn't matter, but with froogle needing particular headers,
	// The file layout is dynamically made depending on the number of languages
	$iii = 0;
	$filelayout = array();
	$filelayout['v_froogle_products_url_1'] = $iii++;
	$filelayout['v_froogle_products_name_'.EP_DEFAULT_LANGUAGE_ID] = $iii++;
	$filelayout['v_froogle_products_description_'.EP_DEFAULT_LANGUAGE_ID] = $iii++;
	$filelayout['v_products_price'] = $iii++;
	$filelayout['v_products_fullpath_image'] = $iii++;
	$filelayout['v_froogle_product_id'] = $iii++;
	$filelayout['v_froogle_quantitylevel'] = $iii++;
	$filelayout['v_category_fullpath'] = $iii++;
	$filelayout['v_froogle_exp_date'] = $iii++;
	$filelayout['v_froogle_currency'] = $iii++;
	$iii=0;
	$fileheaders = array();
	// EP Support mapping new names to the export headers.
	// use the $fileheaders[''] vars to do that.
	$fileheaders['link'] = $iii++;
	$fileheaders['title'] = $iii++;
	$fileheaders['description'] = $iii++;
	$fileheaders['price'] = $iii++;
	$fileheaders['image_link'] = $iii++;
	$fileheaders['id'] = $iii++;
	$fileheaders['quantity'] = $iii++;
	$fileheaders['product_type'] = $iii++;
	$fileheaders['expiration_date'] = $iii++;
	$fileheaders['currency'] = $iii++;
	$filelayout_sql = "SELECT
		p.products_id as v_products_id,
		p.products_model as v_products_model,
		p.products_image as v_products_image,
		p.products_trade as v_products_trade,
		p.products_price as v_products_price,
		p.products_msrp as v_products_msrp,
		p.products_weight as v_products_weight,
		p.products_date_added as v_date_added,
		p.products_date_available as v_date_avail,
		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
		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
		" . $sql_filter;
	break;
// VJ product attributes begin
case 'attrib':
	$iii = 0;
	$filelayout = array();
	$filelayout['v_products_model'] = $iii++;
	$attribute_options_count = 1;
	foreach ($attribute_options_array as $tkey1 => $attribute_options_values) {
		$filelayout['v_attribute_options_id_'.$attribute_options_count] = $iii++;
		foreach ($languages as $tkey => $lang ) {
			$filelayout['v_attribute_options_name_'.$attribute_options_count.'_'.$lang['id']] = $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)) {
			$filelayout['v_attribute_values_id_'.$attribute_options_count.'_'.$attribute_values_count] = $iii++;
			foreach ($languages as $tkey2 => $lang ) {
				$filelayout['v_attribute_values_name_'.$attribute_options_count.'_'.$attribute_values_count.'_'.$lang['id']] = $iii++;
			}
			$filelayout['v_attribute_values_price_'.$attribute_options_count.'_'.$attribute_values_count] = $iii++;
			//// attributes stock add start		
			if ( EP_PRODUCTS_ATTRIBUTES_STOCK	== true ) { 
				$header_array['v_attribute_values_stock_'.$attribute_options_count.'_'.$attribute_values_count] = $iii++;
			}				
			//// attributes stock add end		 
			$attribute_values_count++;
		}
		$attribute_options_count++;
	}
	$filelayout_sql = "SELECT
						p.products_id as v_products_id,
						p.products_model as v_products_model
						FROM
						".TABLE_PRODUCTS." as p
						";
	break;
	// VJ product attributes end
}
$filelayout_count = count($filelayout);
 return array($filelayout, $filelayout_count, $filelayout_sql, $fileheaders);
}
///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////
// 
// process_row()
//
//   Processes one row of the import file
// 
///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////
function process_row( $item1, $filelayout, $filelayout_count, $default_these, $ep_separator, $languages, $custom_fields ) {
// first we clean up the row of data
if (EP_EXCEL_SAFE_OUTPUT == true) {
  $items = $item1;
} else {
  // chop blanks from each end
  $item1 = ltrim(rtrim($item1));
  // blow it into an array, splitting on the tabs
  $items = explode($ep_separator, $item1);
}
// make sure all non-set things are set to '';
// and strip the quotes from the start and end of the stings.
// escape any special chars for the database.
foreach( $filelayout as $key => $value){
	$i = $filelayout[$key];
	if (isset($items[$i]) == false) {
		$items[$i]='';
	} else {
		// Check to see if either of the magic_quotes are turned on or off;
		// And apply filtering accordingly.
		if (function_exists('ini_get')) {
			//echo "Getting ready to check magic quotes<br />";
			if (ini_get('magic_quotes_runtime') == 1){
				// The magic_quotes_runtime are on, so lets account for them
				// check if the first & last character are quotes;
				// if it is, chop off the quotes.
				if (substr($items[$i],-1) == '"' && substr($items[$i],0,1) == '"'){
					$items[$i] = substr($items[$i],2,strlen($items[$i])-4);
				}
				// now any remaining doubled double quotes should be converted to one doublequote
				if (EP_REPLACE_QUOTES == true){
					if (EP_EXCEL_SAFE_OUTPUT == true) {
					  $items[$i] = str_replace('\"\"',""",$items[$i]);
					}
					$items[$i] = str_replace('\"',""",$items[$i]);
					$items[$i] = str_replace("\'","'",$items[$i]);
				}
			} else { // no magic_quotes are on
				// check if the last character is a quote;
				// if it is, chop off the 1st and last character of the string.
				if (substr($items[$i],-1) == '"' && substr($items[$i],0,1) == '"'){
					$items[$i] = substr($items[$i],1,strlen($items[$i])-2);
				}
				// now any remaining doubled double quotes should be converted to one doublequote
				if (EP_REPLACE_QUOTES == true){
					if (EP_EXCEL_SAFE_OUTPUT == true) {
					  $items[$i] = str_replace('""',""",$items[$i]);
					}
					$items[$i] = str_replace('"',""",$items[$i]);
					$items[$i] = str_replace("'","'",$items[$i]);
				}
			}
		}
	}
}
// /////////////////////////////////////////////////////////////
// Do specific functions without processing entire range of vars
// /////////////////////////////
// first do product extra fields
if (isset($items[$filelayout['v_products_extra_fields_id']]) ){	
	$v_products_model = $items[$filelayout['v_products_model']];
	// EP for product extra fields Contrib by minhmaster DEVSOFTVN ==========
	$v_products_extra_fields_id = $items[$filelayout['v_products_extra_fields_id']];
//		$v_products_id	=	$items[$filelayout['v_products_id']];
	$v_products_extra_fields_value	=	$items[$filelayout['v_products_extra_fields_value']];
	$sql = "SELECT p.products_id as v_products_id FROM ".TABLE_PRODUCTS." as p WHERE p.products_model = '" . $v_products_model . "'";
	$result = tep_db_query($sql);
	$row =  tep_db_fetch_array($result);
	$sql_exist	=	"SELECT products_extra_fields_value FROM ".TABLE_PRODUCTS_TO_PRODUCTS_EXTRA_FIELDS. " WHERE (products_id ='".$row['v_products_id']. "') AND (products_extra_fields_id ='".$v_products_extra_fields_id ."')";
	if (tep_db_num_rows(tep_db_query($sql_exist)) > 0) {
		$sql_extra_field	=	"UPDATE ".TABLE_PRODUCTS_TO_PRODUCTS_EXTRA_FIELDS." SET products_extra_fields_value='".$v_products_extra_fields_value."' WHERE (products_id ='". $row['v_products_id'] . "') AND (products_extra_fields_id ='".$v_products_extra_fields_id ."')";
		$str_err_report= " $v_products_extra_fields_id | $v_products_id  | $v_products_model | $v_products_extra_fields_value | <b><font color=black>Product Extra Fields Updated</font></b><br />";
	} else {
		$sql_extra_field	=	"INSERT INTO ".TABLE_PRODUCTS_TO_PRODUCTS_EXTRA_FIELDS."(products_id,products_extra_fields_id,products_extra_fields_value) VALUES ('". $row['v_products_id'] ."','".$v_products_extra_fields_id."','".$v_products_extra_fields_value."')";
		$str_err_report= " $v_products_extra_fields_id | $v_products_id | $v_products_model | $v_products_extra_fields_value | <b><font color=green>Product Extra Fields Inserted</font></b><br />";
	}
	$result = tep_db_query($sql_extra_field);
	echo $str_err_report;
	// end (EP for product extra fields Contrib by minhmt DEVSOFTVN) ============
// /////////////////////
// or do product deletes
} elseif ( $items[$filelayout['v_status']] == EP_DELETE_IT ) {
  // Get the ID
  $sql = "SELECT p.products_id as v_products_id	FROM ".TABLE_PRODUCTS." as p WHERE p.products_model = '" . $items[$filelayout['v_products_model']] . "'";
  $result = tep_db_query($sql);
  $row =  tep_db_fetch_array($result);
  if (tep_db_num_rows($result) == 1 ) {
	tep_db_query("delete from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . $row['v_products_id'] . "'");
	$product_categories_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where products_id = '" . $row['v_products_id'] . "'");
	$product_categories = tep_db_fetch_array($product_categories_query);
	if ($product_categories['total'] == '0') {
	   tep_remove_product($row['v_products_id']);
	}
	if (USE_CACHE == 'true') {
	  tep_reset_cache_block('categories');
	  tep_reset_cache_block('also_purchased');
	}
	echo "Deleted product " . $items[$filelayout['v_products_model']] . " from the database<br />";
  } else {
	  echo "Did not delete " . $items['v_products_model'] . " since it is not unique ";
  }
// //////////////////////////////////
// or do regular product processing
// //////////////////////////////////
} else {
	// /////////////////////////////////////////////////////////////////////
	//
	// Start: Support for other contributions in products table
	//
	// /////////////////////////////////////////////////////////////////////
	$ep_additional_select = '';
	if (EP_MORE_PICS_6_SUPPORT == true) { 
	  $ep_additional_select .= 'p.products_subimage1 as v_products_subimage1,p.products_subimage2 as v_products_subimage2,p.products_subimage3 as v_products_subimage3,p.products_subimage4 as v_products_subimage4,p.products_subimage5 as v_products_subimage5,p.products_subimage6 as v_products_subimage6,';
	}	
	if (EP_UNKNOWN_ADD_IMAGES_SUPPORT == true) { 
	  $ep_additional_select .= 'p.products_mimage as v_products_mimage,p.products_bimage as v_products_bimage,p.products_subimage1 as v_products_subimage1,p.products_bsubimage1 as v_products_bsubimage1,p.products_subimage2 as v_products_subimage2,p.products_bsubimage2 as v_products_bsubimage2,p.products_subimage3 as v_products_subimage3,p.products_bsubimage3 as v_products_bsubimage3,';
	}
	foreach ($custom_fields[TABLE_PRODUCTS] as $key => $name) { 
	  $ep_additional_select .= 'p.' . $key . ' as v_' . $key . ',';
	}
	// /////////////////////////////////////////////////////////////////////
	// End: Support for other contributions in products table
	// /////////////////////////////////////////////////////////////////////
	// now do a query to get the record's current contents
	$sql = "SELECT
				p.products_id as v_products_id,
				p.products_model as v_products_model,
				p.products_image as v_products_image,
				$ep_additional_select
				p.products_trade as v_products_trade,
				p.products_price as v_products_price,
				p.products_msrp as v_products_msrp,
				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_current
			FROM
				".TABLE_PRODUCTS." as p,
				".TABLE_CATEGORIES." as subc,
				".TABLE_PRODUCTS_TO_CATEGORIES." as ptoc
			WHERE
				p.products_model = '" . $items[$filelayout['v_products_model']] . "' AND
				p.products_id = ptoc.products_id AND
				ptoc.categories_id = subc.categories_id
			LIMIT 1
		";
	$result = tep_db_query($sql);
	$row =  tep_db_fetch_array($result);
	// determine processing status based on dropdown choice on EP menu
	if ((sizeof($row) > 1) && ($_POST['imput_mode'] == "normal" || $_POST['imput_mode'] == "update")) {
		$process_product = true;
	} elseif ((sizeof($row) == 1) && ($_POST['imput_mode'] == "normal" || $_POST['imput_mode'] == "addnew")) {
		$process_product = true;
	} else {
		$process_product = false;
	}
	if ($process_product == true) {
		while ($row){
			// OK, since we got a row, the item already exists.
			// Let's get all the data we need and fill in all the fields that need to be defaulted 
			// to the current values for each language, get the description and set the vals
			foreach ($languages as $key => $lang){
				// products_name, products_description, products_url
				$sql2 = "SELECT * 
						FROM ".TABLE_PRODUCTS_DESCRIPTION."
						WHERE
							products_id = " . $row['v_products_id'] . " AND
							language_id = '" . $lang['id'] . "'
						LIMIT 1
						";
				$result2 = tep_db_query($sql2);
				$row2 =  tep_db_fetch_array($result2);
				// Need to report from ......_name_1 not ..._name_0
				$row['v_products_name_' . $lang['id']]		 = $row2['products_name'];
				$row['v_products_description_' . $lang['id']]	 = $row2['products_description'];
				$row['v_products_url_' . $lang['id']]		 = $row2['products_url'];
				foreach ($custom_fields[TABLE_PRODUCTS_DESCRIPTION] as $key => $name) { 
				  $row['v_' . $key . '_' . $lang['id']]		 = $row2[$key];
				}
				// header tags controller support
				if(isset($filelayout['v_products_head_title_tag_' . $lang['id'] ])){
					$row['v_products_head_title_tag_' . $lang['id']]	 = $row2['products_head_title_tag'];
					$row['v_products_head_desc_tag_' . $lang['id']]	 = $row2['products_head_desc_tag'];
					$row['v_products_head_keywords_tag_' . $lang['id']]	 = $row2['products_head_keywords_tag'];
				}
				// end: header tags controller support
			}
			// start with v_categories_id
			// Get the category description
			// set the appropriate variable name
			// if parent_id is not null, then follow it up.
			$thecategory_id = $row['v_categories_id'];
			for( $categorylevel=1; $categorylevel<=(EP_MAX_CATEGORIES+1); $categorylevel++){
				if ($thecategory_id){
					$sql3 = "SELECT parent_id, 
									categories_image
							 FROM ".TABLE_CATEGORIES."
							 WHERE	
									categories_id = " . $thecategory_id . '';
					$result3 = tep_db_query($sql3);
					if ($row3 = tep_db_fetch_array($result3)) {
						$temprow['v_categories_image_' . $categorylevel] = $row3['categories_image'];
					}
					foreach ($languages as $key => $lang){
						$sql2 = "SELECT categories_name
								 FROM ".TABLE_CATEGORIES_DESCRIPTION."
								 WHERE	
										categories_id = " . $thecategory_id . " AND
										language_id = " . $lang['id'];
						$result2 = tep_db_query($sql2);
						if ($row2 =  tep_db_fetch_array($result2)) {
							$temprow['v_categories_name_' . $categorylevel . '_' . $lang['id']] = $row2['categories_name'];
						}
					}
					// now get the parent ID if there was one
					$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;
					}
				} else {
					$temprow['v_categories_image_' . $categorylevel] = '';
					foreach ($languages as $key => $lang){
						$temprow['v_categories_name_' . $categorylevel . '_' . $lang['id']] = '';
					}
				}
			}
			// temprow has the old style low to high level categories.
			$newlevel = 1;
			// let's turn them into high to low level categories
			for( $categorylevel=EP_MAX_CATEGORIES+1; $categorylevel>0; $categorylevel--){
				$found = false;
				if ($temprow['v_categories_image_' . $categorylevel] != ''){
					$row['v_categories_image_' . $newlevel] = $temprow['v_categories_image_' . $categorylevel];
					$found = true;
				}
				foreach ($languages as $key => $lang){
					if ($temprow['v_categories_name_' . $categorylevel . '_' . $lang['id']] != ''){
						$row['v_categories_name_' . $newlevel . '_' . $lang['id']] = $temprow['v_categories_name_' . $categorylevel . '_' . $lang['id']];
						$found = true;
					}
				}
				if ($found == true) {
					$newlevel++;
				}
			}
			// default the manufacturer		
			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'];
			}
			//elari -
			//We check the value of tax class and title instead of the id
			//Then we add the tax to price if EP_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 (EP_PRICE_WITH_TAX == true){
				$row['v_products_price'] = $row['v_products_price'] + round(($row['v_products_price'] * $row_tax_multiplier / 100), EP_PRECISION);
			}
			// 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 $tkey => $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 ){
			if (!($key == 'v_date_added' && empty($items[ $value ]))) {
				 $$key = $items[ $value ];
			}
		}
		//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 (EP_PRICE_WITH_TAX == true){
			$v_products_price = round( $v_products_price / (1 + ($row_tax_multiplier * .01)), EP_PRECISION);
		}
		// if they give us one category, they give us all categories. convert data structure to a multi-dim array
		unset ($v_categories_name); // default to not set.
		unset ($v_categories_image); // default to not set.
		foreach ($languages as $key => $lang){
		  $baselang_id = $lang['id'];
		  break;
		}
		if ( isset( $filelayout['v_categories_name_1_' . $baselang_id] ) ){
			$v_categories_name = array();
			$v_categories_image = array();
			$newlevel = 1;
			for( $categorylevel=EP_MAX_CATEGORIES; $categorylevel>0; $categorylevel--){
				$found = false;
				if ($items[$filelayout['v_categories_image_' . $categorylevel]] != '') {
				  $v_categories_image[$newlevel] = $items[$filelayout['v_categories_image_' . $categorylevel]];
				  $found = true;
				}
				foreach ($languages as $key => $lang){
					if ( $items[$filelayout['v_categories_name_' . $categorylevel . '_' . $lang['id']]] != ''){
						$v_categories_name[$newlevel][$lang['id']] = $items[$filelayout['v_categories_name_' . $categorylevel . '_' . $lang['id']]];
						$found = true;
					}
				}
				if ($found == true) {
				  $newlevel++;
				}
			}
			while( $newlevel < EP_MAX_CATEGORIES+1){
				$v_categories_image[$newlevel] = ''; // default the remaining items to nothing
				foreach ($languages as $key => $lang){
				  $v_categories_name[$newlevel][$lang['id']] = ''; // default the remaining items to nothing
				}
				$newlevel++;
			}
		}
		if (ltrim(rtrim($v_products_quantity)) == '') {
			$v_products_quantity = 1;
		}
		if (empty($v_date_avail)) {
			$v_date_avail = 'NULL';
		} else {
			$v_date_avail = "'" . date("Y-m-d H:i:s",strtotime($v_date_avail)) . "'";
		}
		if (empty($v_date_added)) {
			$v_date_added = "'" . date("Y-m-d H:i:s") . "'";
		} else {
			$v_date_added = "'" . date("Y-m-d H:i:s",strtotime($v_date_added)) . "'";
		}
		// default the stock if they spec'd it or if it's blank
		if (isset($v_status_current)){
		  $v_db_status = strval($v_status_current); // default to current value
		} else {
		  $v_db_status = '1'; // default to active
		}
		if (trim($v_status) == EP_TEXT_INACTIVE){
			// they told us to deactivate this item
			$v_db_status = '0';
		} elseif (trim($v_status) == EP_TEXT_ACTIVE) {
			$v_db_status = '1';
		}	
		if (EP_INACTIVATE_ZERO_QUANTITIES == 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_DEFAULT_IMAGE_PRODUCT;
		}
		if (strlen($v_products_model) > EP_MODEL_NUMBER_SIZE ){
			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 ".EP_MODEL_NUMBER_SIZE.".<br />
				You can either shorten your model numbers or increase the size of the<br />
				\"products_model\" field of the \"products\" table in the database.<br />
				Then change the setting at the top of the easypopulate.php file.</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 = '" . tep_db_input($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_DEFAULT_IMAGE_MANUFACTURER."'
					)";
				*/
				// 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,
					'".tep_db_input($v_manufacturers_name)."',
					'".EP_DEFAULT_IMAGE_MANUFACTURER."',
					'".date("Y-m-d H:i:s")."',
					'".date("Y-m-d H:i:s")."'
					)";
				$result = tep_db_query($sql);
				$v_manufacturer_id = $max_mfg_id;
				$sql = "INSERT INTO ".TABLE_MANUFACTURERS_INFO."(
					manufacturers_id,
					manufacturers_url,
					languages_id
					) VALUES (
					$max_mfg_id,
					'',
					'".EP_DEFAULT_LANGUAGE_ID."'
					)";
				$result = tep_db_query($sql);
			}
		}
		// if the categories names are set then try to update them
		foreach ($languages as $key => $lang){
		  $baselang_id = $lang['id'];
		  break;
		}
		if ( isset( $filelayout['v_categories_name_1_' . $baselang_id] ) ){
			// 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_CATEGORIES+1; $categorylevel>0; $categorylevel-- ){
			  //foreach ($languages as $key => $lang){
				$thiscategoryname = $v_categories_name[$categorylevel][$baselang_id];
				if ( $thiscategoryname != ''){
					// we found a category name in this field, look for database entry
					$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 = " . $baselang_id . " AND
							cat.parent_id = " . $theparent_id . " AND
							des.categories_name like '" . tep_db_input($thiscategoryname) . "'";
					$result = tep_db_query($sql);
					$row =  tep_db_fetch_array($result);
					if ( $row != '' ){
						// we have an existing category, update image and date
						foreach( $row as $item ){
							$thiscategoryid = $item;
						}
						$cat_image = '';
						if (!empty($v_categories_image[$categorylevel])) {
						   $cat_image = "categories_image='".tep_db_input($v_categories_image[$categorylevel])."', ";
						} elseif (isset($filelayout['v_categories_image_' . $categorylevel])) {
						   $cat_image = "categories_image='', ";
						} 
						$query = "UPDATE ".TABLE_CATEGORIES."
								  SET 
									$cat_image
									last_modified = '".date("Y-m-d H:i:s")."'
								  WHERE 
									categories_id = '".$row['categories_id']."'
								  LIMIT 1";
						tep_db_query($query);
					} 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." (
									categories_id,
									parent_id,
									categories_image,
									sort_order,
									date_added,
									last_modified
							   ) VALUES (
									$max_category_id,
									$theparent_id,
									'".tep_db_input($v_categories_image[$categorylevel])."',
									0,
									'".date("Y-m-d H:i:s")."',
									'".date("Y-m-d H:i:s")."'
							   )";
						$result = tep_db_query($sql);
						foreach ($languages as $key => $lang){
							$sql = "INSERT INTO ".TABLE_CATEGORIES_DESCRIPTION." (
											categories_id,
											language_id,
											categories_name
								   ) VALUES (
											$max_category_id,
											'".$lang['id']."',
											'".(!empty($v_categories_name[$categorylevel][$lang['id']])?tep_db_input($v_categories_name[$categorylevel][$lang['id']]):'')."'
								   )";
							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!
			foreach ($items as $tkey => $item) {
			  print_el($item);
			}
			// process the PRODUCTS table
			$result = tep_db_query("SELECT products_id FROM ".TABLE_PRODUCTS." WHERE (products_model = '". $v_products_model . "')");
			// First we check to see if this is a product in the current db.
			if (tep_db_num_rows($result) == 0)  {
				//   insert into products
				echo "<font color='green'> !New Product!</font><br />";
				// /////////////////////////////////////////////////////////////////////
				//
				// Start: Support for other contributions
				//
				// /////////////////////////////////////////////////////////////////////
				$ep_additional_fields = '';
				$ep_additional_data = '';
				foreach ($custom_fields[TABLE_PRODUCTS] as $key => $name) { 
				  $ep_additional_fields .= $key . ',';
				}
				foreach ($custom_fields[TABLE_PRODUCTS] as $key => $name) { 
				  $tmp_var = 'v_' . $key;
				  $ep_additional_data .= "'" . $$tmp_var . "',";
				}
				if (EP_MORE_PICS_6_SUPPORT == true) { 
				  $ep_additional_fields .= 'products_subimage1,products_subimage2,products_subimage3,products_subimage4,
products_subimage5,products_subimage6,';
				  $ep_additional_data .= "'$v_products_subimage1','$v_products_subimage2','$v_products_subimage3','$v_products_subimage4','$v_products_subimage5','$v_products_subimage6',";
				}	
				if (EP_UNKNOWN_ADD_IMAGES_SUPPORT == true) { 
				  $ep_additional_fields .= 'products_mimage,products_bimage,products_subimage1,products_bsubimage1,produ
cts_subimage2,products_bsubimage2,products_subimage3,products_bsubimage3,';
				  $ep_additional_data .= "'$v_products_mimage','$v_products_bimage','$v_products_subimage1','$v_products_bsubimage1','$v_products_subimage2','$v_products_bsubimage2','$v_products_subimage3','$v_products_bsubimage3',";
				}
				// /////////////////////////////////////////////////////////////////////
				// End: Support for other contributions
				// /////////////////////////////////////////////////////////////////////
				$query = "INSERT INTO ".TABLE_PRODUCTS." (
							products_image,
							$ep_additional_fields
							products_model,
							products_trade,
							products_price,
							products_msrp,
							products_status,
							products_last_modified,
							products_date_added,
							products_date_available,
							products_tax_class_id,
							products_weight,
							products_quantity,
							manufacturers_id )
						  VALUES (
							".(!empty($v_products_image)?"'".$v_products_image."'":'NULL').",
							$ep_additional_data
							'$v_products_model',
							'$v_products_trade',
							'$v_products_price',
							'$v_products_msrp',
							'$v_db_status',
							'".date("Y-m-d H:i:s")."',
							".$v_date_added.",
							".$v_date_avail.",
							'$v_tax_class_id',
							'$v_products_weight',
							'$v_products_quantity',
							".(!empty($v_manufacturer_id)?$v_manufacturer_id:'NULL').")
							";
				$result = tep_db_query($query);
				$v_products_id = tep_db_insert_id();
			} else {
			  // existing product(s), get the id from the query
			  // and update the product data
			  while ($row = tep_db_fetch_array($result)) {
				$v_products_id = $row['products_id'];
				echo "<font color='black'> Updated</font><br />";
				// /////////////////////////////////////////////////////////////////////
				//
				// Start: Support for other contributions
				//
				// /////////////////////////////////////////////////////////////////////
				$ep_additional_updates = '';
				foreach ($custom_fields[TABLE_PRODUCTS] as $key => $name) { 
				  $tmp_var = 'v_' . $key;
				  $ep_additional_updates .= $key . "='" . $$tmp_var . "',";
				}
				if (EP_MORE_PICS_6_SUPPORT == true) { 
				  $ep_additional_updates .= "products_subimage1='$v_products_subimage1',products_subimage2='$v_products_subimage2',products_subimage3='$v_products_subimage3',products_subimage4='$v_products_subimage4',products_subimage5='$v_products_subimage5',products_subimage6='$v_products_subimage6',";
				}	
				if (EP_UNKNOWN_ADD_IMAGES_SUPPORT == true) { 
				  $ep_additional_updates .= "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',";
				}
				// /////////////////////////////////////////////////////////////////////
				// End: Support for other contributions
				// /////////////////////////////////////////////////////////////////////
				$query = "UPDATE ".TABLE_PRODUCTS."
						  SET
							products_trade='$v_products_trade', 
							products_price='$v_products_price', 
							products_msrp='$v_products_msrp', 
							products_image=".(!empty($v_products_image)?"'".$v_products_image."'":'NULL').",

Getting better with mods but no programmer am I.

Link to comment
Share on other sites

My Question:

 

I have an online oscommerce store with easy populate installed. I also have another contrib that allows me to give MSRPs for each product (found here). When I prepare an excel spreadsheet with thousands of products to upload into easy populate (as a csv), there is no field (column) to add the MSRPs into. So, after I upload a large database of products, I must go through each product in the oscommerce admin panel and add each individual MSRP separately. I was wondering if there is any way to add another field into my csv files where I can give the MSRP for each product before I upload it all into easy populate.

 

Thanks in advance,

 

Matt

 

 

Be aware Matt the file is only partially provided as the whole file was too large to post.

 

so you can either replace the whole sction and remove the products_trade.

 

Or you can use the post to look up the sections of the code, I worked this out by looking for the products_price and basically copying it and replacing the duplicate with msrp. I have tested this out on three stores so I would say its reliable, but back up the easypopulate file just in case.

 

Note the msrp was not added anywhere else, as its not needed for the froogle(googlebase etc).

 

Hope this helps

 

Johnny

Getting better with mods but no programmer am I.

Link to comment
Share on other sites

Great reply Johnny, I was looking for that info too.

 

I have a question for you related to this topic:

 

I have an older extra images contribution installed in my oscommerce store. The contribution can be found here (Extra Images - v 1.6.1). When I prepare an excel spreadsheet with thousands of products to upload into easy populate (as a csv), there is no field (column) to add the extra images (up to 4 images per product) into. So, after I upload a large database of products, I must go through each product in the oscommerce admin panel and add each individual extra image separately.

 

In the database the extra images are stored in a separate table (not in the same table as products_price) with the product ID (like products_description is stored). Because of this, I don't think the above strategy will work for me.

 

I was wondering if there is any way to add 4 fields into my csv files where I can give extra images for each product before I upload it all into easy populate.

 

Thanks,

 

David

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...