0
votes

I've set up a Magento shop on my w10 environment by using Microsoft's webplatform installer which took care of the prequisites (PHP, MySQL etc), and have been able to import products one at a time via SOAP from a windows app.

However, the performance wasn't great and because I needed to be able to import lots products at a time into Magento relatively quickly (100s at a time...), I stumbled across and installed MAGMI.

Using MAGMI, I've been able to import products successfully manually via CSVs (excellent guide here: https://aionhill.com/product-import-magmi) but I now need to able to automate this MAGMI process but don't know how.

There's lots of talk about using windows task scheduler and cron jobs to set up automated tasks but the production environment will always be based on LAMP technologies, and so cron job it is.

http://www.unixgeeks.org/security/newbie/unix/cron-1.html explains what a cron job is but then it says to do the following to find out if the cron daemon is running: "cog@pingu $ ps aux | grep crond"...

An article's answer here talks about how to set up cron jobs in Magento (System > Configuration > Advanced > System > Cron (Scheduled Tasks)) but all I see is this:

Magento cron fields

When I look for php.exe on my machine, and run it, all I get is a black box that doesn't appear to do anything:

PHP.exe

I'm guessing that I need to access the PHP server's GUI (Plesk GUI?) in order to set up a cron job on my windows enviroment and to be able to follow MAGMI's wiki guide on how to set up MAGMI so that it can be driven froma command line but how do I do any of this?

Microsoft's WebMatrix and MySQL Workbench allow me to view the files and database, and I can go into the Magento shop via the browser url but that's just about it.

Ultimately, my windows app will manage the whole process: create the CSV data files, FTP them to the webserver and then kick off MAGMI to start the import process.

Pointers would be much appreciated.

2

2 Answers

1
votes

PHP has no GUI. PHP is a script parser. When executing php.exe you will get the command line interface, where you can write PHP code and execute it...

Also in Windows there is no cron job, but as you figured out, there is something called "Task Scheduler". Look at https://technet.microsoft.com/en-us/library/cc748993(v=ws.11).aspx how to use it.

1
votes
Process myProcess = new Process();
ProcessStartInfo myProcessStartInfo = new ProcessStartInfo(@"""C:\PHP\php.exe""", "spawn");
myProcessStartInfo.UseShellExecute = false;
myProcessStartInfo.RedirectStandardOutput = true;
myProcessStartInfo.Arguments = "/path/to/magmi/cli/magmi.cli.php -profile=profilename -mode=xcreate -CSV:filename='/path/to/file.csv'"
myProcess.StartInfo = myProcessStartInfo;
myProcess.Start();

i havent tested this, but it should do what you need it to do. it'll allow you to start the import script of magmi from your application, assuming it has access to the directory of php on that machine.