Skip to content

Commit

Permalink
v4.0.34 update for priceqty import.
Browse files Browse the repository at this point in the history
During an import of a priceqty file, it was identified that
there was a sql error if none of the fields in the
products_description section were included in the import file.
  • Loading branch information
mc12345678 committed Mar 22, 2016
1 parent 57e9c67 commit 697a974
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
25 changes: 18 additions & 7 deletions admin/easypopulate_4_import.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?php
// $Id: easypopulate_4_import.php, v4.0.33 02-29-2016 mc12345678 $
// $Id: easypopulate_4_import.php, v4.0.34 03-21-2016 mc12345678 $

if (!defined('IS_ADMIN_FLAG')) {
die('Illegal Access');
Expand Down Expand Up @@ -1919,7 +1919,13 @@
// the following is common in both the updating an existing product and creating a new product // mc12345678 updated to allow omission of v_products_description in the import file.
$add_products_description_data = false;
$zco_notifier->notify('EP4_IMPORT_FILE_PRODUCTS_DESCRIPTION_ADD_OR_CHANGE_DATA');
if (isset($v_products_name) || isset($v_products_description) || ($ep_supported_mods['psd'] == true && isset($v_products_short_desc) ) || isset($v_products_url) || $add_products_description_data) { //
if ((isset($v_products_name) && is_array($v_products_name)) || (isset($v_products_description) && is_array
($v_products_description)) ||
($ep_supported_mods['psd'] == true
&&
isset
($v_products_short_desc) ) || (isset($v_products_url) && is_array($v_products_url)) ||
$add_products_description_data) { //
// Effectively need a way to step through all language options, this section to be "accepted" if there is something to be updated. Prefer the ability to verify update need without having to loop on anything, but just by "presence" of information.
foreach ($langcode as $lang) {
// foreach ($v_products_name as $key => $name) { // Decouple the dependency on the products_name being imported to update the products_name, description, short description and/or URL. //mc12345678 2015-Dec-12
Expand Down Expand Up @@ -1987,7 +1993,8 @@
$sql .= ($update_count ? ", " : "") . " products_url = :v_products_url: ";
$update_count = true;
}

// If using this notifier to add to the $sql, the when something is added be sure to
// set $update_count = true;
$zco_notifier->notify('EP4_IMPORT_FILE_PRODUCTS_DESCRIPTION_UPDATE_FIELDS_VALUES');

$sql .= " WHERE products_id = :v_products_id: AND language_id = :language_id:";
Expand All @@ -2003,10 +2010,14 @@
$sql = $db->bindVars($sql, ':language_id:', $lang_id, 'integer');
$zco_notifier->notify('EP4_IMPORT_FILE_PRODUCTS_DESCRIPTION_FIELDS_BIND_END');

$result = ep_4_query($sql);
if ($result) {
zen_record_admin_activity('Updated product ' . (int) $v_products_id . ' description via EP4.', 'info');
}
// Be sure to run the update query only if there has been something provded to
// update.
if ($update_count == true) {
$result = ep_4_query($sql);
if ($result) {
zen_record_admin_activity('Updated product ' . (int)$v_products_id . ' description via EP4.', 'info');
}
} // Perform query if there is something to update.
} // END: already in description, update it
} // END: foreach on languages
} // END: Products Descriptions End
Expand Down
3 changes: 3 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -283,3 +283,6 @@
https://www.zen-cart.com/downloads.php?do=file&id=2069
4.0.34 03/19/2016 After report of an issue with EP4.0.33 being used on ZC 1.5.5, a change was made to how paths are
generated for admin side related code.
On import of priceqty files, the absence of language designated fields
now that the products description section has been rewritten
would cause a sql error on update. This has been resolved.

0 comments on commit 697a974

Please sign in to comment.