Clean install 1.54 of most recent EasyPopulate 1.2.6.1 released Oct 21, 2015 results in this error:
PHP Fatal error: 1062uplicate entry '1-1' for key 'PRIMARY' :: INSERT INTO products_description SET
out of the box.
I'm working on the fix.
Clean install 1.54 of most recent EasyPopulate 1.2.6.1 released Oct 21, 2015 results in this error:
PHP Fatal error: 1062uplicate entry '1-1' for key 'PRIMARY' :: INSERT INTO products_description SET
out of the box.
I'm working on the fix.
Twitch.
https://www.twitchtoo.com Do you work for free? Please donate.
Twitch Base8 - Obsidian - This, is what's new.
Problem...
The original code here is saying, if you find products_description - INSERT INTO the database if not UPDATE the database. This assumes that it's a new product and attempts to insert the same data into the same fields with the INSERT INTO command.
Solution...
Switch the INSERT INTO code with the UPDATE code and if it finds a match it will UPDATE the data, if not it assumes it's a new product and INSERT INTO the database.
In admin/easypopulate.php replace this line 1954 - 2046 :
with this:PHP Code:
//*************************
// Products Descriptions Start
//*************************
// the following is common in both the updating an existing product and creating a new product
if (isset($v_products_name)){
foreach( $v_products_name as $key => $name){
if ($name != ''){
$ep_supported_mods_sql = "";
if ($ep_supported_mods['psd'] == true) {
$ep_supported_mods_sql = " products_short_desc = '".zen_db_input($v_products_short_desc[$key])."', ";
}
$sql = "SELECT * FROM ".TABLE_PRODUCTS_DESCRIPTION." WHERE products_id = $v_products_id AND language_id = " . $key . " LIMIT 1 ";
$result = $db->Execute($sql);
if( $result->RecordCount() > 0 ){
// new product description
//$result = ep_query($sql);
$sql ="INSERT INTO ".TABLE_PRODUCTS_DESCRIPTION." SET
products_id = '".$v_products_id."',
language_id = '".$key."',
products_name = '".zen_db_input($name)."',
products_description = '".zen_db_input($v_products_description[$key])."',
".$ep_supported_mods_sql."
products_url = '".zen_db_input($v_products_url[$key])."'
";
// langer - the following is redundant - one SQL string is now contructed with various optional mods
// support for Linda's Header Controller 2.0
if (isset($v_products_head_title_tag)){
// override the sql if we're using Linda's contrib
$sql =
"INSERT INTO ".TABLE_PRODUCTS_DESCRIPTION."
(products_id,
language_id,
products_name,
products_description,
products_url,
products_head_title_tag,
products_head_desc_tag,
products_head_keywords_tag)
VALUES (
'" . $v_products_id . "',
" . $key . ",
'" . zen_db_input($name) . "',
'" . zen_db_input($v_products_description[$key]) . "',
'". $v_products_url[$key] . "',
'". $v_products_head_title_tag[$key] . "',
'". $v_products_head_desc_tag[$key] . "',
'". $v_products_head_keywords_tag[$key] . "')";
}
// end support for Linda's Header Controller 2.0
//echo 'New product desc:'.$sql.'<br />';
$result = $db->Execute($sql);
} else {
// already in the description, let's just update it
$sql ="UPDATE ".TABLE_PRODUCTS_DESCRIPTION." SET
products_name = '".zen_db_input($name)."',
products_description = '".zen_db_input($v_products_description[$key])."',
".$ep_supported_mods_sql."
products_url = '".zen_db_input($v_products_url[$key])."'
WHERE products_id = '$v_products_id' AND language_id = '$key'";
// langer - below is redundant.
// support for Lindas Header Controller 2.0
if (isset($v_products_head_title_tag)){
// override the sql if we're using Linda's contrib
$sql =
"UPDATE ".TABLE_PRODUCTS_DESCRIPTION." SET
products_name='" . zen_db_input($name) . "',
products_description = '" . zen_db_input($v_products_description[$key]) . "',
products_url = '" . $v_products_url[$key] ."',
products_head_title_tag = '" . $v_products_head_title_tag[$key] ."',
products_head_desc_tag = '" . $v_products_head_desc_tag[$key] ."',
products_head_keywords_tag = '" . $v_products_head_keywords_tag[$key] ."'
WHERE
products_id = '$v_products_id' AND
language_id = '$key'";
}
// end support for Linda's Header Controller 2.0
//echo 'existing product desc:'.$sql.'<br />';
$result = $db->Execute($sql);
}
}
}
}
//*************************
// Products Descriptions End
//*************************
I have tested this by manipulating the .csv file imported as well as making changes from the admin to break it, so far no errors!PHP Code:
//*************************
// Products Descriptions Start
//*************************
// the following is common in both the updating an existing product and creating a new product
if (isset($v_products_name)){
foreach( $v_products_name as $key => $name){
if ($name != ''){
$ep_supported_mods_sql = "";
if ($ep_supported_mods['psd'] == true) {
$ep_supported_mods_sql = " products_short_desc = '".zen_db_input($v_products_short_desc[$key])."', ";
}
$sql = "SELECT * FROM ".TABLE_PRODUCTS_DESCRIPTION." WHERE products_id = $v_products_id AND language_id = " . $key . " LIMIT 1 ";
$result = $db->Execute($sql);
if( $result->RecordCount() > 0 ){
//Twitch fix - match products and update - else - product is new so add new product.
// already in the description, let's just update it
$sql ="UPDATE ".TABLE_PRODUCTS_DESCRIPTION." SET
products_name = '".zen_db_input($name)."',
products_description = '".zen_db_input($v_products_description[$key])."',
".$ep_supported_mods_sql."
products_url = '".zen_db_input($v_products_url[$key])."'
WHERE products_id = '$v_products_id' AND language_id = '$key'";
// langer - below is redundant.
// support for Lindas Header Controller 2.0
if (isset($v_products_head_title_tag)){
// override the sql if we're using Linda's contrib
$sql =
"UPDATE ".TABLE_PRODUCTS_DESCRIPTION." SET
products_name='" . zen_db_input($name) . "',
products_description = '" . zen_db_input($v_products_description[$key]) . "',
products_url = '" . $v_products_url[$key] ."',
products_head_title_tag = '" . $v_products_head_title_tag[$key] ."',
products_head_desc_tag = '" . $v_products_head_desc_tag[$key] ."',
products_head_keywords_tag = '" . $v_products_head_keywords_tag[$key] ."'
WHERE
products_id = '$v_products_id' AND
language_id = '$key'";
}
// end support for Linda's Header Controller 2.0
//echo 'existing product desc:'.$sql.'<br />';
$result = $db->Execute($sql);
} else {
// new product description
//$result = ep_query($sql);
$sql ="INSERT INTO ".TABLE_PRODUCTS_DESCRIPTION." SET
products_id = '".$v_products_id."',
language_id = '".$key."',
products_name = '".zen_db_input($name)."',
products_description = '".zen_db_input($v_products_description[$key])."',
".$ep_supported_mods_sql."
products_url = '".zen_db_input($v_products_url[$key])."'
";
// langer - the following is redundant - one SQL string is now contructed with various optional mods
// support for Linda's Header Controller 2.0
if (isset($v_products_head_title_tag)){
// override the sql if we're using Linda's contrib
$sql =
"INSERT INTO ".TABLE_PRODUCTS_DESCRIPTION."
(products_id,
language_id,
products_name,
products_description,
products_url,
products_head_title_tag,
products_head_desc_tag,
products_head_keywords_tag)
VALUES (
'" . $v_products_id . "',
" . $key . ",
'" . zen_db_input($name) . "',
'" . zen_db_input($v_products_description[$key]) . "',
'". $v_products_url[$key] . "',
'". $v_products_head_title_tag[$key] . "',
'". $v_products_head_desc_tag[$key] . "',
'". $v_products_head_keywords_tag[$key] . "')";
}
// end support for Linda's Header Controller 2.0
//echo 'New product desc:'.$sql.'<br />';
$result = $db->Execute($sql);
}
}
}
}
//*************************
// Products Descriptions End
//*************************
Test Conditions:
- existing product
- new product
- update existing product
- remove product
Note: From what I could see EP doesn't delete or manage products that have been removed from the database essentially it does not perform a 'sync' only import and export.
Twitch.
https://www.twitchtoo.com Do you work for free? Please donate.
Twitch Base8 - Obsidian - This, is what's new.
Hi, Can I use this EP to get products from a 1.3.9h store and populate to a 1.5 store?
It's likely easier to export and upgrade your old site to the new one properly. <-- That works every time.
That being said, if you were to export the fields of 1.39 using a compatible version for 1.39 then import the file into 1.54 using the newest compatible version for 1.54... there is no reason it wouldn't work.
Now, this assumes something simple like products to products transfer. If you have a loaded up 1.39 with modules and custom coding... you'll need to match that to some degree in 1.54.
Or contact someone that knows how to do ^ named Twitch ;-)
Twitch.
https://www.twitchtoo.com Do you work for free? Please donate.
Twitch Base8 - Obsidian - This, is what's new.
I believe this error is a php upgrade without gd extension. You can remove this error by simply deleting out of tempep the filelist and index
This will remove the cute list at bottom of screen of old iuploads but I am not sure what value that list had to begin with.
Hope this helps as I just got this yesterday and it was due to server/php upgrade. This applies to any ep using these files as the original ep was built a long long time ago.
Obviously you could install that extension to get it to list the files on there but I don't believe gd is bundled anymore thus the issue will repeat itself
Hi,
How do we bulk import a list of manufacturer using easy populate? What specific field names are needed in the file? Thank you.
Hi All,
I just upgraded to 1.5X and went to reinstall this plug in. When i did I got this error at the top of the screen. How do i correct?
Warning Easy Populate uploads folder not found!
NIX SERVERS: Your uploads folder is either missing, or you have altered the name and/or directory of your uploads folder without configuring this in Easy Populate.
WINDOWS SERVERS: Please request your web host to assign write permissions to the uploads folder. This is usually granted through Windows server user account IUSR_COMPUTERNAME.
Your configuration indicates that your uploads folder is named temp/, and is located in XXXXXXXXXXXXX, however this cannot be found.
Easy Populate cannot upload files until you have provided an uploads folder with read/write/execute permissions for the site owner (usually chmod 700 but you may require chmod 777
Forums are for helping people!! if you don't want to help people then shut up and get off the forum!
Twitch.
https://www.twitchtoo.com Do you work for free? Please donate.
Twitch Base8 - Obsidian - This, is what's new.
Bookmarks