Support forum login

©2006-2013 IAAI Software

Contact Us Privacy Policy

Edit Register / Feeds

Submitted by gregor on Thu, 2012-06-14 13:11.

Hi David, I've always been curious as to the reasons why the Register link does not bring up the information from the Feeds file when you open it. If you want to update a feed's registration information, you have to start from scratch and completely redefine it. This is inconvenient and can be dangerous if you get something wrong. I assume there must be a good reason for this, but how hard would it be to pre-populate the fields with data from the Feeds table when the page opens? Would you please give me some hints on how to do this, and maybe some insight into the potential pitfalls?

Thanks,
Gregor

Submitted by support on Thu, 2012-06-14 14:04.

Hi Gregor,

Sure, Feed Registration Step 2 can be pre-populated if a feed is already registered. To do this, look for the following code at line 91 of admin/feeds_register_step2.php:

  require("admin_header.php");

...and REPLACE with:

  if (!isset($_POST["submit"]))
  {
    $sql = "SELECT * FROM `".$config_databaseTablePrefix."feeds` WHERE filename='".database_safe($filename)."'";
    if (database_querySelect($sql,$feeds))
    {
      $feed = $feeds[0];
      $_POST["merchant"] = $feed["merchant"];
      $_POST["field_merchant"] = $feed["field_merchant"];
      $_POST["user_category"] = $feed["user_category"];
      $_POST["user_brand"] = $feed["user_brand"];
      foreach($config_fieldSet as $field => $caption)
      {
        $_POST["field_".$field] = $feed["field_".$field];
      }
    }
  }
  require("admin_header.php");

Cheers,
David.
--
PriceTapestry.com

Submitted by gregor on Thu, 2012-06-14 14:59.

That's great David, thank you. Will be a big help! Would it also be possible to default step1 also? Sometimes the auto-detected feed format needs to be overridden and that's one of the hardest things for me to keep straight.

Thanks,
Greg

Submitted by support on Thu, 2012-06-14 15:14.

Hi Greg,

Sure - in admin/feeds_register_step1.php look for the following code at line 20:

  $formatDetected = MagicParser_getFormat($config_feedDirectory.$filename);

...and REPLACE with:

  $sql = "SELECT * FROM `".$config_databaseTablePrefix."feeds` WHERE filename='".database_safe($filename)."'";
  if (database_querySelect($sql,$feeds))
  {
    $feed = $feeds[0];
    $formatDetected = $feed["format"];
  }
  else
  {
    $formatDetected = MagicParser_getFormat($config_feedDirectory.$filename);
  }

Cheers,
David.
--
PriceTapestry.com

Submitted by gregor on Thu, 2012-06-14 19:20.

Works a treat ... Thank you so much! This will make life so much easier.

Gregor