Learn Easy Populate in a Weekend

Easy Populate Advanced

Understanding Easy Populate Advanced

Easy Populate Advanced is a product content management system for adding, editing, and deleting existing products. It is a robust php script capable of handling many modifications to suit any oscommerce based shopping cart needs. It can be set-up to run as cron/schedule job, modified to take input from database instead of a text file, it can be modified to include product extra fields from the product table or from another tables; the list goes on and on. In fact it is the specific needs of an e-commerce site and capability shop owner/programmer that determines or limit what Easy Populate script can do.

* Easy Populate Advanced file name must have EPA prefix. Examples of proper file names are EPAxyz.txt, EPAXYY.txt and EPA_xyz.txt.

* Every row must end with EOROER and there must not be any other text or character after EOREOR column on each row.

* Product model (v_products_model) string length/number of characters must be less than or equal to 25. This is the predefine value in epconfigure.php ($modelsize = 25). If you need to have more than 25 characters change this value to say 50 ($modelsize = 50). Then you can either access you database directly and run ALTER TABLE `products` CHANGE `products_model` `products_model` VARCHAR( 50 ) or add this line to your easypopulate_import.php below include statements at the top; tep_db_query(“ALTER TABLE `products` CHANGE `products_model` `products_model` VARCHAR( 60 )”).

* The default file delimiter is tab.

* Header fields with the name of each column your want to import must be the first row that is v_products_id, v_products_model, …, v_status, v_action, EOREOR

* Unwanted columns can be deleted. For example v_products_image_sm_1, v_products_image_xl_1, v_products_url_1, v_date_avail, v_date_added can be deleted if they are not needed.

* v_status field for setting active and inactive products

* File split

* The default no of categories is 4 (v_categories_name_1, … ,v_categories_name_4), to have more categories, increase $max_categories from 4 to say 7 in epconfigure.php. Then add more columns to your EPA file to reflect the change. In case the $max_categories is now 7 then the EPA files should have (v_categories_name_1, v_categories_name_2, … ,v_categories_name_6, v_categories_name_7).

* The temp folder within the main install must be writteble. You can use a folder other than the temp folder ut your have to specifiy the name of your new folder in the configuration file.

* Multi language support.

Using Easy Populate Advanced to add product

To add new product value of the v_products_id must be 0; this is a required field, do not leave it blank or empty. In case you are sure you have unique product id, you can use your predefined product id.

Using Easy Populate Advanced to delete product

Use v_action column to delete products. Each row must have delete (all lower case)

Using Easy Populate Advanced to edit product

Using Easy Populate Advanced to manage product attributtes

Using Easy Populate Advanced with extra fields in product table

Using Easy Populate Advanced with extra fields in another table

 

Easy Populate Basic

Understanding Easy Populate Basic

Using Easy Populate Basic to add product

To add new product value of the v_products_model must be supplied and it must be unique; this is a required field, do not leave it blank or empty.

Using Easy Populate Basic to delete product

Using Easy Populate Basic to edit product

Using Easy Populate Basic to manage product attributtes

Using Easy Populate Basic with extra fields in product table

Using Easy Populate Basic with extra fields in another table

Add Attributes Options to Easy Populate Advanced/Basic

Following the clue from here, I put the attribute option back in 6.2 patch 10. Same method works on newer version.

Please note that line numbers are approximate.

1. Export

Applies to admin/easypopulate_export.php

1.1 Uncomment attribute option drop down in line 846

1.2 Around line 370 change


$attribute_options_query = "select distinct products_options_id from " . TABLE_PRODUCTS_OPTIONS . " where products_options_name = '" . $value . "'";

to


$attribute_options_query="select distinct po.products_options_id from products_options po, products_options_text pot where pot.products_options_name= '".$value."' and po.products_options_id=pot.products_options_text_id"; $attribute_options_query="select distinct po.products_options_id from products_options po, products_options_text pot where pot.products_options_name= '".$value."' and po.products_options_id=pot.products_options_text_id";

1.3 Make exactly the same change to around line 385

1.4 Around line 643

change


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

to


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

2. Import

Applies to admin/easypopulate_import.php

2.1 Around line 1182, change


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

to

$attribute_options_query = "select products_options_name from " . TABLE_PRODUCTS_OPTIONS_TEXT . " where products_options_text_id = '" . (int)$$v_attribute_options_id_var . "'";

2.2 Around line 1196, change


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

to

$attribute_options_insert_query = "insert into " . TABLE_PRODUCTS_OPTIONS_TEXT . " (products_options_text_id, language_id, products_options_name) values ('" . (int)$$v_attribute_options_id_var . "', '" . (int)$lid . "', '" . $$v_attribute_options_name_var . "')";

2.3 Around line 1208, change


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

to

$attribute_options_update_lang_query = "select products_options_name from " . TABLE_PRODUCTS_OPTIONS_TEXT . " where products_options_text_id = '" . (int)$$v_attribute_options_id_var . "' and language_id ='" . (int)$lid . "'";

2.4 Around line 1214, change


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

to

$attribute_options_lang_insert_query = "select products_options_name from " . TABLE_PRODUCTS_OPTIONS_TEXT . " where products_options_text_id = '" . (int)$$v_attribute_options_id_var . "' and language_id ='" . (int)$lid . "'";

2.5 Around line 1218, change


$attribute_options_update_query = "update " . TABLE_PRODUCTS_OPTIONS . " set products_options_name = '" . $$v_attribute_options_name_var . "' where products_options_id ='" . (int)$$v_attribute_options_id_var . "' and language_id = '" . (int)$lid . "'";

to

$attribute_options_update_query = "update " . TABLE_PRODUCTS_OPTIONS_TEXT . " set products_options_name = '" . $$v_attribute_options_name_var . "' where products_options_text_id ='" . (int)$$v_attribute_options_id_var . "' and language_id = '" . (int)$lid . "'";

3.0 epconfigure

3.1 set $products_with_attributes = true;

3.2 $attribute_options_select = array(‘Size’, ‘Model’); // uncomment and fill with product options name you wish to download use $attribute_options_select = ”; if you wish to download all product options

Please BACK UP your files before any change…

Easy Populate Advanced (EPA) – Blank Page

I recently came across this problem; may be it’s not really a problem but it is something worth noting. While importing an EPA file, EPA import will just hang up and display a blank screen. I noticed that the EPA file is actually imported but only up to some point, the first 78 rows to be specific. This implies the code broke on row 79. I didn’t understand the problem immediately because I compared row 78 with row 79; both look similar to me. After a while I decided to remove row 79 and re-import again. To my surprise everything worked fine! Later, after extensive research on the culprit row 79, I finally realized that the problem was due to:

v_products_model

The specified length is 25 characters, but in my offending row, the length was 26. So for this particular row to be imported, I had to alter the number of characters in my products model number to be 25 or less.

If you really need more than 25 characters for product model; go to epconfigure.php (located in admin folder), change:

$modelsize = 25;

to a number of your choice then go to your products table and change

products_model

to the same number.

Which Easy Populate is good for me? Easy Populate Basic (EPB) or Easy Populate Advanced (EPA)?

It is important to know that CRE Loaded EPB is in many respect similar to osC Easy Populate. In EPB product uniqueness is based on ‘product model.’ If you are using osCommerce, the only option you have is pretty much the Easy Populate, this is the contribution you have to install. On the other hand if you are using CRE Loaded, you have to wander at some point which one you have to use. This is what I recommend:
* if products on your site are going to be the same over time then go for EPA
* if products on your site are going to be different from time to time, then go for EPB
* if you are using data feed with schedule tasks to load your products them EPB will be a good option to consider
* there may be situations where things have to be done differently, I encouraged store administrators to think about this before investing too much time on a particular EP.
* Lastly if you are using or going to use SEO URL, you need to factor this into your considerations at the beginning, you don’t want to lose all those pages that search engines have indexed for your site. Talking about SEO URL, Ultimate SEO URLs, is a good one to use because it works well with the google xml site map generator.