Пример #1
1
 * version : 0.1
 * author : S.BRACQUEMONT aka dweeves
 * updated : 2010-08-02
 * 
 */
require_once dirname(__FILE__) . "/../engines/magmi_productimportengine.php";
$script = array_shift($argv);
$options = array();
foreach ($argv as $option) {
    $isopt = $option[0] == "-";
    if ($isopt) {
        $optarr = explode("=", substr($option, 1), 2);
        $optname = $optarr[0];
        if (count($optarr) > 1) {
            $optval = $optarr[1];
        } else {
            $optval = 1;
        }
        $options[$optname] = $optval;
    }
}
class CLILogger
{
    public function log($data, $type)
    {
        echo "{$type}:{$data}\n";
    }
}
$importer = new Magmi_ProductImportEngine();
$importer->setLogger(new CLILogger());
$importer->run($options);
Пример #2
0
<?php
if (isset($argv) && is_array($argv) && $argv[1]=='sleep') {
  sleep(rand(1,60)*60);
}
set_include_path(get_include_path().':'.__DIR__.'/../magmi/inc');
require __DIR__.'/../magmi/engines/magmi_productimportengine.php';
require __DIR__.'/../magmi/plugins/inc/magmi_generalimport_plugin.php';
require __DIR__.'/../magmi/plugins/extra/general/socialnotify/socialnotify.php';

$snp = new SocialNotifyPlugin('SocialNotifyPlugin');
$engine = new Magmi_ProductImportEngine();
$engine->initialize();
$engine->connectToMagento();
$snp->pluginInit($engine,array(
  'class' =>'SocialNotifyPlugin',
  'dir' => __DIR__.'/../magmi/plugins/extra/general/socialnotify',
  'file' =>'socialnotify.php'
));
$snp->afterImport();
echo PHP_EOL;