Deleted. Hadn't seen previous reply.
Printable View
Deleted. Hadn't seen previous reply.
I'm going to try to reproduce this situation using a similar mySQL server version. I believe I came across it and that is why my development code went back to restore the code in this area. Specifically I have this:There are two things reported here. One, by the text at the beginning of this message, it looks like yes inserting a new category doesn't establish a parent/child relationship which causes the duplicate entry (child being inserted as if it is the parent also. The value 515 represents the category_id value that already exists but is attempted to be used again. The second issue is in relation to not having a tax_class_id for the given tax class title, this is a different issue than previously reported. I have a fix for this second one, but no idea the state of the code on your system because it seems things change so quickly and possibly drastically.For this second issue, I have the following in my development site at what is reported above as line 407 in admin/includes/functions/extra_functions/easypopulate_4_functions.php:instead of:Code:// get next available categoies_id (though could replace the last deleted category id..// $sql = "SHOW TABLE STATUS LIKE '" . TABLE_CATEGORIES . "'"; $sql = "SELECT MAX(categories_id) + 1 max FROM " . TABLE_CATEGORIES; $result = ep_4_query($sql); unset($sql); $row = $ep_4_fetch_array($result); unset($result);// $max_category_id = $row['Auto_increment']; $max_category_id = $row['max']; // if database is empty, start at 1 if (!isset($max_category_id) || !is_numeric($max_category_id) || $max_category_id == 0) { $max_category_id = 1; }
modify it to:Code:$tax_class_id = $tax_class_array['tax_class_id'];
Yes, it is this adding new category aspect that is to be corrected and is causing problems.Basically, a different method was attempted which is intended to use the categories table auto number field to support inserting the next set of data. The problem is though that until some other action occurs, that number is held while operations continue. I had changed the process so that the next number to be used would have come from the highest value the database had seen which would also increase on each insert. The problem is that the auto_number doesn't increase while still within the same "run". The alternative "original" method looks for the highest value currently used and adds one. This is a problem because if a category exists in the database and it is the current highest value and that gets deleted (purposefully), pulling the highest value plus one results in a number that was previously used instead of the next unused number.Would be nice to know what these "some" errors are so that can either show what is to be done to correct or develop something new.I'm near issuing a new version that has A LOT of changes, improvements and compatibility with ZC 1.5.8x to not need any changes to that code. I have to do some testing though before I feel comfortable even offering it to others to do some testing. One of the things I am last working on is code that ensures default table values are retrieved and of the applicable database type and gets handled through the rest of the php code in the expected converted data type.Code:$tax_class_id = !empty($tax_class_array['tax_class_id']) ? $tax_class_array['tax_class_id'] : 0;
Well, unfortunately when I posted my previous message with a code block, all of the code got squished into a single line instead of broken out to rows and then when I went to edit the post all I have is a blank text box to "edit".
The first code block should look like:
Code:} else { // otherwise add new category
// get next available categoies_id (though could replace the last deleted category id..
// $sql = "SHOW TABLE STATUS LIKE '" . TABLE_CATEGORIES . "'";
$sql = "SELECT MAX(categories_id) + 1 max FROM " . TABLE_CATEGORIES;
$result = ep_4_query($sql);
unset($sql);
$row = $ep_4_fetch_array($result);
unset($result);
// $max_category_id = $row['Auto_increment'];
$max_category_id = $row['max'];
// if database is empty, start at 1
if (!isset($max_category_id) || !is_numeric($max_category_id) || $max_category_id == 0) {
$max_category_id = 1;
}
// TABLE_CATEGORIES has 1 entry per categories_id
$sql = "INSERT INTO " . TABLE_CATEGORIES . "(categories_id, categories_image, parent_id, sort_order, date_added, last_modified
Just putting it out there. I've posted on github an update to this module. I haven't made it the master code yet as I would appreciate some feedback on its use before committing it as the next release.
Generally, the software has been put together to work with the zc_plugins directory, though some limitations of Zen Cart's implementation of that process have required a usual some tricks to be incorporated into installation.
I haven't yet seen what I might consider good instruction for this possibility, but the code can be installed in the same places as it usually is or it can be placed in a version folder.
There are some limitations and issues that might occur if both are done on the one site. May not be an issue now, but may be in the future.
Anyways, I may still add a little to the github branch, but in my testing, neither of the previous main two issues exist.
Branch link to version 4.0.39.ZC: https://github.com/mc12345678/EasyPo...ree/v4.0.39.ZC
Tested on zencart 1.5.8a with latest github updates applied and php 8.3.
I just wanted to reach out as I saw that you had some updates on the easy populate plug-in. Initially we had fixed this issue by downgrading our MySQL to I believe my SQL to 5.7 which fixed all the issues with the creation of new categories and data input but now our server got automatically updated to the new version of MySQL again which I believe was a forced update as no one on our end made any changes.
Unfortunately I am back to square one on this. The link you provided for the newest version does it fix these issues?
Thank you for your time.
Sorry for the delay in responding. Yes, that issue is expected to be resolved with the root of the problem further discussed here: Duplicate entry when trying to add product with two level category neither existing · Issue #67 · mc12345678/EasyPopulate-4.0 (github.com)
Ok, so root of the problem may be how I had modified the code; however, that was based on conversations from several years ago. Thought was that the database record of what the next record was supposed to be would remain up-to-date. True if that value isn't cached... Newer versions of mySql cache the value making it unreliable during a database access. On the next query it gets updated.
dear EP4, I met some problem when i populate our product.
EP4+ZC1.5.8a
firstly, I exported CVS via "Filterable Exports" function.
then I edited my new product in this CVS file.
leave the same value on column "v_categories_name_1", it's not blank
then I got the error:No category provided for this new product.
attachment is my EP4 setting and circumstance, cvs file.
Attachment 20456
Attachment 20457
Attachment 20458
who can help me ?
In fact, I'm having trouble understanding the operating logic of ep4:
When I upload a new product, but its v_products_model already exists, after performing the upload, it is treated as an old product, and the upload action is regarded as a modification to the old product.
If you change the record's v_categories_name_1, it will generate a copy of the old product under the new category.
I think there should be a column to mark that this record is for uploading a new product, rather than modifying an old product.
Or is it possible that the CSV I'm using to upload new products is incorrect in the first place? I got it from the Filterable Exports of ep4.
Thank you, I would greatly appreciate it if someone could help me solve this problem with uploading new products.
If using the version downloaded from the zen cart site, then please read back over any of the recent pages of this thread about how to resolve the missing category issue.
Regarding the linking of product described for using a single product model to describe two or more different product, may I suggest reading the instructions about using the products id instead of the products model as the primary key.
If you have downloaded the version referenced about two posts ago, then please identify the history of versions on the server. The version recently posted about should not initially have the problem described about a missing category. Unfortunately, as the version on the zen cart site appears to have been installed, upgrading to the above version will still have it. To correct one the new above version is installed, remove or uninstall the database settings and then reinstall the plugin to apply the correct default settings. Otherwise follow the guidance discussed on nearly every page of this thread for several, several pages back.