Jump to content

[SOLVED]Product RSS Feeds Will Not Validate PS 1.5.2


Recommended Posts

I am new to Prestashop and am coming in on the 1.5.2 level. I am finding that there is a lot missing compared to the previous versions. I find this out only from research. For example I see that there is a possibiltiy of an RSS feed of products because the module exists for installation, but there is not a tab to configure this module.

 

Researching the /modules/feeder/rss.php finds that the file is looking for values for $orderBy, $number and others. These are all important configuration fields for us end users, however, the 'Tools' tab is missing.

 

In addition, the RSS does not even function. Submitting it to Google finds that it fails to validate. To fix this you must research all of the answers from past issues and then patch the original rss.php to get it to function and validate.

 

Until there is the magical tool tab in the admin backend to configure this module, you will need to edit it directly. To get your RSS feed to validate you must make the following edits:

 

line 31: To edit the number of items in your feed, you make change the 10 at the end of the line to your item count.

 

$number = ((int)(Tools::getValue('n')) ? (int)(Tools::getValue('n')) : 10);

 

line 43:

 

<rss version="2.0">

 

is incorrect. This must be changed to

 

<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">

 

line 46: The description is missing. After line 46 you should add

 

<description>DESCRIBE YOUR RSS FEED HERE</description>

 

line 54: After the closing image tag

 

</image>

 

you must add the atom:link as so

 

<atom:link href="<?php echo _PS_BASE_URL_.__PS_BASE_URI__.'modules/feeder/rss.php' ; ?>" rel="self" type="application/rss+xml" />

 

line 73 or 74 roughly: at the end of your file you shoudl find the line that is

 

echo "\t\t\t<link><![CDATA[".htmlspecialchars($link->getproductLink($product['id_product'], $product['link_rewrite'], Category::getLinkRewrite((int)($product['id_category_default']), $cookie->id_lang))).$affiliate."]]></link>\n";

 

after that line, add the following line:

 

echo "\t\t\t<guid><![CDATA[".htmlspecialchars($link->getproductLink($product['id_product'], $product['link_rewrite'], Category::getLinkRewrite((int)($product['id_category_default']), $cookie->id_lang))).$affiliate."]]></guid>\n";

 

After these few edits, your feed will function. Your product feed address is as follows:

 

http://yourwebsite.com/modules/feeder/rss.php

or

feed://yourwebsite.com/modules/feeder/rss.php

for some mail readers.

 

For multi language websites, I have not figured out how to change the language of the feed yet. This should default to your original site language.

 

I have attached my functioning rss.php file. You may of course simply use it to overright yours, but be sure to edit the DESCRIPTION at least to match your site.

 

If you have any questions, please feel free to ask.

 

PLEASE NOTE: Making direct changes to your rss.php file like I have instructed you, WILL NOT carry over if you update your website in the future. Since this is a base file, there is a change that it will be over written in updates. Make sure that you copy this file to use in future updates.

 

Next I would like to work on the RSS theme a bit.

rss.php

Edited by Grosshandler22 (see edit history)
  • Like 2
Link to comment
Share on other sites

  • 1 month later...
  • 3 weeks later...

I think the fix suggested contains a type on the final step. Where is says to make the bottom edit "line 73 or 74 roughly: at the end of your file you should find the line that is" the first line in my rss.php contained the following;

 

echo "\t\t\t<link><![CDATA[".str_replace('&', '&', htmlspecialchars($link->getproductLink($product['id_product'], $product['link_rewrite'], Category::getLinkRewrite((int)($product['id_category_default']), $cookie->id_lang)))).$affiliate."]]></link>\n";

 

Then it says after that line to enter;

 

echo "\t\t\t<guid><![CDATA[".htmlspecialchars($link->getproductLink($product['id_product'], $product['link_rewrite'], Category::getLinkRewrite((int)($product['id_category_default']), $cookie->id_lang))).$affiliate."]]></guid>\n";

 

But in the steps above it displays the above line above twice.

 

Also I have noticed that you need to change the number of items to display from the original 10 on lines 30 and 34 in my file, and it only seems to display the products if they are selected on Associations categories > Home on the Associations tab when editing each product.

 

I am working on the rss.php file from version 1.5.3.1

 

Hope that helps and please post a comment if it does.

 

Sam

 

www.livinghealthy.co.uk

www.livinghealthy.co.uk/modules/feeder/rss.php

Link to comment
Share on other sites

  • 4 weeks later...
  • 4 weeks later...

From my post above.

 

I have noticed that you need to change the number of items to display from the original 10 on lines 30 and 34 in my file, and it only seems to display the products if they are selected on Associations categories > Home on the Associations tab when editing each product.

 

Let me know if that helps.

Link to comment
Share on other sites

  • 1 month later...
×
×
  • Create New...