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

More on easy populate and easy populate help

Bookmark and Share

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…

More on easy populate and easy populate help

Bookmark and Share