You are here:  » Extra Field for Feed Registration Step 2

Support Forum



Extra Field for Feed Registration Step 2

Submitted by chrisst1 on Mon, 2011-09-12 09:48 in

Morning David

I am looking at adding an exta field to the feed registration step2 called "description_short" under merchant name. Should I add it to the database 'feeds' table or create a new table for mechants? Also could you please help with implementing the changes on feeds_register_step2.php.

Chris

Submitted by support on Mon, 2011-09-12 10:43

Hi Chris,

It's probably best to go in the feeds table, use the following dbmod.php script to add the field;

<?php
  
require("includes/common.php");
  
$sql "ALTER TABLE `".$config_databaseTablePrefix."feeds`
            ADD `description_short` VARCHAR(255) NOT NULL"
;
  
database_queryModify($sql,$result);
  print 
"Done.";
?>

And then to keep the changes in admin/feeds_register_step2.php, look for the following code at line 172:

  widget_errorGet("merchant");

...and REPLACE with:

  widget_errorGet("merchant");
  print "<br /><br />";
  print "Short Description:<br />";
  $description_shortDefault = (isset($_POST["description_short"]) ? $_POST["description_short"] : "");
  print "<textarea name='description_short' rows='5' cols='80'>".htmlentities($description_shortDefault)."</textarea>";
  print "<br /><br />";

Finally, look for the following code at line 72:

      switch($_POST["submit"])

...and REPLACE with:

      $sql = "UPDATE `".$config_databaseTablePrefix."feeds` SET description_short='".database_safe($_POST["short_description"])."' WHERE filename='".$filename."'";
      switch($_POST["submit"])

To use the description wherever a merchant name is in context, e.g. in $product["merchant"] simply use:

  $sql = "SELECT description_short FROM `".$config_databaseTablePrefix."feeds` WHERE merchant='".database_safe($product["merchant"])."'";
  database_querySelect($sql,$rows);
  print "<p>".$rows[0]["description_short"]."</p>";

Hope this helps!

Cheers,
David.
--
PriceTapestry.com

Submitted by chrisst1 on Mon, 2011-09-12 14:36

Hi David

Did not have much joy with that, changed "short_description" to "description_short" to match dbmod, added an "s" to htmlentitie, still no luck after that, it won't add to database. Must be Monday.

Chris

Submitted by support on Mon, 2011-09-12 14:44

Hi Chris,

Sorry about the typos, corrected above and if still not working as per the corrected version; please could you temporarily enable database debug mode by changing line 6 of config.advanced.php as follows;

  $config_databaseDebugMode = TRUE:

...then try the Register process again and let me know what is displayed as that should point to the problem...

Thanks,
David.
--
PriceTapestry.com