You are here:  » Automation Tool

Support Forum



Automation Tool

Submitted by chrisst1 on Wed, 2011-09-28 13:40 in

Hi David

Not sure if this has come up before, is it possible to add a "run all" link in automation_tool.php?

Chris

Submitted by support on Wed, 2011-09-28 13:50

Hi Chris,

Should be straight forward to plumb in. First in admin/automation_tool.php look for the following code at line 63:

  print "<a href='automation_tool_edit.php?id=0'>New Job</a>&nbsp;&nbsp;";

...and REPLACE with:

  print "<a href='automation_tool_edit.php?id=0'>New Job</a>&nbsp;&nbsp;";
  print "<a href='automation_tool_run.php?id=0'>Run All</a>&nbsp;&nbsp;";

Next, in admin/automation_tool_run.php look for the following code beginning at line 14:

  $id = $_GET["id"];
  automation_run($id);

...and REPLACE with:

  $id = $_GET["id"];
  if (!$id)
  {
    $sql = "SELECT * FROM `".$config_databaseTablePrefix."jobs`";
    if (database_querySelect($sql,$jobs))
    {
      foreach($jobs as $job)
      {
        automation_run($job["id"]);
      }
    }
  }
  else
  {
    automation_run($id);
  }

Cheers,
David.
--
PriceTapestry.com

Submitted by chrisst1 on Wed, 2011-09-28 14:04

Thanks David

Likewise is it possible add import all and import all modified to feeds_register.php.

Chris

Submitted by support on Wed, 2011-09-28 14:17

Hi Chris,

That's a bit more code; firstly in admin/index.php, add the links to each type by looking for the following code at line 240:

  print "</table>";

...and REPLACE with:

  print "</table>";
  print "<p>";
  print "<a href='feeds_import.php?filename=@MODIFIED'>Import Modified</a>&nbsp;&nbsp;";
  print "<a href='feeds_import.php?filename=@ALL'>Import All</a>&nbsp;&nbsp;";
  print "</p>";

Next, in admin/feeds_import.php look for the following code at line 27:

  admin_import($filename,$limit);

...and REPLACE with:

  if ($filename == "@ALL")
  {
    $sql = "TRUNCATE `".$config_databaseTablePrefix."products`";
    database_queryModify($sql,$result);
    $sql = "SELECT * FROM `".$config_databaseTablePrefix."feeds`";
    if (database_querySelect($sql,$rows))
    {
      foreach($rows as $feed)
      {
        if (file_exists($config_feedDirectory.$feed["filename"]))
        {
          admin_import($feed["filename"],$limit);
        }
      }
    }
  }
  elseif($filename == "@MODIFIED")
  {
    $sql = "SELECT * FROM `".$config_databaseTablePrefix."feeds`";
    if (database_querySelect($sql,$rows))
    {
      foreach($rows as $feed)
      {
        if (file_exists($config_feedDirectory.$feed["filename"]) && ($feed["imported"] < filemtime($config_feedDirectory.$feed["filename"])))
        {
          admin_import($feed["filename"],$limit);
        }
      }
    }
  }
  else
  {
    admin_import($filename,$limit);
  }

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by chrisst1 on Fri, 2011-09-30 13:24

Hi David

Thanks for doing that, it worked great.

Chris

Submitted by chrisst1 on Fri, 2011-10-07 14:12

Hi David

Could you point me in the right direction, i am trying to show a progress printout like scripts/import.php produces but in feeds_import.php. I only seem to get the following working:

print chr(13)."backfilling reviews... ";

admin_importReviews();

print chr(13)."backfilling reviews...[done]\n";

Chris

Submitted by support on Fri, 2011-10-07 14:38

Hi Chris,

I have an alternative version of admin/feeds_import.php that generates the same output as the scripts/ version i'll forward it now for you...

Cheers,
David.
--
PriceTapestry.com

Submitted by chrisst1 on Mon, 2011-10-10 14:57

Thanks David

That was a great help.

Chris