function bulkUpload($inc_image = false) { global $db, $messageStack; $error = false; $result = $db->Execute("select id from " . TABLE_INVENTORY . " where catalog = '1' and inactive = '0'"); $cnt = 0; while (!$result->EOF) { $prodXML = new zencart(); if (!$prodXML->submitXML($result->fields['id'], 'product_ul', true, $inc_image)) { $error = true; break; } $cnt++; $result->MoveNext(); } $messageStack->add(sprintf(ZENCART_BULK_UPLOAD_SUCCESS, $cnt), 'success'); return $error ? true : false; }
} break; case 'bulkupload': $upXML = new bulk_upload(); $inc_image = isset($_POST['include_images']) ? true : false; if ($upXML->bulkUpload($inc_image)) { gen_add_audit_log(ZENCART_BULK_UPLOAD); write_configure('MODULE_ZENCART_LAST_UPDATE', date('Y-m-d H:i:s')); } break; case 'sync': $upXML = new zencart(); if ($upXML->submitXML(0, 'product_sync')) { gen_add_audit_log(ZENCART_PRODUCT_SYNC); } break; case 'confirm': $upXML = new zencart(); $upXML->post_date = $ship_date; if ($upXML->submitXML(0, 'confirm')) { gen_add_audit_log(ZENCART_SHIP_CONFIRM, $ship_date); } break; default: } /***************** prepare to display templates *************************/ $cal_zc = array('name' => 'shipDate', 'form' => 'zencart', 'fieldname' => 'ship_date', 'imagename' => 'btn_date_1', 'default' => gen_locale_date($ship_date), 'params' => array('align' => 'left')); $include_header = true; $include_footer = true; $include_template = 'template_main.php'; define('PAGE_TITLE', BOX_ZENCART_MODULE);
function initialize($module) { global $db, $messageStack; gen_pull_language('inventory'); require_once DIR_FS_MODULES . 'zencart/classes/zencart.php'; require_once DIR_FS_MODULES . 'zencart/functions/zencart.php'; require_once DIR_FS_MODULES . 'zencart/language/' . $_SESSION['language'] . '/language.php'; require_once DIR_FS_MODULES . 'inventory/defaults.php'; require_once DIR_FS_MODULES . 'inventory/functions/inventory.php'; $error = false; if (defined('MODULE_ZENCART_LAST_UPDATE') && MODULE_ZENCART_LAST_UPDATE != '') { $where = " and ( last_update >'" . MODULE_ZENCART_LAST_UPDATE . "' or last_journal_date >'" . MODULE_ZENCART_LAST_UPDATE . "')"; } $result = $db->Execute("select id from " . TABLE_INVENTORY . " where catalog = '1' " . $where); $cnt = 0; if ($result->RecordCount() == 0) { return true; } while (!$result->EOF) { $prodXML = new zencart(); if (!$prodXML->submitXML($result->fields['id'], 'product_ul', true, true)) { $error = true; break; } $cnt++; $result->MoveNext(); } if ($error) { return false; } $messageStack->add(sprintf(ZENCART_BULK_UPLOAD_SUCCESS, $cnt), 'success'); gen_add_audit_log(ZENCART_BULK_UPLOAD); write_configure('MODULE_ZENCART_LAST_UPDATE', date('Y-m-d H:i:s')); }
// +-----------------------------------------------------------------+ // | Copyright(c) 2008-2014 PhreeSoft, LLC (www.PhreeSoft.com) | // +-----------------------------------------------------------------+ // | This program is free software: you can redistribute it and/or | // | modify it under the terms of the GNU General Public License as | // | published by the Free Software Foundation, either version 3 of | // | the License, or any later version. | // | | // | This program is distributed in the hope that it will be useful, | // | but WITHOUT ANY WARRANTY; without even the implied warranty of | // | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | // | GNU General Public License for more details. | // +-----------------------------------------------------------------+ // Path: /modules/inventory/custom/pages/main/extra_actions.php // // This file contains the extra actions added to the maintain inventory module, it is executed // before the standard switch statement switch ($_REQUEST['action']) { // Begin - Upload operation added by PhreeSoft to upload products to ZenCart case 'upload_zc': $id = db_prepare_input($_POST['rowSeq']); require_once DIR_FS_MODULES . 'zencart/functions/zencart.php'; require_once DIR_FS_MODULES . 'zencart/classes/zencart.php'; $upXML = new zencart(); $upXML->submitXML($id, 'product_ul'); $_REQUEST['action'] = ''; break; // End - Upload operation added by PhreeSoft // End - Upload operation added by PhreeSoft default: }