You are here:  » Import.php questions


Import.php questions

Submitted by Retro135 on Thu, 2017-02-23 04:37 in

1. Is it possible to specify several merchants instead of one at a time?

2. Only 1 review has been posted. Can I comment out the backfilling reviews code?

Submitted by support on Thu, 2017-02-23 09:05

Hi,

> 1. Is it possible to specify several merchants instead of one at a time?

Sure - scripts/import.php can be modified so that a comma separated list of feeds can be specified in the <filename> parameter. To do this, look for the following code beginning at line 109:

    $sql = "SELECT * FROM `".$config_databaseTablePrefix."feeds` WHERE filename='".database_safe($filename)."'";
    if (database_querySelect($sql,$rows))
    {
      $feed = $rows[0];
      import();
    }

...and REPLACE with:

    $filenames = explode(",",$filename);
    foreach($filenames as $filename)
    {
      $sql = "SELECT * FROM `".$config_databaseTablePrefix."feeds` WHERE filename='".database_safe($filename)."'";
      if (database_querySelect($sql,$rows))
      {
        $feed = $rows[0];
        import();
      }
    }

> 2. Only 1 review has been posted. Can I comment out the backfilling reviews code?

Sure - code begins at line 119:

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

...either comment out or DELETE as required. Backfill process runs at the end of any manual feed import from /admin/ home page.

Cheers,
David.
--
PriceTapestry.com

Submitted by sirmanu on Thu, 2017-02-23 12:57

I take advantage of the occasion of this thread to ask about an idea that is rounding my head last days.
Could you please show me, in fact, it's not necessary go in detail, the modifications needed in admin.php (admin_import) to only update items, without deleting existing merchant.

For instance, I see that I have to comment this lines, in order to mantain database ids

$sql = "DELETE FROM `".$config_databaseTablePrefix.$table."` WHERE filename='".database_safe($admin_importFeed["filename"])."'";
database_queryModify($sql,$insertId);

In fact, I want to have a normal admin.php and import.php (or cron.php), which it will be executed every week, as is more CPU intensive because drop database and recreation large indexes.

And then, other admin.php which only updates new information, without deleting, but updating prices, maybe, one or two times per day.

What do you think?

Submitted by support on Thu, 2017-02-23 13:54

Hi,

Modifications for Update / Insert instead of Delete / Insert can be found here.

So one thing you could do that I think would satisfy the description of what you want to achieve would be to apply the mods from node 5513 to copies of the files e.g.

includes/admin_update.php
scripts/import_update.php
scripts/cron_update.php

As well as the mods from node 5513, when editing the new scripts/import_update.php and scripts/cron_update.php you would also edit the following line;

  require("../includes/admin.php");

...and REPLACE with:

  require("../includes/admin_update.php");

With that in place, you can schedule cron_update.php during the week, and the full refresh cron.php as required.

Cheers,
David.
--
PriceTapestry.com