Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Easy Populate & Products Attributes


VJ

Recommended Posts

yes, there is a setting in the easypopulate.php file, probably set to 15 at the default. you will need to alter your database too, else it doesnt make any difference.

I did find it.

it is set to 32 by default

around line 59 you will see

//**** Size of products_model in products table ****
// set this to the size of your model number field in the db.  We check to make sure all models are no longer than this value.
// this prevents the database from getting fubared.  Just making this number bigger won't help your database!  They must match!
global $modelsize;
$modelsize = 32;

Change the modelsize=32 to whatever length you need, in my case it was 110

 

you will also need to go into phpmyadmin (or equivelant) and edit the "categories_description" table field named category_id to being the same length as your model size (expressed as a numeric value)

Hope that helps someone since no one appeared to have a clear cut answer for me.

Link to comment
Share on other sites

After searching the board I came accross a thread where it suggested to rmove the $ sign.

my Configure.php went from this:

 

define('DIR_FS_$DOCUMENT_ROOT', 'D:/Wamp/www/e-commerce/'); // where the pages are located on the server

 

and now back to the original code this:

 

define('DIR_FS_DOCUMENT_ROOT', 'D:/Wamp/www/e-commerce/'); // where the pages are located on the server

 

 

I'm now using the "Import EP file from Temp Dir" field to import the data in my database.

I do have a EP2007Jan21-1806.txt file in my /Wamp/www/e-commerce/temp folder, when I click on INSERT into db I get the following errors:

 

 

Filename: EP2007Jan21-1806.txt

 

Warning: file(D:/Wamp/www/e-commerce//e-commerce/temp/EP2007Jan21-1806.txt) [function.file]: failed to open stream: No such file or directory in D:\wamp\www\e-commerce\admin\easypopulate.php on line 824

 

Warning: Invalid argument supplied for foreach() in D:\wamp\www\e-commerce\admin\easypopulate.php on line 844

 

 

This is line 824 of my easypopulate.php $readed = file($tempdir . $localfile);

This is line 844 of my easypopulate.php foreach ($readed as $read){

 

 

I need some serious help as I don't know what else I should do.

Link to comment
Share on other sites

After searching the board I came accross a thread where it suggested to rmove the $ sign.

my Configure.php went from this:

 

define('DIR_FS_$DOCUMENT_ROOT', 'D:/Wamp/www/e-commerce/'); // where the pages are located on the server

 

and now back to the original code this:

 

define('DIR_FS_DOCUMENT_ROOT', 'D:/Wamp/www/e-commerce/'); // where the pages are located on the server

I'm now using the "Import EP file from Temp Dir" field to import the data in my database.

I do have a EP2007Jan21-1806.txt file in my /Wamp/www/e-commerce/temp folder, when I click on INSERT into db I get the following errors:

Filename: EP2007Jan21-1806.txt

 

Warning: file(D:/Wamp/www/e-commerce//e-commerce/temp/EP2007Jan21-1806.txt) [function.file]: failed to open stream: No such file or directory in D:\wamp\www\e-commerce\admin\easypopulate.php on line 824

 

Warning: Invalid argument supplied for foreach() in D:\wamp\www\e-commerce\admin\easypopulate.php on line 844

This is line 824 of my easypopulate.php $readed = file($tempdir . $localfile);

This is line 844 of my easypopulate.php foreach ($readed as $read){

I need some serious help as I don't know what else I should do.

 

you are looking to change the wrong setting. The items in your /admin/includes/configure.php were probably correct from the beginning. you need to set the temp dir in the EP settings. In your case it would be this:

 

$tempdir = DIR_FS_DOCUMENT_ROOT . "temp/";

 

why? because: DIR_FS_DOCUMENT_ROOT equals this: 'D:/Wamp/www/e-commerce/' from your configure.php file.

and when you add "temp/" to the end as in the EP settings area (shown above), you will have this:

D:/Wamp/www/e-commerce/temp/

which should be your correct path for your temp location.

 

hope this helped you learned something. :)

Link to comment
Share on other sites

I did find it.

it is set to 32 by default

around line 59 you will see

//**** Size of products_model in products table ****
// set this to the size of your model number field in the db.  We check to make sure all models are no longer than this value.
// this prevents the database from getting fubared.  Just making this number bigger won't help your database!  They must match!
global $modelsize;
$modelsize = 32;

Change the modelsize=32 to whatever length you need, in my case it was 110

 

you will also need to go into phpmyadmin (or equivelant) and edit the "categories_description" table field named category_id to being the same length as your model size (expressed as a numeric value)

Hope that helps someone since no one appeared to have a clear cut answer for me.

it is mentioned in the docs. maybe a bid cryptic, but its there. search the docs for "Longer product_model in database:"

 

Actually, if you are really talking about the $modelsize setting, you should be changing the "products" table and the "products_model" field.

Link to comment
Share on other sites

Hi,

 

I have installed yhe latest version of Easy Populate 2.76d-MS2 (with attributes) and i get an error.

I have done everythings whats on the readme,

 

Warning: move_uploaded_file(/home/buysitec/public_html//catalog/temp/EP2007Jan21-1402.txt): failed to open stream: No such file or directory in /home/buysitec/public_html/admin/easypopulate_functions.php on line 43

 

Warning: move_uploaded_file(): Unable to move '/tmp/phpHrj4kH' to '/home/buysitec/public_html//catalog/temp/EP2007Jan21-1402.txt' in /home/buysitec/public_html/admin/easypopulate_functions.php on line 43

 

 

File uploaded.

Temporary filename: /tmp/phpHrj4kH

User filename: EP2007Jan21-1402.txt

Size: 84

 

Warning: file(/home/buysitec/public_html//catalog/temp/EP2007Jan21-1402.txt): failed to open stream: No such file or directory in /home/buysitec/public_html/admin/easypopulate.php on line 805

 

Warning: Invalid argument supplied for foreach() in /home/buysitec/public_html/admin/easypopulate.php on line 844

 

 

could anybody help me becuase I do not know what i have done wrong.

Link to comment
Share on other sites

the problem is the register globals. this contrib has never been updated for that and won't work on that server at the moment....

It may be useful to know that the register globals contribution includes a patch for easy populate :-)

 

Rich

Link to comment
Share on other sites

try this. in v2.76d. find around line 1890 this block:

		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
	}

 

replace with this:

 

		if (isset($filelayout['v_products_name_' . $l_id ])){
		$v_products_name[$l_id] 	= $items[$filelayout['v_products_name_' . $l_id]];
	}
	if (isset($filelayout['v_products_description_' . $l_id ])){
		$v_products_description[$l_id] 	= $items[$filelayout['v_products_description_' . $l_id ]];
	}
	if (isset($filelayout['v_products_url_' . $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

 

by the look of the code, I would say the product URL would get blanked also.

 

It's more complicated than this solution.

You need to create 'default' values for the name / description / url fields, as the code does for other fields a few lines above.

Here's my solution:

below

		// 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];
	}

(around line 1800-ish)

 

add these lines:

// #### Maynard's Fix 1.1
// we have to default the name, description and url, otherwise they'll get deleted later on...
	foreach ($langcode as $lang){		
		$maynard_keys = Array('v_products_name_', 'v_products_description_', 'v_products_url_');
		foreach ($maynard_keys as $key) {
			$thisvar = $key . $lang['id'];
			$$thisvar = $row[$thisvar];
		} 
	}					
// #### EOF Maynard's Fix 1

 

then, instead of

		if (isset($items[$filelayout['v_products_name_' . $l_id ]])){
		//we set dynamically the language values
		$v_products_name[$l_id] 	= $items[$filelayout['v_products_name_' . $l_id]];
		} else {
		$thisvar = "v_products_name_$l_id";
		$v_products_name[$l_id] = $$thisvar 
		} 
	if (isset($items[$filelayout['v_products_description_' . $l_id ]])) {
		$v_products_description[$l_id] 	= $items[$filelayout['v_products_description_' . $l_id ]];
		}
	if (isset($items[$filelayout['v_products_url_' . $l_id ]])) {
		$v_products_url[$l_id] 		= $items[$filelayout['v_products_url_' . $l_id ]];
		}

 

put this:

// #### Maynard's Fix 1.2
// I've tidied this up, and included the defaults we've just defined above		
	$maynard_keys = Array('v_products_name_', 'v_products_description_', 'v_products_url_');		
	foreach ($maynard_keys as $key) {
		if (isset($items[$filelayout[$key . $l_id ]])){
			//we set dynamically the language values
			$$key = $items[$filelayout[$key . $l_id]];	
			} else {
			$thisvar = $key . $l_id;
			$$key = $$thisvar;
			} 
		}
	$v_products_name[$l_id] = $v_products_name_;
	$v_products_description[$l_id] = $v_products_description_;
	$v_products_url[$l_id] = $v_products_url_;				
// #### EOF Maynard's Fix 1.2

 

And voila - your descriptions won't get deleted.

However - your download file names will vanish, if you're downloading attributes, so you need to do this as well:

 

find these lines:

				$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);

around 2400 ish

and comment them out:

/*
			$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);
*/

HEALTH WARNING: I can't really work out why those lines were there in the first place - but I've used this and nothing seems to be damaged!

 

Hope this helps.

 

I've also got a fix for the excel-safe not dealing with fields that begin with a quote - but I doubt anyone else wants that :-)

favicon.gif I'm Maynard, and I'm happily running, maintaining, tweaking osC on Maynard's Groovy Bible Tunes (google it!)
Link to comment
Share on other sites

Hi,

 

I have installed yhe latest version of Easy Populate 2.76d-MS2 (with attributes) and i get an error.

I have done everythings whats on the readme,

 

Warning: move_uploaded_file(/home/buysitec/public_html//catalog/temp/EP2007Jan21-1402.txt): failed to open stream: No such file or directory in /home/buysitec/public_html/admin/easypopulate_functions.php on line 43

 

Warning: move_uploaded_file(): Unable to move '/tmp/phpHrj4kH' to '/home/buysitec/public_html//catalog/temp/EP2007Jan21-1402.txt' in /home/buysitec/public_html/admin/easypopulate_functions.php on line 43

File uploaded.

Temporary filename: /tmp/phpHrj4kH

User filename: EP2007Jan21-1402.txt

Size: 84

 

Warning: file(/home/buysitec/public_html//catalog/temp/EP2007Jan21-1402.txt): failed to open stream: No such file or directory in /home/buysitec/public_html/admin/easypopulate.php on line 805

 

Warning: Invalid argument supplied for foreach() in /home/buysitec/public_html/admin/easypopulate.php on line 844

could anybody help me becuase I do not know what i have done wrong.

please read one of the many post that explain this problem.

Link to comment
Share on other sites

I think you missed the instruction that every product you import must have a unique model number defined in the first column of the import file. your products on the shop must also have a unique model number.

 

I actually knew that but, because I use some of the same products under different categories, I didn't realize that I would have to adjust all those model numbers.

 

Thanks for "reminding" me...I'll make the corrections!

 

Marcia

Link to comment
Share on other sites

I actually knew that but, because I use some of the same products under different categories, I didn't realize that I would have to adjust all those model numbers.

 

Thanks for "reminding" me...I'll make the corrections!

 

Marcia

STOP!!!

the product id can be the same for different categories.

 

I have it on mine.

I have the same part# in multiple categories.

Link to comment
Share on other sites

you are looking to change the wrong setting. The items in your /admin/includes/configure.php were probably correct from the beginning. you need to set the temp dir in the EP settings. In your case it would be this:

 

$tempdir = DIR_FS_DOCUMENT_ROOT . "temp/";

 

why? because: DIR_FS_DOCUMENT_ROOT equals this: 'D:/Wamp/www/e-commerce/' from your configure.php file.

and when you add "temp/" to the end as in the EP settings area (shown above), you will have this:

D:/Wamp/www/e-commerce/temp/

which should be your correct path for your temp location.

 

hope this helped you learned something. :)

 

 

You were right on the Ball, your suggestion fixed my prolem. I thank you a great deal and keep up the good work.

Link to comment
Share on other sites

Problem Importing Products:

 

I just installed easy populate and it seems to be working fine. I was able to download the product database from the test catalog with out any problems. I opened the CSV file checked it out to see how it looked. So I try to import the file back into the catalog and i received errors with blade runner director's cut. the problem seems to be the ' on director's

 

 

I have these settings on my easypopulate file which i think can affect this.. but I don't know

 

 

// **** Quote -> Escape character conversion ****

// If you have extensive html in your descriptions and it's getting mangled on upload, turn this off

// set to 1 = replace quotes with escape characters

// set to 0 = no quote replacement

global $replace_quotes;

$replace_quotes = false;

 

// *** Excel safe output ***

// this setting will supersede the previous $separator setting and create a file

// that excel will import without spanning cells from embedded commas.

global $excel_safe_output;

$excel_safe_output = true; // default is: false

if ($excel_safe_output == true) { $separator = ","; }

 

// *** Preserve Tabs, Carriage returns and Line feeds ***

// this setting will preserve the special chars that can cause problems in

// a text based output. When used with $excel_safe_output, it will safely

// preserve these elements in the export and import.

global $preserve_tabs_cr_lf;

$preserve_tabs_cr_lf = false; // default is: true

 

 

Any Insite on how to fix this problem... it would be a real pain to have to try and fix an entire database if some products have a ' in them

Link to comment
Share on other sites

Then how do you avoid multiple entries?

if you want the product to be created in an second category, duplicate the product in file you will import (with same model number) and just change the category name.

 

If you already have a product in multiple categories, and have used the "Duplicate product" method (in osC admin), then each needs a unique model number.

 

If you have a product in multiple categories and have created them with "Link product" method (in osC admin), then your export will probably reflect only one product in one category. This will be OK for product updates (import). The product will still remain in both categories, and both will be updated from the one model number that exists in the database.

 

this contribution can't be used to remove products or to remove products from categories.

 

hope that explains what you need.

Link to comment
Share on other sites

Problem Importing Products:

 

I just installed easy populate and it seems to be working fine. I was able to download the product database from the test catalog with out any problems. I opened the CSV file checked it out to see how it looked. So I try to import the file back into the catalog and i received errors with blade runner director's cut. the problem seems to be the ' on director's

I have these settings on my easypopulate file which i think can affect this.. but I don't know

// **** Quote -> Escape character conversion ****

// If you have extensive html in your descriptions and it's getting mangled on upload, turn this off

// set to 1 = replace quotes with escape characters

// set to 0 = no quote replacement

global $replace_quotes;

$replace_quotes = false;

 

// *** Excel safe output ***

// this setting will supersede the previous $separator setting and create a file

// that excel will import without spanning cells from embedded commas.

global $excel_safe_output;

$excel_safe_output = true; // default is: false

if ($excel_safe_output == true) { $separator = ","; }

 

// *** Preserve Tabs, Carriage returns and Line feeds ***

// this setting will preserve the special chars that can cause problems in

// a text based output. When used with $excel_safe_output, it will safely

// preserve these elements in the export and import.

global $preserve_tabs_cr_lf;

$preserve_tabs_cr_lf = false; // default is: true

Any Insite on how to fix this problem... it would be a real pain to have to try and fix an entire database if some products have a ' in them

 

 

Actually I think the problem maybe with the Header Tags contribution. It seems like the ' are not changing. to /'

 

This is the Error i get:

1064 - You have an error in your SQL syntax near 's Cut', products_head_desc_tag = 'Blade Runner - Director's Cut', ' at line 1

 

UPDATE products_description SET products_name = 'Blade Runner - Director\'s Cut', products_description = 'Regional Code: 2 (Japan, Europe, Middle East, South Africa).

Languages: English, Deutsch.

Subtitles: English, Deutsch, Spanish.

Audio: Dolby Surround 5.1.

Picture Format: 16:9 Wide-Screen.

Length: (approx) 112 minutes.

Other: Interactive Menus, Chapter Selection, Subtitles (more languages).', products_url = 'www.bladerunner.com', products_head_title_tag = 'Blade Runner - Director's Cut', products_head_desc_tag = 'Blade Runner - Director's Cut', products_head_keywords_tag = 'Blade Runner - Director's Cut' WHERE products_id = '5' AND language_id = '1'

 

Notice that product_name changes to 'Blade Runner - Director\'s Cut'

 

HMM any ideas on this one?

Link to comment
Share on other sites

Problem Importing Products:

 

I just installed easy populate and it seems to be working fine. I was able to download the product database from the test catalog with out any problems. I opened the CSV file checked it out to see how it looked. So I try to import the file back into the catalog and i received errors with blade runner director's cut. the problem seems to be the ' on director's

An Error? like what error?

Link to comment
Share on other sites

Actually I think the problem maybe with the Header Tags contribution. It seems like the ' are not changing. to /'

 

This is the Error i get:

1064 - You have an error in your SQL syntax near 's Cut', products_head_desc_tag = 'Blade Runner - Director's Cut', ' at line 1

yes. that's the one.

 

find line 2218-2200:

										'". $v_products_head_title_tag[$key] . "',
									'". $v_products_head_desc_tag[$key] . "',
									'". $v_products_head_keywords_tag[$key] . "')";

replace:

										'". addslashes($v_products_head_title_tag[$key]) . "',
									'". addslashes($v_products_head_desc_tag[$key]) . "',
									'". addslashes($v_products_head_keywords_tag[$key]) . "')";

 

find line 2242-2244:

									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] ."'

replace:

									products_head_title_tag = '" . addslashes($v_products_head_title_tag[$key]) ."',
								products_head_desc_tag = '" . addslashes($v_products_head_desc_tag[$key]) ."',
								products_head_keywords_tag = '" . addslashes($v_products_head_keywords_tag[$key]) ."'

Link to comment
Share on other sites

after checking further , it appears that EP is not happy when uploading a file with a description that contains HTML. It wrecks the HTML.

 

It works fine as long as i have no HTML in my descriptions. Some of my products have HTML descriptions and some don't.

 

 

HTML is the problem.

 

 

Is there any fix for this ?

 

luckily for me , 60 products have HTML and 500 dont ! :thumbsup:

 

 

be nice to get it fixed ?

Link to comment
Share on other sites

I've got EP v.290b_1 installed and everything was working fine till I hit the 1000 product mark, now when I try to download I get an error message, which according to my provider is caused by it timing out. According to my provider, they have a restriction of 30 seconds script execution time on our servers, so is there anyway to work around this, or is EP only going to be good for uploading? :(

Link to comment
Share on other sites

if you will upload new products, yes. if you are changing existing products, no

looks like your setting in your /catalog/admin/includes/configure.php is not right.

 

should look like this:

 

define('DIR_FS_DOCUMENT_ROOT', $DOCUMENT_ROOT);

 

Okay, just need to be sure of something: the above line actually says:

 

define('DIR_FS_DOCUMENT_ROOT', '/home/mythgame/public_html'); // where the pages are located on the server

 

Now should I replace that whole string, or just add the $DOCUMENT_ROOT behind the , like so:

 

define('DIR_FS_DOCUMENT_ROOT', $DOCUMENT_ROOT '/home/mythgame/public_html'); // where the pages are located on the server

 

Thanks Surf!

Cory

Edited by teraknor
Link to comment
Share on other sites

after checking further , it appears that EP is not happy when uploading a file with a description that contains HTML. It wrecks the HTML.

 

It works fine as long as i have no HTML in my descriptions. Some of my products have HTML descriptions and some don't.

HTML is the problem.

Is there any fix for this ?

 

luckily for me , 60 products have HTML and 500 dont ! :thumbsup:

be nice to get it fixed ?

 

Just don't use quotes in your HTML tags. It's that simple.

Link to comment
Share on other sites

after checking further , it appears that EP is not happy when uploading a file with a description that contains HTML. It wrecks the HTML.

 

It works fine as long as i have no HTML in my descriptions. Some of my products have HTML descriptions and some don't.

HTML is the problem.

Is there any fix for this ?

 

luckily for me , 60 products have HTML and 500 dont ! :thumbsup:

be nice to get it fixed ?

if you have v2.76d, enable the Excel Safe Output feature and the Preserve Tabs, Carriage returns and Line feeds feature. Should handle it fine. That is why I added those features.

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...