Exemplo n.º 1
0
 public static function setLogFileName($fileName)
 {
     self::$_logFileName = $fileName;
 }
Exemplo n.º 2
0
<?php

ini_set('memory_limit', '2048M');
ini_set('max_execution_time', '600');
set_time_limit(0);
$mageRoot = dirname(dirname(getcwd()));
require $mageRoot . '/Vic.php';
require $mageRoot . '/app/Mage.php';
Mage::app('admin')->setUseSessionInUrl(false);
umask(0);
// = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
Vikont_Pulliver_Model_Log::setLogFileName('pulliver.log');
Vikont_Pulliver_Helper_Data::setSilentExceptions(false);
Vikont_Pulliver_Helper_Data::inform("\nMotonation Connector started...\n");
$commonHelper = Mage::helper('pulliver');
$moduleHelper = Mage::helper('pulliver/Motonation');
$skuHelper = Mage::helper('pulliver/Sku');
try {
    $params = isset($argv) ? Vikont_Pulliver_Helper_Data::getCommandLineParams($argv) : new Varien_Object($_GET);
    if ($downloadedFileName = $params->getData('file')) {
        Vikont_Pulliver_Helper_Data::inform(sprintf('Skipped downloading, using local file %s', $downloadedFileName));
    } else {
        $downloadedFileName = $moduleHelper->downloadFile();
    }
    $update = $moduleHelper->parseFile($downloadedFileName);
    $outputFileName = $moduleHelper->getLocalFileName('inventory.csv');
    $fileHandle = $commonHelper->openFile($outputFileName);
    $lineCounter = 0;
    foreach ($update as $itemNumber => $qty) {
        if ($sku = $skuHelper->getSkuByItemNumber('MT', $itemNumber)) {
            fputcsv($fileHandle, array($sku, $qty));
Exemplo n.º 3
0
 public static function inform($message)
 {
     echo self::isCLIMode() ? $message . "\n" : nl2br($message) . '<br/>';
     Vikont_Pulliver_Model_Log::log($message);
 }