You are here:  » Progress indicator on import / Full import link

Support Forum



Progress indicator on import / Full import link

Submitted by DrZork101 on Tue, 2009-11-10 20:39 in

Hi David,

I was wondering if it was possible to make a progress indicator to show how far through an import is?

It would not necessarily have to show in realation to total number and could just be a counter on imported rows. Obviously a percentage through would be nice but i'm guessing a lot more complicated.

Submitted by support on Wed, 2009-11-11 09:07

Hi,

I've combined your posts regarding this and an Import All link from within the administration area. One method is to create a PHP script to "pass thru" the automation script with the @ALL parameter. To do this; create the following PHP file in your /admin/ folder:

importAll.php

<?php
  ob_implicit_flush
(TRUE);
  
header("Content-Type: text/plain");
  
passthru("php ../scripts/import.php @ALL");
?>

If you would then like to add a link to the administration menu, look for the following code on line 20 of admin/admin_menu.php:

  print "<a href='moderate.php'>Moderate Reviews</a>&nbsp;&nbsp;";

...and REPLACE that with:

  print "<a href='moderate.php'>Moderate Reviews</a>&nbsp;&nbsp;";
  print "<a href='importAll.php'>Import All</a>&nbsp;&nbsp;";

The output that will be generated will be identical to that seen when using import.php from the command line - so it will show a product progress through each feed Vs the total number of products in that feed (if known).

Hope this helps!

Cheers,
David.

Submitted by DrZork101 on Wed, 2009-11-11 11:15

Thanks David,

A very simple implementation! I will try it out tonight,

Julian

Submitted by HJW on Thu, 2009-11-12 15:16

Hi David,

I've been testing the new distribution software on my test site and I thought it would be a good idea to include the above script. Unfortunately when I click on 'Import All' all that happens is, a couple of minutes of waiting then I get the following message;

X-Powered-By: PHP/5.2.8
Content-Type: text/plain

This repeats on the page about a zillion times, then followed by this message;

Warning: passthru() [function.passthru]: Unable to fork [php ../scripts/import.php @ALL] in /home/namedcom/public_html/newtest/admin/importAll.php on line 4

What am I doing wrong? Any ideas please.

Regards

Hayden

Submitted by support on Thu, 2009-11-12 15:23

Hi Hayden,

I'm not sure why you would be seeing it multiple times as it should only try (and fail) once; however it is possible that the PHP binary cannot be found. Could you try it as follows:

<?php
  header
("Content-Type: text/plain");
  
passthru("/usr/bin/php ../scripts/import.php @ALL");
?>

(i've removed the implicit flush line in-case that was something to do with the repeating)...

Cheers,
David.

Submitted by HJW on Thu, 2009-11-12 16:13

Hi,

I tried that, I got the same repeated message as above but the end message was;

Warning: passthru() [function.passthru]: Unable to fork [/usr/bin/php ../scripts/import.php @ALL] in /home/namedcom/public_html/newtest/admin/importAll.php on line 3

Regards

Hayden

Submitted by support on Thu, 2009-11-12 16:19

Hi Hayden,

Thanks - that would indicate that the command line version of PHP is not available. Bear with me; and I'll create an import all script including progress indicator as a regular script...

Cheers,
David.

Submitted by HJW on Thu, 2009-11-12 16:26

Thanks David,

Sorry to be a pain!!!!

Regards

Hayden