Jump to content
VJ

Easy Populate & Products Attributes

Recommended Posts

I also have now found the error logs and they are full of this:-

 

[sat Nov 29 16:35:28 2008] [error] [client 80.52.142.170] File does not exist: /domains/s/p/sportsgolfstores.co.uk/public_html/images/categories/10_00.jpg

 

I have no folder images/categories/ so don't know what this is.

 

I also have No product options with the ID of 0

 

Cheers

Share this post


Link to post
Share on other sites

I tried to solve my problem with the contribution "Category description" myself. With my small PHP and MySql knowledge I had some success, so that there remains only one bug in my code, when I am importing the csv data. Exporting works fine.

 

To the following passage I added the code of the next codebox in order to let EP import the variables "categories_heading_title" and "categories_description". But now I receive the sql error:

 

1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ' '2',

 

INSERT INTO categories_description ( categories_id, language_id, categories_description ) VALUES ( , '2', '

 

Hier befinden sich Drucker!

Von HP über Canon bis Epson!' )

 

May somebody help me to solve this last error. It is the last obstacle to really start our shop.

 

Thanks! Daniel

 

            // 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 = " . $lang['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;
                           }
                           $query = "UPDATE ".TABLE_CATEGORIES."
                                     SET 
                                       categories_image='".tep_db_input($v_categories_image[$categorylevel])."', 
                                       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
                   }
			 // }
               }
           }

 

Adding the contribution:

 

			// Begin: Adding contribution "Category Description" (Changes by Daniel K.)
		// adding categories_heading_title (begin)
           // if the categories heading titles are set then try to update them
		foreach ($languages as $key => $lang){
		  $baselang_id = $lang['id'];
		  break;
		}
           if ( isset( $filelayout['v_categories_heading_title_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){
                   $thiscategoryheading_title = $v_categories_heading_title[$categorylevel][$baselang_id];
                   if ( $thiscategoryheading_title != ''){
                       // we found a category heading title 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 = " . $lang['id'] . " AND
                               cat.parent_id = " . $theparent_id . " AND
                               des.categories_heading_title like '" . tep_db_input($thiscategoryheading_title) . "'";
                       $result = tep_db_query($sql);
                       $row =  tep_db_fetch_array($result);

					if ( $row == '') {
                           // to add, we need to put stuff in categories and categories_description
                           foreach ($languages as $key => $lang){
                               $sql = "INSERT INTO ".TABLE_CATEGORIES_DESCRIPTION." (
                                               categories_id,
                                               language_id,
											categories_heading_title
                                      ) VALUES (
                                               $max_category_id,
                                               '".$lang['id']."',
											'".(!empty($v_categories_heading_title[$categorylevel][$lang['id']])?tep_db_input($v_categories_heading_title[$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
                   }
			 // }
               }
           }

		// adding categories_description (begin)
           // if the categories description are set then try to update them
		foreach ($languages as $key => $lang){
		  $baselang_id = $lang['id'];
		  break;
		}
           if ( isset( $filelayout['v_categories_description_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){
                   $thiscategorydescription = $v_categories_description[$categorylevel][$baselang_id];
                   if ( $thiscategorydescription != ''){
                       // we found a category description 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 = " . $lang['id'] . " AND
                               cat.parent_id = " . $theparent_id . " AND
                               des.categories_description like '" . tep_db_input($thiscategorydescription) . "'";
                       $result = tep_db_query($sql);
                       $row =  tep_db_fetch_array($result);

					if ($row == '') {
                           // to add, we need to put stuff in categories and categories_description
                           foreach ($languages as $key => $lang){
                               $sql = "INSERT INTO ".TABLE_CATEGORIES_DESCRIPTION." (
                                               categories_id,
                                               language_id,
											categories_description
                                      ) VALUES (
                                               $max_category_id,
                                               '".$lang['id']."',
											'".(!empty($v_categories_description[$categorylevel][$lang['id']])?tep_db_input($v_categories_description[$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
                   }
			 // }
               }
           }
           // End: Adding contribution "Category Description"

 

The complete easypopulate.php, you will find here

Share this post


Link to post
Share on other sites
all is fine except that I have no attributes. If this is set to true I get the following message:-

 

Internal Server Error, this is an error with your script, check your error log for more information

I'm not sure if you are saying there are no attributes in your shop, or you can't get the attributes to download.

 

Internal Server Errors are hard to diagnose since it could be pointing to any number of problems.

 

How many products are in the shop? Are there lots of attributes being used?

 

in your configure.php, is your database configured as "localhost" or is the database server remote, that is, the server is an address?

 

Have you tried to download a small portion of your products using the category or manufacturer filter?

Share this post


Link to post
Share on other sites
I tried to solve my problem with the contribution "Category description" myself. With my small PHP and MySql knowledge I had some success, so that there remains only one bug in my code, when I am importing the csv data. Exporting works fine.

 

To the following passage I added the code of the next codebox in order to let EP import the variables "categories_heading_title" and "categories_description". But now I receive the sql error:

 

1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near ' '2',

 

INSERT INTO categories_description ( categories_id, language_id, categories_description ) VALUES ( , '2', '

 

Hier befinden sich Drucker!

Von HP über Canon bis Epson!' )

 

May somebody help me to solve this last error. It is the last obstacle to really start our shop.

wow, you sure did go the long way around.

I believe the issue you are having that you are using $max_category_id in your insert statement. You should be using $thiscategoryid. The $max_category_id variable is only set when creating new categories.

Share this post


Link to post
Share on other sites
I'm not sure if you are saying there are no attributes in your shop, or you can't get the attributes to download.

 

Internal Server Errors are hard to diagnose since it could be pointing to any number of problems.

 

How many products are in the shop? Are there lots of attributes being used?

 

in your configure.php, is your database configured as "localhost" or is the database server remote, that is, the server is an address?

 

Have you tried to download a small portion of your products using the category or manufacturer filter?

There are attributes in the shop, I just can't make a download of the store if I try a complete download or one with attributes selected, I I just try to download the attributes it fails.

 

There are quite a few products, I've just noticed that some don't appear to have model numbers (it's not my store!), would this be the possible cause?

 

The database is configured as 'localhost'

 

Thanks

 

Mark

Share this post


Link to post
Share on other sites

Have you tried to download a small portion of your products using the category or manufacturer filter?

Share this post


Link to post
Share on other sites

Has anyone ever modded easypopulate to update the specials prices for products and if so how do you do it. If not is there people that would find this useful, maybe we could think about adding this to the contribution if its possible??

 

The reason i ask is because i use specials by category to apply a blanket discount to all products based on the manufacturer which is great but when new products are added the discount isn't applied automatically and so the discount has to be applied to all products by that manufacturer again to apply it to the new product or products.

 

If it was possible to add a discount percentage to the easypopulate line or even just the special price i think that'd be really useful. Also for people who only use specials and not specials by category it could be an extremely useful tool


Scott

Share this post


Link to post
Share on other sites
Yes with no problem, it's just the attributes that won't download, even if I try them on their own.

so are you telling me that when you download a small subset of your products (with attributes turned on), that the attributes will not download. You get all the rest of the info, but no attributes? I don't see how this could be possible though.

 

you should ask your host if they allow you to increase the amount memory your site can use for SQL queries. That might help.

Share this post


Link to post
Share on other sites
Has anyone ever modded easypopulate to update the specials prices for products and if so how do you do it. If not is there people that would find this useful, maybe we could think about adding this to the contribution if its possible??

you are not the first to ask about it. But no, not currently available.

Share this post


Link to post
Share on other sites

I have asked them to do this, let's see what happens, I have also discovered if I do a store backup and then try to restore it I get the following message "Internal Server Error, this is an error with your script, check your error log for more information" if this has any relevance.

 

Thanks

Share this post


Link to post
Share on other sites

I have just installed the latest Easy Populate and seemed to follow all instructs but get this..

 

Any help please?

 

Thanks

 

oz

 

1054 - Unknown column 'p.products_subimage1' in 'field list'

SELECT p.products_id as v_products_id, p.products_model as v_products_model, p.products_image as v_products_image, 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, p.products_price as v_products_price, p.products_weight as v_products_weight, p.products_date_available as v_date_avail, p.products_date_added as v_date_added, p.products_tax_class_id as v_tax_class_id, p.products_quantity as v_products_quantity, p.manufacturers_id as v_manufacturers_id, subc.categories_id as v_categories_id, p.products_status as v_status FROM products as p, categories as subc, products_to_categories as ptoc WHERE p.products_id = ptoc.products_id AND ptoc.categories_id = subc.categories_id

<p>

EP vers: 2.76g-MS2

osCommerce 2.2-MS2

OS: Linux 2.4.21-52.ELsmp

HTTP: Apache/2.2.8 (Unix) mod_ssl/2.2.8 OpenSSL/0.9.8g DAV/2 mod_auth_passthrough/2.1 mod_bwlimited/1.4 FrontPage/5.0.2.2635 mod_jk/1.2.25

DB: MySQL 5.0.67-community

PHP: 5.2.6 (Zend: 2.2.0)

 

Temp Directory:

/home/autovisi/public_html/temp/

Temp Dir is Writable

Magic Quotes is: off

register_globals is: on

Split files on: 300 records

Model Num Size: 12

Price with tax: false

Calc Precision: 2

Replace quotes: false

Field seperator: tab

Excel safe output: false

Preserve tab/cr/lf: false

Category depth: 3

Enable attributes: true

SEF Froogle URLS: false

More Pics: true

Unknown Pics: false

HTC: true

SPPC: false

Extra Fields: true

Edited by ozstar

Share this post


Link to post
Share on other sites

Turn the More Pics support to false. Those additional contributions support options require the contributions to be fully installed.

Edited by surfalot

Share this post


Link to post
Share on other sites

My website: http://nextlevelracing.net/catalog/

 

The problem I am having is this. When I upload new products using Easy Populate the What's New Here never updates. I want to be able to make this update everytime I load a new file. I have uploaded more .csv files since the tires, but have not had any luck getting that to change. Any help would be appreciated.

Share this post


Link to post
Share on other sites

The documentation says:-

 

'v_date_avail'

 

When the product will become available. Defaults to today if left blank.

 

 

'v_date_added'

 

When the product will be reported as being added to the database. Defaults to today if left blank.

 

Are you setting the date added on all your products to the same date by say reloading all your products to reflect new stock levels from a file that includes a 'v_date_added' column?

 

Have a look at the data in your products table to see what is being set in there.

 

G


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

Share this post


Link to post
Share on other sites
The problem I am having is this. When I upload new products using Easy Populate the What's New Here never updates. I want to be able to make this update everytime I load a new file. I have uploaded more .csv files since the tires, but have not had any luck getting that to change. Any help would be appreciated.

EP is probably already doing what you want. if you want to see what product have the newest date added, you need to view this page http://nextlevelracing.net/catalog/products_new.php.

 

I would ask your programmer what is actually being displayed on that section of your site since it doesn't appear to me to be the newest added/updated products.

Share this post


Link to post
Share on other sites

Thank you for the help..

 

Found it.. in easypopulate.php file

 

Thanks again

 

oz

Edited by ozstar

Share this post


Link to post
Share on other sites

Hi guys,

great contrib btw. I apologize in advance if this has been answered as sifting through 360+ pages is alot and the search didnt come up with anything. I need some help importing a csv file. I have it importing fine on my local machine using phpmyadmin but on a live site it doesnt import. It uploads to the temp folder fine and displays only the following:

 

File uploaded.

Temporary filename: /tmp/phpTms2E2

User filename: feed_test_1.csv

Size: 1032183

 

as you can see this file is just short of a Mb in size. If I cut the file to about 400kb it works fine but is missing half the data. Also splitting the file is not an option. Any suggestions please. Thanks in advanced.

 

EP vers: 2.76g-MS2

osCommerce Online Merchant v2.2 RC2a

OS: Linux 2.6.18-6-686

HTTP: Apache/2.2.3 (Debian) PHP/5.2.0-8+etch10 mod_ssl/2.2.3 OpenSSL/0.9.8c mod_jk/1.2.15

DB: MySQL 5.0.32-Debian_7etch5-log

PHP: 5.2.0-8+etch10 (Zend: 2.2.0)

 

Temp Directory:

/var/www/web25/web/temp/

Temp Dir is Writable

Magic Quotes is: off

register_globals is: off

Split files on: 300 records

Model Num Size: 100

Price with tax: true

Calc Precision: 2

Replace quotes: false

Field seperator: comma

Excel safe output: true

Preserve tab/cr/lf: false

Category depth: 7

Enable attributes: true

SEF Froogle URLS: false

More Pics: false

Unknown Pics: false

HTC: false

SPPC: false

Extra Fields: false

Edited by glycerine

Share this post


Link to post
Share on other sites

Extract from the documentation:-

 

5. You should check with your host to find out what the maximum upload size

for your PHP environment is. Then you need to find out the length of time

the script is allowed to run. Then you know the key details that will allow

you to configure your EP, or your host environment, or limit your data, to

perform the upload. Both of those items can be changed by uploading a php.ini

to your admin directory if your host allows that. Ask your host.

See this post about maximum file size uploads for PHP:

http://forums.oscommerce.com/index.php?sho...p;#entry1101458

 

HTH

 

G


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

Share this post


Link to post
Share on other sites

Thank you for the reply

 

The current upload is well above the size of the file,

 

Also the below data is set in my php.ini

 

max_execution_time = 300

max_input_time = 300

Share this post


Link to post
Share on other sites

hi,

 

I am using ep 2.76-MS2

 

When I first installed it, I modified it to take 3-level of categories in easypopulate.php as follows"

 

'v_categories_name_1' => $iii++,

'v_categories_name_2' => $iii++,

'v_categories_name_3' => $iii++,

 

It works fine.

 

Then I had some items needed to be categorized to 5-level.

 

I then added those two additional lines as follows:

'v_categories_name_1' => $iii++,

'v_categories_name_2' => $iii++,

'v_categories_name_3' => $iii++,

'v_categories_name_4' => $iii++,

'v_categories_name_5' => $iii++,

 

 

Questions: do I need to modify any lines in the easypopulate.php or other files ,database?

Or do I have to declare any number to be "5"? to make it right?

 

 

 

TIA

Share this post


Link to post
Share on other sites

hi, i have this csv :

the ful catalog contain over 40.000 product. the column is:

 

CATEGORY;SUBCAT;SUBCAT;PRODUCT COD;MANUFACTER;NAME;DESCRIPTION;PRICE WITH DISCOUNT;PRICE OF DELIVERY;PRICE WITHOUT DISCOUNT;LINK IMG;AVAIBILITY;WEIGHT;WEYGHT/VOLUME

 

now, i ask you if is possible modify easy populate to import directly this csv, with no cut e paste in the EP export file..

 

can you help me??

Share this post


Link to post
Share on other sites
hi, i have this csv :

the ful catalog contain over 40.000 product. the column is:

 

CATEGORY;SUBCAT;SUBCAT;PRODUCT COD;MANUFACTER;NAME;DESCRIPTION;PRICE WITH DISCOUNT;PRICE OF DELIVERY;PRICE WITHOUT DISCOUNT;LINK IMG;AVAIBILITY;WEIGHT;WEYGHT/VOLUME

 

now, i ask you if is possible modify easy populate to import directly this csv, with no cut e paste in the EP export file..

 

can you help me??

 

Anything is possible, but I have found modifying easypopulate to be more difficult than average. All you have to do is rename the header row in your csv file. If the file does not have a header row then you will have to add one. It's not too hard to create a php script that can do the renaming for you. Or you can create a simple excel macro to do it for you if you use excel. The macro can simply be created by using the macro recorder and making the changes by hand.

Share this post


Link to post
Share on other sites
hi,

 

I am using ep 2.76-MS2

 

 

I do not see an easypopulate 2.76-MS2 available. Are you sure it's not something like 2.76g-MS2?

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

×