You are here:  » RSS Feeds

Support Forum



RSS Feeds

Submitted by crounauer on Fri, 2006-05-12 13:26 in

Hi David,

I was wondering if you thought it might be a good idea to include RSS feeds into Price Tapestry?

Everywhere I read these days seems to be the on the importance of RSS feeds.

If you did think it was a good idea, would they be most effective for merchants, brands or categories?

Thanks,
Simon,

Submitted by crounauer on Mon, 2006-05-22 20:47

I have come up with this script for RSS 0.92. It works but I don't recommend it for large stores as it takes a long time to load and can be quite intesive on your resources.

Simply add a file called rss.php to the root of your site!

<?php
require("includes/common.php");
Header('Content-Type: application/xml');
echo '<?xml version="1.0" encoding="UTF-8" ?>' . "\n";
echo '<?xml-stylesheet href="http://www.w3.org/2000/08/w3c-synd/style.css" type="text/css"?>' . "\n";
echo '<!-- RSS for ' . $config_title . ', generated on ' . date(r) . ' -->' . "\n";
?>
$sql = "SELECT * FROM `".$config_databaseTablePrefix."feeds` ORDER by merchant";
<rss version="0.92">
<channel>
<title><?php echo $merchant?></title>
<link><?php echo $base_url;?></link>
<description><?php echo $store_desc?></description>
<webMaster><?php echo $email_address?></webMaster>
<language><?php echo $lang_code?></language>
<lastBuildDate><?php echo date(r); ?></lastBuildDate>
<docs>http://blogs.law.harvard.edu/tech/rss</docs>
<?php
    if (database_querySelect($sql,$rows))
    {
$sitemapBaseHREF = "http://".$_SERVER["HTTP_HOST"].$config_baseHREF;
foreach($rows as $row)
     {
  echo '<item>' . "\n";
  echo ' <title>' , $row["merchant"] , '</title>' . "\n";
  echo ' <link>' . $sitemapBaseHREF . "merchant/" . tapestry_hyphenate($row["merchant"])."/" . '</link>' . "\n";
  echo ' <description>' , $row["merchant"] , '</description>' . "\n";
  echo '</item>' . "\n";
    }
}
?>
</channel>
</rss>

Computer Hardware

Submitted by crounauer on Mon, 2006-05-22 20:49

I am working on a rss script which will produce xml feeds per merchant and all their products.

Computer Hardware

Submitted by atman on Mon, 2006-09-18 10:14

hi crounauer,

i tried the rss mod above but got this error.

Invalid at the top level of the document. Error processing resource

any update on this RSS mod?

thank you.

atman

Submitted by atman on Mon, 2006-09-18 13:34

heres the error script while using firefox.

XML Parsing Error: not well-formed
Location: http://example.com/rss.php
Line Number 4, Column 1:$sql = "SELECT * FROM `".$config_databaseTablePrefix."feeds` ORDER by merchant";
^

Submitted by support on Mon, 2006-09-18 13:40

Hi atman,

The line $sql = ..... is outside of the PHP tags, so it will apear in the output and that is why the XML is therefore invalid.

I'm not familiar with the original script, but I think it should probably be something like this:

<?php
require("includes/common.php");
Header('Content-Type: application/xml');
echo '<?xml version="1.0" encoding="UTF-8" ?>' . "\n";
echo '<?xml-stylesheet href="http://www.w3.org/2000/08/w3c-synd/style.css" type="text/css"?>' . "\n";
echo '<!-- RSS for ' . $config_title . ', generated on ' . date(r) . ' -->' . "\n";
$sql = "SELECT * FROM `".$config_databaseTablePrefix."feeds` ORDER by merchant";
?>
<rss version="0.92">
<channel>
<title><?php echo $merchant?></title>
<link><?php echo $base_url;?></link>
<description><?php echo $store_desc?></description>
<webMaster><?php echo $email_address?></webMaster>
<language><?php echo $lang_code?></language>
<lastBuildDate><?php echo date(r); ?></lastBuildDate>
<docs>http://blogs.law.harvard.edu/tech/rss</docs>
<?php
    if (database_querySelect($sql,$rows))
    {
$sitemapBaseHREF = "http://".$_SERVER["HTTP_HOST"].$config_baseHREF;
foreach($rows as $row)
     {
  echo '<item>' . "\n";
  echo ' <title>' , $row["merchant"] , '</title>' . "\n";
  echo ' <link>' . $sitemapBaseHREF . "merchant/" . tapestry_hyphenate($row["merchant"])."/" . '</link>' . "\n";
  echo ' <description>' , $row["merchant"] , '</description>' . "\n";
  echo '</item>' . "\n";
    }
}
?>
</channel>
</rss>

Submitted by atman on Mon, 2006-09-18 17:25

working now. thank you.

multiple rss channels

- recently updated products
- new reviews
- option to have everything on RSS. similar to wordpress, rss for categories, for merchants, for products, brands etc.

just a suggestion. :)

regards,

atman

Submitted by cq on Thu, 2007-09-13 11:17

Hi David,

I got this error when trying to use the rss.php. How to fix this.

Invalid xml declaration.
Line: 2 Character: 3

thanks
jack

Submitted by support on Thu, 2007-09-13 12:55

Hello Jack,

Can you do a "View > Source" in your browser when opening the RSS feed and see if there are any spurious characters that are before the opening XML tag? Basically, there should be nothing at all before:

<?xml

Cheers,
David.

Submitted by genehig on Thu, 2007-09-13 21:29

David,
I want to add some feeds to my site from merchants that do not provide anything but an RSS or XML feed. Will this routine help with that and how do I integrate it?

Thanx
Gene

Submitted by support on Fri, 2007-09-14 09:55

Hello Gene,

This script is about exporting, not importing; so if you want to list merchants that do not provide an XML or RSS feed you will need to contact them (or the network) about providing a feed. If you have a merchant that provides an RSS feed remember that you can register and import it as normal - Price Tapestry reads RSS feeds no problem!

Cheers,
David.