Jump to content
VJ

Easy Populate & Products Attributes

Recommended Posts

I dunno if anyone posted this here yet, but since I just posted this in another topic, here is a simple way to add your own field to ep:

 

Open easypopulate.php:

 

1. Find $default_these = array(

 

-add your field in the list

 

2. Find the first ocurrence of // build the categories name section of the array based on the number of categores the user wants to have

A few lines below, find $filelayout = array_merge($filelayout, array(

 

-add your field in the list

 

3. Just below that, find $filelayout_sql = "SELECT

 

-add your field in the list

 

4. Find // now do a query to get the record's current contents

 

-add your field to the list

 

5. Find $query = "INSERT INTO ".TABLE_PRODUCTS." (

 

-add your field to the list

 

 

That's should be all ;)

 

 

 

And here is an easy way to SKIP existing products instead of overwriting them:

 

Open easypopulate.php:

 

1. Find: // and update the product data

 

-Replace echo "<font color='black'> Updated</font><br>";

 

With: echo "<font color='red'> SKU already exists, skipped!</font><br>";

 

2. Delete/comment out:

 

$row = tep_db_fetch_array($result);

$query = 'UPDATE '.TABLE_PRODUCTS.'

SET

products_price="'.$v_products_price.

'" ,products_image="'.$v_products_image;

 

3. A few lines more lines below, delete/comment out:

 

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

'" ,manufacturers_id=' . $v_manufacturer_id .

' , products_status=' . $v_db_status . '

WHERE

(products_id = "'. $v_products_id . '")';

 

$result = tep_db_query($query);

 

That's all ;)

Share this post


Link to post
Share on other sites

Hi,

 

I've finally taken the plunge and started trying to install this contribution, I was terrified everything would go wrong!

 

Anyway, it seemed to go remarkably well.

 

I have exported to excel - I used the option

 

Export EP or Froogle Products File

 

Create then download

Complete

 

 

I saved to my local hard drive.

 

I opened in Excel and everything was there (I only have 5 items in this test site)

 

I changed the name of the products, then saved to csv then used the top option in EP - Upload and Import EP File and then pressed Insert to db - but nothing happened.

 

I have read all the notes and I think I followed correctly, the only thing I changed in easypopulate.php was HTC to true as I do use that - I didn't change anything else, so I'm using the EP_EXCEL_SAFE_OUTPUT - it says in the notes you should save the file as DOS-CSV - I couldn't fnd this option so just saved as CSV - is this my error?

 

I've gone through the Trouble shooting section but couldn't work out what I'd done wrong.

 

Any suggestions gratefully received

 

Lotti

Share this post


Link to post
Share on other sites

I have been using EP on developing environment, now I have move it to the actual server and EP does not want to work. I get to the EP page, upload something and takes me back to the Login screen. I think my permissions are correct for the temp folder. I don't know what else to look for, any suggestions greatly appreciated.

Share this post


Link to post
Share on other sites

Hello,

 

As mentioned above and I also appreciate the responses, but I am getting the following error, and I understand that it means a mismatch. It is trying to insert into products_groups three fields.

 

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

 

INSERT INTO products_groups VALUES ( 0, 0.0000, 3 )

 

----------------------

My database structure for products_groups is below.

 

| customers_group_id

| customers_group_price

| products_id

| products_price1

| products_price2

| products_price3

| products_price4

| products_price5

| products_price6

| products_price7

| products_price8

| products_price1_qty

| products_price2_qty

| products_price3_qty

| products_price4_qty

| products_price5_qty

| products_price6_qty

| products_price7_qty

| products_price8_qty

| products_qty_blocks

 

------------------------------------------

EP uses the below to insert into the database. How do I change it so it will only insert into the three fields, customers_group_id, customers_group_price, and products_id. Normally you would do INSERT INTO products_groups (f1,f2,f3) VALUES ( 0, 0.0000, 3 ); where f1, f2, f3 are any of the 3 fields: But I do not know how to change the EP file. Any help would be great appreciated.

 

INSERT INTO

'.TABLE_PRODUCTS_GROUPS.'

VALUES

(

' . $v_customer_group_id_1 . ',

' . $v_customer_price_1 . ',

' . $v_products_id . '

)'

);

 

 

Thanks JR

Share this post


Link to post
Share on other sites

Hello,

 

On the above mentioned, I have diagnosed it to here:

 

My customer groups are as of follow:

0 = Retail

1 = Dealer

2 = Distributor

 

But when EP downloads the fields for customer groups are off. I get, Group id's are not matching? I think when this is resolved, the 1136 error will be fixed.

 

v_customer_price_1 v_customer_group_id_1 v_customer_price_2 v_customer_group_id_2 v_customer_price_3 v_customer_group_id_3

0 0 400 1 300 2

0 0 400 1 300 2

 

Thanks JR

Share this post


Link to post
Share on other sites
OK, I gave you the wrong function. go with this instead if you have quotes in your manufacturer or cateogry data.

looks like the product data is already handled.

 

find:

 

		$sql = "SELECT man.manufacturers_id
		  FROM ".TABLE_MANUFACTURERS." as man
		  WHERE
			  man.manufacturers_name = '" . $v_manufacturers_name . "'";

 

replace with

 

		$sql = "SELECT man.manufacturers_id
		  FROM ".TABLE_MANUFACTURERS." as man
		  WHERE
			  man.manufacturers_name = '" . tep_db_input($v_manufacturers_name) . "'";

 

find:

 

			$sql = "INSERT INTO ".TABLE_MANUFACTURERS."(
			  manufacturers_id,
			  manufacturers_name,
			  manufacturers_image,
			  date_added,
			  last_modified
			  ) VALUES (
			  $max_mfg_id,
			  '$v_manufacturers_name',
			  '".EP_DEFAULT_IMAGE_MANUFACTURER."',
			  '".date("Y-m-d H:i:s")."',
			  '".date("Y-m-d H:i:s")."'
			  )";

 

replace with:

 

			$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")."'
			  )";

 

round about lines: 2190 & 2225

 

and in case you have single quotes in category names:

 

find:

 

				$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 = ".EP_DEFAULT_LANGUAGE_ID." AND
					cat.parent_id = " . $theparent_id . " AND
					des.categories_name = '" . $thiscategoryname . "'";

replace with:

 

				$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 = ".EP_DEFAULT_LANGUAGE_ID." AND
					cat.parent_id = " . $theparent_id . " AND
					des.categories_name = '" . tep_db_input($thiscategoryname) . "'";

 

find:

							$sql = "INSERT INTO ".TABLE_CATEGORIES_DESCRIPTION."(
									categories_id,
									language_id,
									categories_name
								) VALUES (
									$max_category_id,
									'".EP_DEFAULT_LANGUAGE_ID."',
									'$thiscategoryname'
								)";

 

replace with:

 

							$sql = "INSERT INTO ".TABLE_CATEGORIES_DESCRIPTION."(
									categories_id,
									language_id,
									categories_name
								) VALUES (
									$max_category_id,
									'".EP_DEFAULT_LANGUAGE_ID."',
									'".tep_db_input($thiscategoryname)."'
								)";

 

Hi, I have been trying to get Easy Populate to import my data correctly, and am having the same problem this person did. I made the changes at outlined above, but I'm still having the first character of my data dropped when I import. The data I'm importing is a little different, however, in that it has single and double quotes in the title (as in this: Kainui Team Leash - 6' x 1/4"). Can anybody provide any thoughts to resolving this? Also, I have this in my product names which is also causing the problem...

 

Thanks,

Janet

Share this post


Link to post
Share on other sites

I set up everything the way the installation instructions said to, using the Easy Populate 2.76f-MS2 (with attributes) contribution, but when I tell it to download the file, it doesn't do anything. Any ideas what may be happening?

Share this post


Link to post
Share on other sites

I need some help using easypolulate to import products into my OSC shop.

 

My manufacturer provided me with a datafeed. The field names are different and their categories tree also different from my OSC shop. Here is what I need easypopulate to do: I need to have this as a cron job and update the datafeed automatic. I have the URL to the manufacturer datafeed and it's update every day. So that mean I will need to put some custom code in easypopulate.php file to achieve this which this is where I need the help with.

 

1. The datafeed provided has a field call min_price (this is the price I can't go below). I prob need to write an IF statement (IF min_price NOT NULL UPDATE prodducts_price ELSE do not update) or something like this.

 

2. Manufacturer categories tree; I need to convert or change the name of each categories and sub-categories from the manufacturer datafeed over to my shop categories and sub-categories name. Something like: Video = Photos (both mine and manufacturer categories have 3 levels)

 

Please if someone that can help me write a custom code for easypopulate to do what I just listed above, I'd appreciated very much. If this topic has been posted before, please point me to the right place as I've been searching this topic and can't seem to find the answer.

Share this post


Link to post
Share on other sites
Hello,

 

I've added a code patch, that now enables removal of product attributes linked to a product. You can download the new code here.

 

Currently working on testing and improving language support. I'd be glad if anyone could help me test this code. You can email me at - vj (at) vjdom (dot) com. Remember, this is experimental code, and you'd need a dev store setup give it a try.

 

VJ

 

 

VJ,

I'm setting up a shoe store of 500 models, i'm jus wondering if this contribution will help us populate faster in to our website, also is this the version of EP that we should use.

 

thanks for any info.

 

HenryM

Share this post


Link to post
Share on other sites

Hi guys!

 

I'm having some little problems with this conttrib and I was wondering if you can please help me. This is the error I get:

 

File uploaded. 
Temporary filename: /tmp/phpTanYMl
User filename: EP2008Jan20-0606.csv
Size: 1429
| Inspiron 1 | Dell Inspi | Specificat | | | | | Dell Inspi | Specificat | | | | | ins1300.jp | 1680.67 | 5 | 3.5 | 0000-00-00 | 1/20/2008 | Dell | Laptop - N | | Laptop - N | | | | | | | | | | Laptop - N | | incl TVA | Active Updated
Updated
1054 - Unknown column 'products_head_title_tag' in 'field list'

UPDATE products_description SET products_name='Dell Inspiron 1300', products_description='Specificatiile vin aici

Dedesubt, cu tot ce trebuie.', products_head_title_tag = '', products_head_desc_tag = '', products_head_keywords_tag = '', products_url='' WHERE products_id = '567' AND language_id = '4' LIMIT 1

[TEP STOP]


Sorry for my bad english language!

Share this post


Link to post
Share on other sites

Hey everybody,

i also have a problem with this great contribution. But first lets help lao:

You should install this also very great contrib called "header Tags Controller".

If you don't want to do this, just look in your easypopulate.php vor

define ('EP_HTC_SUPPORT', true);

and set it to false....

 

My Problem with the version 2.76f-MS2 r1 is this part of code:

// $EXPORT_TIME=time();  // start export time when export is started.
$EXPORT_TIME = strftime('%Y%b%d-%H%I');
if ($dltype == 'froogle'){
	$EXPORT_TIME = "FroogleEP" . $EXPORT_TIME;
} else {
	$EXPORT_TIME = "EP" . $EXPORT_TIME;
...

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

It just doesn't work on my website, instead of getting a froogle file, I always get a normal file called EP...txt and with the ending EOREOR...

I'm running php version 5.1.2 with MySQL 5.0.18 and the osCommerce Online Merchant v2.2 RC1.

I hope, somebody can help me with this...

 

Tommy

Share this post


Link to post
Share on other sites

Hello,

 

I am using a version of EP2.76f with SPPC and Ultra Images. The problem I am having is I a getting a column mismatch for v_customer_price and v_customer_group_id?? Where in the EP file to I fix the colum layout?

 

columns.jpg

 

 

Thanks JR

Share this post


Link to post
Share on other sites
Hello,

 

I am using a version of EP2.76f with SPPC and Ultra Images. The problem I am having is I a getting a column mismatch for v_customer_price and v_customer_group_id?? Where in the EP file to I fix the colum layout?

 

columns.jpg

Thanks JR

 

Hi:

 

Easypopulate.php

 

// 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 - v_customer_group_id and v_customer_price must occur in pairs</font>";

die();

}

 

golfpros - Aug 8 2003, 10:00 PM Post #30

Michael Gilliam

http://forums.oscommerce.com/index.php?sho...32993&st=20

… So I replaced the isset function (which seems to be saying I have data in the $v_customer_price_1 field ) with the following inequality:

 

if ($v_customer_price_1 !=''){

 

Try:

if (($v_customer_group_id_1 != '') AND ($v_customer_price_1 != '')) {

 

Check your sql fields to match - I would also check the SPPC contribution

Share this post


Link to post
Share on other sites

Hello JRVS,

 

Thank you as always for the reply. I will check. Be aware I will probably be back HA!.

 

Thanks JR

Share this post


Link to post
Share on other sites
Hey everybody,

i also have a problem with this great contribution. But first lets help lao:

You should install this also very great contrib called "header Tags Controller".

If you don't want to do this, just look in your easypopulate.php vor

define ('EP_HTC_SUPPORT', true);

and set it to false...

 

Thank you much. It really worked.

 

Now I have a new little annoying thing. If I want to remove a product from my store and I just delete it from the .csv file, isn't it supposed to delete it? For example:

 

If I have 3 laptops in my store, created by the .csv file in the proper categories. After that, if I want to remove one of the laptops and I upload the .csv file with only 2 laptops, isn't it supposed to delete the other one?


Sorry for my bad english language!

Share this post


Link to post
Share on other sites

Hey jrvs,

 

Thank you for the post and I looked at it. For right now, the issue is not on the import. On the image that I posted above, this is the EP output file and for some reason it is mismatching the output customer_price and customer_group wrong. They are one cell to the right? Under customer_group_id_1 should have "1" under it and not ")".

 

Thanks JR

Share this post


Link to post
Share on other sites

upps, I found the solution for my problem in this forum:

$dltype=$_REQUEST['dltype'];

 

Hello,

 

I am using a version of EP2.76f with SPPC and Ultra Images. The problem I am having is I a getting a column mismatch for v_customer_price and v_customer_group_id?? Where in the EP file to I fix the colum layout?

 

columns.jpg

Thanks JR

 

I don't see a mismatch in your columns. They are like they are. SPPC start counting from 0, EP starts from one. Maybe you can change

	if (EP_SPPC_SUPPORT == true) { 
  $ep_additional_layout_pricing .= '$filelayout[\'v_customer_price_1\'] = $iii++;
									$filelayout[\'v_customer_group_id_1\'] = $iii++;
									$filelayout[\'v_customer_price_2\'] = $iii++;
									$filelayout[\'v_customer_group_id_2\'] = $iii++;
									$filelayout[\'v_customer_price_3\'] = $iii++;
									$filelayout[\'v_customer_group_id_3\'] = $iii++;
									$filelayout[\'v_customer_price_4\'] = $iii++;
									$filelayout[\'v_customer_group_id_4\'] = $iii++;
									';
}

to

   if (EP_SPPC_SUPPORT == true) { 
  $ep_additional_layout_pricing .= '$filelayout[\'v_customer_price_0\'] = $iii++;
									$filelayout[\'v_customer_group_id_0\'] = $iii++;
									$filelayout[\'v_customer_price_1\'] = $iii++;
									$filelayout[\'v_customer_group_id_1\'] = $iii++;
									$filelayout[\'v_customer_price_2\'] = $iii++;
									$filelayout[\'v_customer_group_id_2\'] = $iii++;
									$filelayout[\'v_customer_price_3\'] = $iii++;
									$filelayout[\'v_customer_group_id_3\'] = $iii++;
									$filelayout[\'v_customer_price_4\'] = $iii++;
									$filelayout[\'v_customer_group_id_4\'] = $iii++;
									';
}

 

Tommy

Share this post


Link to post
Share on other sites

Hello Tommy,

 

Well I am stuck, in my database customers_groups are this,

 

customers_group_id customers_groups_name

0 Retail

1 Dealers

2 Distributors

 

And in the image, under customers_price_2 is 400.00, this is actual retail. The 400.00 should be under customers_price_0?? Or not even pulled since customers_price_0 = Retail and is in the product price table?? Also just for chance I removed,

$filelayout[\'v_customer_price_1\'] = $iii++;

$filelayout[\'v_customer_group_id_1\'] = $iii++;

 

and it imported without the 1136 mismatch error, but when I changed the prices just for test, and none of the fields updated even though it showed updated on the import?

 

Thanks JR

Share this post


Link to post
Share on other sites

Hey Tommy,

 

To help better understand I added some images. This image is from a site I have without the Quantity Discount contribution, and it works fine. Customer_price_1 and customer_group_id_1 shows $300.00 which represents dealer pricing. Retail pricing is from products pricing table.

 

0 Retail

1 Dealers

2 Distributors

columns2.jpg

 

This image represents a site which I have the quantity discounts contribution installed, using same EP file, but association is wrong. Customer_price_1 and customer_group_id_1 is getting a "0", not sure where it is pulling that number. Also $300.00 is down in customer_price_3 where it should be in customer_price_1 column???

columns.jpg

 

Thanks JR

Share this post


Link to post
Share on other sites

can any one help?

 

i was able to fownload the database and i made some changes in excel but when i followed the steps to udate data base it will give me this message after inserto database.

Filename: EP2008Jan21-1212f2.csv

| 6924 | Jordan 1 | Product Id | | | | | Jordan 1 | Product Id | | | | | jordan1-1 | 70.0467 | 50 | 5 | 1/30/2008 | 1/16/2008 | 2 | Size | Talla | 1 | 7 | 7 | 0 | | | 3 | 8 | 8 | 0 | | | 4 | 8.5 | 8.5 | 0 | | | 5 | 9 | 9 | 0 | | | 6 | 9.5 | 9.5 | 0 | | | 7 | 10 | 10 | 0 | | | 8 | 10.5 | 10.5 | 0 | | | 9 | 11 | 11 | 0 | | | 10 | 11.5 | 11.5 | 0 | | | 13 | 12 | 12 | 0 | | | 14 | 13 | 13 | 0 | | | NIKE | Jordan 1 | | | | | | | | | | | | | | Taxable Go | Active Updated

1054 - Unknown column 'products_head_title_tag' in 'field list'

 

UPDATE products_description SET products_name='Jordan 1', products_description='Product Id 6924', products_head_title_tag = '', products_head_desc_tag = '', products_head_keywords_tag = '', products_url='' WHERE products_id = '53' AND language_id = '1' LIMIT 1

 

[TEP STOP]

 

 

then i will check to se if anything chage on my store but non of the chages i made were there. Is there something i'm missing?

 

thanks the help

 

Henry

Share this post


Link to post
Share on other sites

Hello Henry,

 

This means that you are missing a field in the database. It is trying to insert data into the "products_head_title_tag" which does not exist. You need to add this field in the products_description table. Do you use a control panel to edit your database?

 

JR

Share this post


Link to post
Share on other sites
Hello Henry,

 

This means that you are missing a field in the database. It is trying to insert data into the "products_head_title_tag" which does not exist. You need to add this field in the products_description table. Do you use a control panel to edit your database?

 

JR

 

 

yes i do

Share this post


Link to post
Share on other sites

Hello,

 

If you goto that database, and view the table products_description, you will not see a field in there called products_head_title_tag. You can create this field very easy with the panel.

 

JR

Share this post


Link to post
Share on other sites
Hello,

 

If you goto that database, and view the table products_description, you will not see a field in there called products_head_title_tag. You can create this field very easy with the panel.

 

JR

 

 

JR,

 

thanks for the info, don't want to mesup the DB coudl give me some info as to what i need to do in od=rder to get this field in the DB. I'm using PHP MyAdmin i never done anything on this side of database any help will be really appreciated.

 

thanks

 

Henry

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

×