OK, I have found away around the master/slave create problem with easypopulate.
My post above describes the problem "the invisible products_id".
What I want is to be able to set the products_id from the easypopulate file so that I know what it is and can use the master ones in the slave rows for the products_master_id column.
My Solution.
Modify easypopulate.php to export and import products_id. If products_id is omitted in the import file then use the mysql autoincrement value. One little gotch to watch for is if the first field in an easypopulate import file is empty all the other fields are shifted left. To overcome this, I drop the products_id field in second after the products_model field. This doesn't cause any problem because the script reads these fields into variables and then uses the variable in the right order for the database inserts.
In the code below my line numbers will vary somewhat from yours because I am using quantity price breaks plus my own added attribute fields in the products table. So if you substract 10-20 lines cumulatively for each modificaton before my quoted lines you should get close to the place for the modification.
At line 210 after 'v_categories_id', insert a new line with;
'v_products_id',
At lines 917, 1064, 1110 and 1237 insert after
'v_products_model' => $iii++,
a new line with;
'v_products_id' => $iii++,
At line 1757 modify;
$sql = "SHOW TABLE STATUS LIKE '".TABLE_PRODUCTS."'";
$result = tep_db_query($sql);
$row = tep_db_fetch_array($result);
$max_product_id = $row['Auto_increment'];
if (!is_numeric($max_product_id) ){
$max_product_id=1;
}
$v_products_id = $max_product_id;
with the if block wrapper below;
//now we check if the product_id has been set in the uploaded file
if ($v_products_id == "") {
$sql = "SHOW TABLE STATUS LIKE '".TABLE_PRODUCTS."'";
$result = tep_db_query($sql);
$row = tep_db_fetch_array($result);
$max_product_id = $row['Auto_increment'];
if (!is_numeric($max_product_id) ){
$max_product_id=1;
}
$v_products_id = $max_product_id;
}
At line 1770 modify the INSERT statement from;
$query = "INSERT INTO ".TABLE_PRODUCTS." (
products_image,
to;
$query = "INSERT INTO ".TABLE_PRODUCTS." (
products_id,
products_image,
Finally at line 1799 modiy;
VALUES ( '$v_products_image',";
to;
VALUES ( '$v_products_id', '$v_products_image',";
Now you can control your products_id's while using easypopulate!!! :D
Kerry.