Not to be smart, but if you export your products list you'll have your own personal sample file... (Covered in instructions on how to use and learn to use the program)
Printable View
I humbly can not answer the question of "which is easier" as I have not used the other version in a great deal of time if at all... I think I came across the issues that have not been addressed in that version and then when seeing what features were available in this one I made my decsion and as you can see do things to keep it afloat and fnd ways to make improvements (though really little has been needed to accomplish that because of the work put nto it.)
But if not mistaken the other version doesn't support attributes, so I've heard. If a rumor, please disspell it... On the topic of attributes through the need of someone else and their permission some functionality was added to work with SBA (primarily as reworked by potteryhouse.)
So hopefully the regular users of the program will chime in as they are the ones deal with it (or the other) routinely.
Below is the code described above that I have prepared... I keep looking at it to ensure that each possibility is addressed and while I see that some conditions seem to be over described, I didn't want to eliminate the potential code needed to address the possibility of that condition. Would appreciate any operational testing feedback.. I've set up some tests that seem to have worked but could use some independent verification.
So beginning in EP4 version 4.0.29 the following code begins at line 1508. The code begins at other locations for earlier versions but until now has remained relatively consistent code.
I chose the number 7 to be non-adjacent to the number 9, but I also am concerned that for those using a number pad without looking at the pad that they may incorrectly enter 9 instead of 7; however, also hope that the difference in shape (sharp corners (7) versus rounded (9) or what is likely to be a majority (1 or 0) will stand out a little..) Could use a two+ digit status indicator or maybe a "word", but I'm going with what I got at the moment.Quote:
The expectation of the below code is that if the status of a product is set to 7 (instead of the typical 0 to disable, 1 to enable, or 9 to delete), then the category of that row will become the master category for that item and the product will be removed from the previous master category. With the appropriate series of applicable add and move database entries a product's linked categories can be stripped, the master category revised to the desired category.
Find:
And replace with:Code:
//==================================================================================================================================
// Assign product to category if linked
// chadd - need to dig into further
if (isset($v_categories_id)) { // find out if this product is listed in the category given
$result_incategory = ep_4_query('SELECT
'.TABLE_PRODUCTS_TO_CATEGORIES.'.products_id,
'.TABLE_PRODUCTS_TO_CATEGORIES.'.categories_id
FROM
'.TABLE_PRODUCTS_TO_CATEGORIES.'
WHERE
'.TABLE_PRODUCTS_TO_CATEGORIES.'.products_id='.$v_products_id.' AND
'.TABLE_PRODUCTS_TO_CATEGORIES.'.categories_id='.$v_categories_id);
if (($ep_uses_mysqli ? mysqli_num_rows($result_incategory) : mysql_num_rows($result_incategory)) == 0) { // nope, this is a new category for this product
$res1 = ep_4_query('INSERT INTO '.TABLE_PRODUCTS_TO_CATEGORIES.' (products_id, categories_id)
VALUES ("'.$v_products_id.'", "'.$v_categories_id.'")');
if ($res1) {
zen_record_admin_activity('Product ' . (int)$v_products_id . ' copied as link to category ' . (int)$v_categories_id . ' via EP4.', 'info');
}
} else { // already in this category, nothing to do!
}
}
//==================================================================================================================================
This is expected to be included in the upcoming 4.0.31 code...Code://==================================================================================================================================
// Assign product to category if linked
// chadd - need to dig into further
if (isset($v_categories_id)) { // find out if this product is listed in the category given
$result_incategory = ep_4_query('SELECT
'.TABLE_PRODUCTS_TO_CATEGORIES.'.products_id,
'.TABLE_PRODUCTS_TO_CATEGORIES.'.categories_id,
'.TABLE_PRODUCTS.'.master_categories_id
FROM
'.TABLE_PRODUCTS.'
LEFT JOIN
'.TABLE_PRODUCTS_TO_CATEGORIES.' ON ('.TABLE_PRODUCTS.'.products_id = '.TABLE_PRODUCTS_TO_CATEGORIES.'.products_id AND '.TABLE_PRODUCTS_TO_CATEGORIES.'.categories_id='.$v_categories_id.')
WHERE
'.TABLE_PRODUCTS.'.products_id='.$v_products_id);
$result_incategory = ($ep_uses_mysqli ? mysqli_fetch_array($result_incategory) : mysql_fetch_array($result_incategory));
if (!zen_not_null($result_incategory['products_id']) || sizeof($result_incategory) <= 0 /* ($ep_uses_mysqli ? mysqli_num_rows($result_incategory) : mysql_num_rows($result_incategory)) == 0 */) { // nope, this is a new category for this product
if ($items[$filelayout['v_status']] == 7) {
/* $result_incategory = ep_4_query('SELECT
'.TABLE_PRODUCTS.'.master_categories_id
FROM
'.TABLE_PRODUCTS.'
WHERE
'.TABLE_PRODUCTS.'.products_id='.$v_products_id);
$result_incategory = ($ep_uses_mysqli ? mysqli_fetch_array($result_incategory) : mysql_fetch_array($result_incategory)); */
//do category move action.
// if the master_categories_id != categories_id, then for "safety" sake, should successfully insert the product to the category before deleting it from the previous category. Should also verify that the master_categories_id is set, because if it is not then there is a bigger issue. As part of the verification, if it is not set, then don't try to delete the previous, just add it and provide equivalent information.
if ((int) $result_incategory['master_categories_id'] != (int) $v_categories_id) {
//move is eminent
if ($result_incategory['master_categories_id'] > 0) {
//master_category is assigned to the product do the move.
// Ensure the product still is on the way to the move and available.
$res1 = ep_4_query('INSERT INTO ' . TABLE_PRODUCTS_TO_CATEGORIES . ' (products_id, categories_id)
VALUES (' . $v_products_id . ', ' . $v_categories_id . ')');
if ($res1) {
//Successfully inserted the product to the category, now need to remove the link from the previous category.
$res1 = ep_4_query('UPDATE ' . TABLE_PRODUCTS . ' set master_categories_id = ' . $v_categories_id . '
WHERE products_id = ' . $v_products_id);
$res2 = ep_4_query('DELETE FROM ' . TABLE_PRODUCTS_TO_CATEGORIES . ' WHERE products_id = ' . $v_products_id . ' AND categories_id =
' . $result_incategory['master_categories_id']);
if ($res1 && $res2) {
zen_record_admin_activity('Product ' . (int) $v_products_id . ' moved to category ' . (int) $v_categories_id . ' via EP4.', 'info');
} else if ($res1 && !$res2) {
zen_record_admin_activity('Product ' . (int) $v_products_id . ' master_categories_id changed to category ' . (int) $v_categories_id . ' via EP4.', 'info');
} else if (!$res1 && $res2) {
zen_record_admin_activity('Product ' . (int) $v_products_id . ' deleted from category ' . (int) $result_incategory['master_categories_id'] . ' and added to category ' . (int) $v_categories_id . ' via EP4.', 'info');
} else if (!$res1 && !$res2) {
zen_record_admin_activity('Product ' . (int) $v_products_id . ' copied as link to category ' . (int) $v_categories_id . ' via EP4.', 'info');
}
}
} /* EOF Master Category is set */ else {
//master_category is not assigned, assign the category to the master category and do the move.
$res1 = ep_4_query('INSERT INTO ' . TABLE_PRODUCTS_TO_CATEGORIES . ' (products_id, categories_id)
VALUES (' . $v_products_id . ', ' . $v_categories_id . ')');
if ($res1) {
//Successfully inserted the product to the category, now need to remove the link from the previous category.
$res1 = ep_4_query('UPDATE ' . TABLE_PRODUCTS . ' set master_categories_id = ' . $v_categories_id . '
WHERE products_id = ' . $v_products_id);
if ($res1) {
zen_record_admin_activity('Product ' . (int) $v_products_id . ' moved to category ' . (int) $v_categories_id . ' via EP4.', 'info');
} else {
zen_record_admin_activity('Product ' . (int) $v_products_id . ' copied as link to category ' . (int) $v_categories_id . ' via EP4.', 'info');
}
}
} // EOF Master category is not defined.
} // End if master and category different, nothing else to do as no where to go because both are the same...
} /* EOF status == Move */ else {
$res1 = ep_4_query('INSERT INTO ' . TABLE_PRODUCTS_TO_CATEGORIES . ' (products_id, categories_id)
VALUES (' . $v_products_id . ', ' . $v_categories_id . ')');
if ($res1) {
zen_record_admin_activity('Product ' . (int) $v_products_id . ' copied as link to category ' . (int) $v_categories_id . ' via EP4.', 'info');
}
} // Don't move the product
} else { // already in this category, nothing to do! // Though may need to do the move action so there is still possibly something to do...
if ($items[$filelayout['v_status']] == 7) {
// $result_incategory = ($ep_uses_mysqli ? mysqli_fetch_array($result_incategory) : mysql_fetch_array($result_incategory));
//do category move action.
// if the master_categories_id != categories_id, then for "safety" sake, should successfully insert the product to the category before deleting it from the previous category. Should also verify that the master_categories_id is set, because if it is not then there is a bigger issue. As part of the verification, if it is not set, then don't try to delete the previous, just add it and provide equivalent information.
if ($result_incategory['master_categories_id'] != $result_incategory['categories_id']) {
//move is eminent
if ($result_incategory['master_categories_id'] > 0) {
//master_category is assigned to the product complete the move.
// Ensure the product still is on the way to the move and available.
// $res1 = ep_4_query('INSERT INTO '.TABLE_PRODUCTS_TO_CATEGORIES.' (products_id, categories_id)
// VALUES ("'.$v_products_id.'", "'.$v_categories_id.'")');
$res1 = ep_4_query('UPDATE ' . TABLE_PRODUCTS . ' set master_categories_id = ' . $v_categories_id . '
WHERE products_id = ' . $v_products_id);
/* if ($res1) */
//Successfully updated the product to the category, now need to remove the link from the previous category.
$res2 = ep_4_query('DELETE FROM ' . TABLE_PRODUCTS_TO_CATEGORIES . ' WHERE products_id = ' . $v_products_id . ' AND categories_id =
' . $result_incategory['master_categories_id']);
if ($res1 && $res2) {
zen_record_admin_activity('Product ' . (int) $v_products_id . ' moved from category ' . (int)$result_incategory['master_categories_id'] . ' to category ' . (int) $v_categories_id . ' via EP4.', 'info');
} else if ($res1 && !$res2) {
zen_record_admin_activity('Product ' . (int) $v_products_id . ' master_categories_id changed from category ' . (int)$result_incategory['master_categories_id'] . ' to category ' . (int) $v_categories_id . ' via EP4.', 'info');
} else if (!$res1 && $res2) {
zen_record_admin_activity('Product ' . (int) $v_products_id . ' deleted from category ' . (int) $result_incategory['master_categories_id'] . ' and added to category ' . (int) $v_categories_id . ' via EP4.', 'info');
}
} else {
//master_category is not assigned, assign the category to the master category and do the move.
// $res1 = ep_4_query('INSERT INTO '.TABLE_PRODUCTS_TO_CATEGORIES.' (products_id, categories_id)
// VALUES ("'.$v_products_id.'", "'.$v_categories_id.'")');
//Successfully inserted the product to the category, now need to remove the link from the previous category.
$res1 = ep_4_query('UPDATE ' . TABLE_PRODUCTS . ' set master_categories_id = ' . $v_categories_id . '
WHERE products_id = ' . $v_products_id);
if ($res1) {
zen_record_admin_activity('Product ' . (int) $v_products_id . ' master_categories_id established as category ' . (int) $v_categories_id . ' via EP4.', 'info');
}
}
} // End if master and category different, nothing else to do as no where to go because both are the same...
//continue;
}
}
}
//==================================================================================================================================
Sorry forgot to mention the file: admin/easypopulate_4_import.php beginning at line 1508.
is there an Easy Populate for ZC1.54 that works?
thanks
Yes, ep4
Instructions to obtain the generally accepted version are provided in post 1 of this thread. A new version has been uploaded to test at an alternate forked location, details to follow while verifying all changes/improvements have been properly identified.
Thanks for responses. I'll give it another try today
If you have any difficulty installing/operating it please post details so that the issue can be duplicated and corrected... Depending on what is being seen/how the store is setup the latest version posted may correct your issue if you have had problems with this version of EP which by the statement above seems to be the case. Anyways, please post if was successfully installed or if not details of possibly reproducing the issue.