magento - Methods to automate magmi -


can tell me how automate magmi perform import on scheduled time every day.

i have heard can done via cli dont know how use cli.

please give me step wise procedure how cli , commands use automating imports.

i saw magmi wiki site not understand how use cli.

please give me proper solution how can automate magmi.

i tried use below link working

wget "http://user:password@example.com/magmi/web/magmi_run.php?mode=create&profile=default&engine=magmi_productimportengine:magmi_productimportengine&csv:filename=/magmitest.csv" -o /dev/null 

if can go system cron (cli version problem) here's complete solution i'm using in 1 of project (simplified version).

i using company vendor name , module name magmi.

first step install magmi usual. , think have installed.

next, create app/etc/modules/company_magmi.xml following content

<?xml version="1.0"?> <config>     <modules>         <company_magmi>             <active>true</active>             <codepool>local</codepool>             <version>0.0.1</version>         </company_magmi>     </modules> </config> 

then create app/code/local/company/magmi/etc/config.xml following content

<?xml version="1.0"?> <config>     <modules>         <company_magmi>             <version>0.0.1</version>         </company_magmi>     </modules>     <global>         <models>             <company_magmi>                 <class>company_magmi</class>             </company_magmi>         </models>     </global>     <crontab>         <jobs>             <magmi_update>                 <schedule>                     <cron_expr>*/5 * * * *</cron_expr>                 </schedule>                 <run>                     <model>company_magmi/cron::magmiupdate</model>                 </run>             </magmi_update>         </jobs>     </crontab> </config> 

create app/code/local/company/magmi/cron.php file following content

<?php  require_once(dirname(__file__) . "/../../../../../magmi/plugins/inc/magmi_datasource.php"); require_once(dirname(__file__) . "/../../../../../magmi/integration/productimport_datapump.php");  class company_magmi_cron {      public function magmiupdate()     {         $items = array(); // build own list of items create/update          $this->import($items);     }      private function import($items, $mode = 'create', $indexes = 'all')     {         if (count($items) > 0) {             $dp = new magmi_productimport_datapump();             $dp->beginimportsession("profile_name", $mode);             foreach ($items $item) {                 $dp->ingest($item);             }             $dp->endimportsession();             $this->reindex($indexes);         }     }      private function reindex($string = 'all')     {         /** @var $indexer mage_index_model_indexer */         $indexer = mage::getmodel('index/indexer');          $processes = array();          if ($string == 'all') {             $processes = $indexer->getprocessescollection();         } else {             $codes = explode(',', $string);             foreach ($codes $code) {                 $process = $indexer->getprocessbycode(trim($code));                 if ($process) {                     $processes[] = $process;                 }             }         }          /** @var $process mage_index_model_process */         foreach ($processes $process) {             $process->reindexeverything();         }     } } 

and change profile_name profile name in magmi.

having in place have build list of items create/update. it's simple. here's example:

say, want update stock products. create csv file this:

sku,qty "somesku","10" "snothersku","2" 

just build $items this:

$items[] = array(     "sku" => "somesku",     "qty" => "10" ); $items[] = array(     "sku" => "anothersku",     "qty" => "2" ); 

and don't forget setup cron magento!

you've got idea, right?

that's it.


Comments

Popular posts from this blog

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -