Quote Originally Posted by amirshawn80 View Post
Hi,

I just installed the latest version of ep 4.0. I have a bunch of custom product fields, most are in the products table except for the second description which is in the description table. I had the old easy populate working for inputting the data and I'd like to get that working with the new EP, I saw the post on page 5, but I didn't really understand. I was wondering if you could explain in more detail how to add extra fields. Thank you for your help.
OK here's how I did it - my example shows the field I wanted to add (products_family), obviously yours will be different :)

There are three files to edit:
YOUR-ADMIN-FOLDER/includes/functions/extra_functions/easypopulate_4_functions.php
YOUR-ADMIN-FOLDER/easypopulate_4.php
and YOUR-ADMIN-FOLDER/easypopulate_4_import.php

You're using the existing 'upc' field each time to create a new product field.

Firstly open YOUR-ADMIN-FOLDER/includes/functions/extra_functions/easypopulate_4_functions.php. Search for

if ($ep_supported_mods['upc'] == true) { // UPC Mod
$filelayout[] = 'v_products_upc';
}

Now make a copy of this code directly underneath and change this to

if ($ep_supported_mods['family'] == true) { // Products Family Mod
$filelayout[] = 'v_products_family';
}

so you now have

if ($ep_supported_mods['upc'] == true) { // UPC Mod
$filelayout[] = 'v_products_upc';
}
if ($ep_supported_mods['family'] == true) { // Products Family Mod
$filelayout[] = 'v_products_family';
}

Now find the following a few lines further down:

if ($ep_supported_mods['upc'] == true) { // UPC Code mod
$filelayout_sql .= 'p.products_upc as v_products_upc,';
}

Copy this chunk of code and change as before, so you now have:

if ($ep_supported_mods['upc'] == true) { // UPC Code mod
$filelayout_sql .= 'p.products_upc as v_products_upc,';
}
if ($ep_supported_mods['family'] == true) { // Products Family mod
$filelayout_sql .= 'p.products_family as v_products_family,';
}

Now open YOUR-ADMIN-FOLDER/easypopulate_4.php and search for 'upc' again - around line 90

$ep_supported_mods['upc'] = ep_4_check_table_column(TABLE_PRODUCTS,'products_upc'); // upc = UPC Code, added by Chadd

Make a copy so you now have

$ep_supported_mods['upc'] = ep_4_check_table_column(TABLE_PRODUCTS,'products_upc'); // upc = UPC Code, added by Chadd
$ep_supported_mods['family'] = ep_4_check_table_column(TABLE_PRODUCTS,'products_family'); // Products Family

Finally open YOUR-ADMIN-FOLDER/easypopulate_4_import.php and search for 'upc' again, there are four edits to make here, here's what mine looks like with the 'family' fields added (the line numbers may be slightly out)

Line 26:
if ($ep_supported_mods['upc'] == true) { // UPC Code mod - chadd
$default_these[] = 'v_products_upc';
}
if ($ep_supported_mods['family'] == true) { // UPC Code mod - chadd
$default_these[] = 'v_products_family';
}


Line 150:
if ($ep_supported_mods['upc'] == true) { // UPC Code mod- chadd
$sql .= 'p.products_upc as v_products_upc,';
}
if ($ep_supported_mods['family'] == true) { // products_family
$sql .= 'p.products_family as v_products_family,';
}

Line 594:
if ($ep_supported_mods['upc'] == true) { // UPC Code mod
$query .= "products_upc = '".addslashes($v_products_upc)."',";
}
if ($ep_supported_mods['family'] == true) { // products_family
$query .= "products_family = '".addslashes($v_products_family)."',";
}

Line 660:
if ($ep_supported_mods['upc'] == true) { // UPC Code mod
$query .= "products_upc = '".addslashes($v_products_upc)."',";
}
if ($ep_supported_mods['family'] == true) { // family
$query .= "products_family = '".addslashes($v_products_family)."',";
}


Hope this helps - this should work for the fields in the products table, but it might need a bit of tweaking for the field you have in the description table (not sure myself as I haven't tried it)