2012-11-28 15 views
0

嗨我正在嘗試爲導入產品到我的magento cron工作。 我已經在臨時基礎上開展了所有工作,但現在我需要一個cron。magron導入的Cron工作

理想情況下,我想使用wget,因爲這是最直接的。

所以我用的wget 「http://www.xxxxxx.com/magmi/web/magmi_run.php?profile=default &模式= xcreate &引擎= magmi_productimportengine:Magmi_ProductImportEngine」 -O的/ dev/null的

但我遇到了此錯誤消息的問題 已發送HTTP請求,正在等待響應...在標題中讀取錯誤(由對等方重置連接)。 即將到來 - 哪個花了20次,然後放棄。

誰能告訴我問題可能是什麼? 謝謝 Richard

回答

4

我建議使用Magmi CLI Interface來處理cron作業運行(因爲HTTP連接可能會超時等)。

我會在你的cron作業運行以下命令:

php /path/to/magmi/cli/magmi.cli.php -mode=create 

您可以在這裏引用文檔定義自定義配置文件和模式: http://sourceforge.net/apps/mediawiki/magmi/index.php?title=Magmi_command_line

+0

謝謝,我只是去嘗試,但得到這個錯誤PHP公告:未定義抵消:-1在/var/www/vhosts/deal-buster.co.uk/httpdocs/magmi/inc/magmi_engine.php上線211 啓動:執行Datasouce查找... PHP致命錯誤:調用成員函數getRecordsCount()一個非對象在/var/www/vhosts/deal-buster.co.uk/httpdocs/magmi/engines/magmi_productimportengine.php在線1309 –

+0

我認爲這是我和錯誤的網址 - 似乎是現在好了 - 謝謝你聆聽老手! –

0

在某些情況下,我不得不跑Magmi從Magento的cron作業,所以我有這樣的事情:

/** 
* Includes Magmi files 
*/ 
protected function _includeMagmi() 
{ 
    $magentoBaseDir = Mage::getBaseDir(); 
    require_once($magentoBaseDir . DS . 'magmi' . DS . 'inc' . DS . 'magmi_defs.php'); 
    require_once($magentoBaseDir . DS . 'magmi' . DS . 'integration' . DS . 'inc' . DS . 'magmi_datapump.php'); 
} 

/** 
* Runs Magmi to update/create for specified data 
* 
* @param string $profile Magmi import profile (@see magmi/conf/ 
* @param string $mode 
* @param array $data 
*/ 
protected function _runMagmiImport($profile, $mode, array $data) 
{ 
    $this->_includeMagmi(); 

    $logger = Mage::getModel('mario/magmi_logger'); 

    /** @var Magmi_ProductImport_DataPump $dataPump */ 
    $dataPump = Magmi_DataPumpFactory::getDataPumpInstance('productimport'); 
    $dataPump->beginImportSession($profile, $mode, $logger); 
    foreach ($data as $update) { 
     $dataPump->ingest($update); 
    } 
    $dataPump->endImportSession(); 

    return $logger; 
}