You are here:  » Google Base xml feed

Support Forum



Google Base xml feed

Submitted by HJW on Tue, 2009-01-20 20:29 in

Hi,

Can anybody help? Is there a script available to produce a product feed compatible with Google Base? It needs to be in either text or xml format.

Any help would be much appreciated.

Regards
Hayden

Submitted by support on Wed, 2009-01-21 08:38

Hi Hayden,

Are you referring to exporting products from your Price Tapestry in Google Base format or are you referring in general to another database / system that you may have? If you want to export your Price Tapestry database, there is some discussion and code for doing this in the following thread:

http://www.pricetapestry.com/node/506

Cheers,
David.

Submitted by HJW on Wed, 2009-01-21 11:59

Hi David,

Thanks, this script is exactly what I need, all except one thing, is it possible to change the buy url to the product url on my site?
This is the code I Used:

 <?php
  require("includes/common.php");
  header("Content-Type: application/octet-stream");
  header("Content-Disposition: attachment; filename=products.csv");
  $sql = "SELECT * FROM `".$config_databaseTablePrefix."products`";
  print "Merchant,Name,Description,ImageURL,BuyURL,Price,Category,Brand\n";
  $link = mysql_connect($config_databaseServer,$config_databaseUsername,$config_databasePassword);
  mysql_select_db($config_databaseName,$link);
  $result = mysql_unbuffered_query($sql,$link);
  while($row = mysql_fetch_array($result,MYSQL_ASSOC))
  {
    print $row["merchant"].",";
    print $row["name"].",";
    print $row["description"].",";
    print $row["image_url"].",";
    print $row["buy_url"].",";
    print $row["price"].",";
    print $row["category"].",";
    print $row["brand"]."\n";
  }
?>

Many thanks again.

Regards

Hayden

Submitted by support on Wed, 2009-01-21 12:02

Hi Hayden,

Sure - just replace this line:

    print $row["buy_url"].",";

...with:

    if ($config_useRewrite)
    {
      $row["buy_url"] = $config_baseHREF."product/".tapestry_hyphenate($row["name"]).".html";
    }
    else
    {
      $row["buy_url"] = $config_baseHREF."products.php?q=".urlencode($row["name"]);
    }
    print "http://www.example.com".$row["buy_url"].",";

...replacing www.example.com with your domain name (but not the path to Price Tapestry as this is included by $config_baseHREF...

Cheers,
David.

Submitted by HJW on Wed, 2009-01-21 13:59

Thanks David, excellent.

Regards

Hayden