コード例 #1
0
function WeberpToOpenCartDailySync($ShowMessages, $db, $db_oc, $oc_tableprefix, $EmailText = '')
{
    $begintime = time_start();
    DB_Txn_Begin($db);
    // check last time we run this script, so we know which records need to update from OC to webERP
    $LastTimeRun = CheckLastTimeRun('WeberpToOpenCartDaily', $db);
    if ($ShowMessages) {
        $TimeDifference = Get_SQL_to_PHP_time_difference($db);
        prnMsg('This script was last run on: ' . $LastTimeRun . ' Server time difference: ' . $TimeDifference, 'success');
        prnMsg('Server time now: ' . GetServerTimeNow($TimeDifference), 'success');
    }
    if ($EmailText != '') {
        $EmailText = $EmailText . 'webERP to OpenCart Daily Sync was last run on: ' . $LastTimeRun . "\n" . PrintTimeInformation($db);
    }
    // maintain outlet category in webERP
    // Not needed because now in weberp one item only belongs to 1 sales category, so no chance to have more than one to clean up
    //	$EmailText = MaintainWeberpOutletSalesCategories($ShowMessages, $LastTimeRun, $db, $db_oc, $oc_tableprefix, $EmailText);
    // do all hourly maintenance as well...
    $EmailText = WeberpToOpenCartHourlySync($ShowMessages, $db, $db_oc, $oc_tableprefix, FALSE, $EmailText);
    // recreate the list of featured in OpenCart
    $EmailText = SyncFeaturedList($ShowMessages, $LastTimeRun, $db, $db_oc, $oc_tableprefix, $EmailText);
    // update sales categories
    $EmailText = SyncSalesCategories($ShowMessages, $LastTimeRun, $db, $db_oc, $oc_tableprefix, $EmailText);
    // activate / inactivate categories depending on items No items = inactive. Items = Active
    $EmailText = ActivateCategoryDependingOnQOH($ShowMessages, $LastTimeRun, $db, $db_oc, $oc_tableprefix, $EmailText);
    // maintain the outlet category in a special way (both webERP and OC)
    //	$EmailText = MaintainOpenCartOutletSalesCategories($ShowMessages, $LastTimeRun, $db, $db_oc, $oc_tableprefix, $EmailText);
    // assign multiple images to products
    $EmailText = SyncMultipleImages($ShowMessages, $LastTimeRun, $db, $db_oc, $oc_tableprefix, $EmailText);
    // assign related items
    $EmailText = SyncRelatedItems($ShowMessages, $LastTimeRun, $db, $db_oc, $oc_tableprefix, $EmailText);
    // We are done!
    SetLastTimeRun('WeberpToOpenCartDaily', $db);
    DB_Txn_Commit($db);
    if ($ShowMessages) {
        time_finish($begintime);
    }
    return $EmailText;
}
コード例 #2
0
<?php

define("VERSIONFILE", "1.10");
/* Session started in session.inc for password checking and authorisation level check
config.php is in turn included in session.inc*/
include 'includes/session.inc';
$Title = _('webERP to OpenCart Hourly Synchronizer ' . VERSIONFILE);
include 'includes/header.inc';
include 'includes/GetPrice.inc';
include 'includes/KLGeneralFunctions.php';
include 'includes/WeberpOpenCartDefines.php';
include 'includes/OpenCartGeneralFunctions.php';
include 'includes/WeberpToOpenCartSync.php';
include 'includes/OpenCartConnectDB.php';
WeberpToOpenCartHourlySync(TRUE, $db, $db_oc, $oc_tableprefix, TRUE, '');
include 'includes/footer.inc';