newtech Posted December 1, 2006 Share Posted December 1, 2006 I guess that would helphttp://www.oscommerce.com/forums/index.php?act...st&p=980860 Actual contrib http://www.oscommerce.com/community/contributions,4010 Quote Link to comment Share on other sites More sharing options...
warrenerjm Posted December 1, 2006 Share Posted December 1, 2006 Hello  I have checked with my hosts & inputted the correct database details, so getting rid of my last error, but I am still getting the following error:  Only one top level element is allowed in an XML document. Line: 2 Character: 2  <b>Parse error</b>: syntax error, unexpected T_STRING in <b>/home/xxxxxx/public_html/xxxxxx/rss.php</b> on line <b>15</b><br />  line 15 is: } else {  // Si la langue n'est pas spécifiée if ($HTTP_GET_VARS['language'] == '') { $lang_query = tep_db_query('select languages_id, code from ' . TABLE_LANGUAGES . ' where directory = \'' . $language . '\''); } else { $cur_language = tep_db_output($HTTP_GET_VARS['language']); $lang_query = tep_db_query('select languages_id, code from ' . TABLE_LANGUAGES . ' where code = \'' . $cur_language . '\''); } I have downloaded the file zip again & re uploaded to the root but still I cannot get this error to go away & a working rss to appear.  Pleeeeeease could someone give me an answer because I do not have a clue.  Thank you Julie Quote Link to comment Share on other sites More sharing options...
alocacoc99 Posted December 12, 2006 Share Posted December 12, 2006 Hi  The RSS Feed is a verry fine script. I want to use it, to get my orders about rss feed. So i can check the orders simply from every computer, PDA and also from my Satellite Receiver. Any ideas how i can configure the script to get orders ?  Best regards alocacoc Quote Link to comment Share on other sites More sharing options...
Guest Posted December 12, 2006 Share Posted December 12, 2006 Actual contribhttp://www.oscommerce.com/community/contributions,4010 Â I would like the RSS to generate specials only, not on the mainpage ;) Quote Link to comment Share on other sites More sharing options...
warrenerjm Posted January 30, 2007 Share Posted January 30, 2007 Hi, I just downloaded this tonight. My feed failed validation too :(  To answer your first question, your feed looks normal. That's how they look, nothing fancy.  I've been reading up on the error I got from the validator. Same as yours, re. the <image> tags.  Everything I know about RSS I learned tonight :blink: but basically, the documentation says that <image> is not a suitable "child" element of <item>  I took their word for it and made a change to the rss.php file  Near the bottom of the file, about line 168 I changed this  if ($image != '') { echo ' <image>' . "\n"; echo ' <url>' . $image_url . '</url>' . "\n"; echo ' <title>' . $name . '</title>' . "\n"; echo ' <link>' . $weblink . '</link>' . "\n"; echo ' </image>' . "\n"; }  to this  /* if ($image != '') { echo ' <image>' . "\n"; echo ' <url>' . $image_url . '</url>' . "\n"; echo ' <title>' . $name . '</title>' . "\n"; echo ' <link>' . $weblink . '</link>' . "\n"; echo ' </image>' . "\n"; }*/  to eliminate the problem.  Now I've been validated :lol:  Like I said, I don't know much about RSS but that fixed it for me. Hi  I have finally sorted this! :D I do have three problems though.  1) I can't read the above code or understand what it means, but when I tried to validate I too had the <image> error. Do I amend the code as above on line 168-173 on /rss.php  2) My links are showing the oscsid & although it has been mentioned in this thread, I can't see an answer to it? Any suggestions? Is an issue or not? Maybe it is customer related & so different for everyone...& maybe not :blink:  3) In admin/configuration/maximum values/search results I already had it set for 20. On first subscribing to my feed I saw 20 new products. Then when I refreshed I saw 40/40 & the first 20 were repeated again. I have tried to refresh again but I don't get 60/60 etc. Again it has been mensioned but I can't see the answer to resolve it? What do I do about this one?  Thank you for any help with the above. :D  Julie Quote Link to comment Share on other sites More sharing options...
warrenerjm Posted January 30, 2007 Share Posted January 30, 2007 Hi I have finally sorted this! :D I do have three problems though.  1) I can't read the above code or understand what it means, but when I tried to validate I too had the <image> error. Do I amend the code as above on line 168-173 on /rss.php  2) My links are showing the oscsid & although it has been mentioned in this thread, I can't see an answer to it? Any suggestions? Is an issue or not? Maybe it is customer related & so different for everyone...& maybe not :blink:  3) In admin/configuration/maximum values/search results I already had it set for 20. On first subscribing to my feed I saw 20 new products. Then when I refreshed I saw 40/40 & the first 20 were repeated again. I have tried to refresh again but I don't get 60/60 etc. Again it has been mensioned but I can't see the answer to resolve it? What do I do about this one?  Thank you for any help with the above. :D  Julie  :D :D Number 1 sorted & I too am validated! :lol:  Still don't know what to do about number 2 & 3 :huh:  Any suggestions please? :-"  Thanks Julie Quote Link to comment Share on other sites More sharing options...
lostndazed Posted February 21, 2007 Share Posted February 21, 2007 1) I can't read the above code or understand what it means, but when I tried to validate I too had the <image> error. Do I amend the code as above on line 168-173 on /rss.php  I beleive that will virtually remove the image from the feed, which is one way to get it to validate.  2) My links are showing the oscsid & although it has been mentioned in this thread, I can't see an answer to it? Any suggestions? Is an issue or not? Maybe it is customer related & so different for everyone...& maybe not blink.gif  Go into your admin/configuration.php. In the box on the left, there should be a link called sessions. Click that. At the next page, make sure where it says, Prevent Spider Sessions is set to True. YOu might also want to check the contributions area to see that you have an updated spiders.txt.  3) In admin/configuration/maximum values/search results I already had it set for 20. On first subscribing to my feed I saw 20 new products. Then when I refreshed I saw 40/40 & the first 20 were repeated again. I have tried to refresh again but I don't get 60/60 etc. Again it has been mensioned but I can't see the answer to resolve it? What do I do about this one?  I haven't tested this, but saw it elsewhere in my search. In rss.php, about line 89 Find:  // Create SQL statement $category = $HTTP_GET_VARS['cPath']; if ($category != '') { // Check to see if we are in a subcategory if (strrpos($category, '_') > 0) { $category = substr($category, strrpos($category, '_') + 1, strlen($category)); } $sql = 'SELECT p.products_id, products_model, products_image, products_price, products_date_added, products_tax_class_id FROM products p, products_to_categories pc WHERE p.products_id = pc.products_id AND pc.categories_id = \'' . $category . '\' AND products_status=1 ORDER BY products_id DESC LIMIT ' . MAX_DISPLAY_SEARCH_RESULTS; } else { $sql = 'SELECT products_id, products_model, products_image, products_price, products_date_added, products_tax_class_id FROM products WHERE products_status=1 ORDER BY products_id DESC LIMIT ' . MAX_DISPLAY_SEARCH_RESULTS; }  Where it says MAX_DISPLAY_SEARCH_RESULTS change that to the number of items in your stock. That should bring up everything.  I REPEAT: I am merely recyling someone else's suggestion. I have no idea if it will actually work, but from what little I know of mySQL, I think it might work. Quote Link to comment Share on other sites More sharing options...
lostndazed Posted February 21, 2007 Share Posted February 21, 2007 Hello, I've searched the forums and could not find an answer to my problem, though a few other people seemed to have the same issue. So I'm posting to this lonely support forum again.  I have installed this contribution. It looked to be simple. I'm pretty good at following instructions and have installed others with no problem. Doesn't mean I haven't overlooked something, though.  I've made sure the white spaces were removed at the top and bottom of the file.  My Errors:  Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /path/to/my/file/rss.php:1) in /path/to/my/file/includes/functions/sessions.php on line 67 Warning: Cannot modify header information - headers already sent by (output started at /path/to/my/file/rss.php:1) in /path/to/my/file/rss.php on line 73  I've gone to my includes/functions/sessions.php LINE 66 & 67 are:  function tep_session_start() { return session_start();  So, that doesn't seem to be a problem. Then I check my rss.php file.  LINE 73 through 76 states: 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 ' . $store_name . ', generated on ' . date(r) . ' -->' . "\n";  I think that is telling me the same thing as the warning. The information was already sent and can't be modified.  OK, fair enough. So how do I fix this?  rss.php doesn't seem to have the <head> information in it. LINE 73 is about as close to a header as I can find. If I remove the following code:  // Début de l'envoi des données 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 ' . $store_name . ', generated on ' . date(r) . ' -->' . "\n";  Then, even by clearing the cache and closing/reopening my browser, I STILL get the error:  Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /path/to/my/file/rss.php:1) in /path/to/my/file/includes/functions/sessions.php on line 67  Is there a solution? Is anybody actually using this contribution successfully? Quote Link to comment Share on other sites More sharing options...
lostndazed Posted February 21, 2007 Share Posted February 21, 2007 I've searched "headers +already +sent". Â All I can find out is that the rss.php file is sending headers when the include/header.php has already sent headers. Â Is there a way to fix this this problem? Quote Link to comment Share on other sites More sharing options...
lostndazed Posted February 21, 2007 Share Posted February 21, 2007 I'm quitting for tonight. Will come back tomorrow. Quote Link to comment Share on other sites More sharing options...
lostndazed Posted February 21, 2007 Share Posted February 21, 2007 OK, I fibbed. This is just bugging me. Someone said they didn't have my error until they changed something (versions?) that had different character encoding. Â So I'm using the version that has charset of utf-8. And I'm wondering if that is what is clashing with my headers? I tried a very old version of a different RSS feed and it worked fine with no header problems. It didn't seem to support listing the products, so I can't use it, but it had the ISO-8859-1 charset that is specified in my html parameters in the header. Â Here's what I found about character encodings: Â "It is good practice to use the same encoding at all stages in document production, from text editing to display in a Web browser." Â I'm too tired to try to find an older version and update it to have the features I want, so I'll try again later. Good night. Quote Link to comment Share on other sites More sharing options...
lostndazed Posted February 21, 2007 Share Posted February 21, 2007 I'm curious. Can some one please explain to me why the latest RSS contribution has utf8_encode ? Isn't that a subset of ISO-8859-1? So what's the benefit? Seems like this RSS contribution is strictly for European sites? Quote Link to comment Share on other sites More sharing options...
lostndazed Posted February 21, 2007 Share Posted February 21, 2007 Well, here's what I've discovered so far. Â My DB uses utf8 encoding. Â The website HTTP header uses ISO-8859-1. Â If I use an old version of rss.php, I can get the RSS feed to work BUT, my database is full of "&" and the feed throws an error everytime it reaches one. Since it's doubtful that anyone uses R and B for R&B music, I'm pretty much scroot. Â I will need to find a way to make the utf8 encoding work with the rss.php feed without attempting to resend headers. Â JULIE: Thank you for your response. You are apparently using an older version of rss.php. Here's a possible solution for stopping the duplicates. Â In rss.php FIND: Â <?php // Create SQL statement if ($HTTP_GET_VARS['cPath'] != "") { $sql = "SELECT p.products_id, products_model, products_image, products_price, products_tax_class_id FROM products p, products_to_categories pc WHERE p.products_id = pc.products_id AND pc.categories_id = '" . $HTTP_GET_VARS['cPath'] . "' AND products_status=1 ORDER BY products_id DESC LIMIT " . MAX_DISPLAY_SEARCH_RESULTS; } else { $sql = "SELECT products_id, products_model, products_image, products_price, products_tax_class_id FROM products WHERE products_status=1 ORDER BY products_id DESC LIMIT " . MAX_DISPLAY_SEARCH_RESULTS; } Â Â REPLACE WITH: Â // Create SQL statement if ($HTTP_GET_VARS['cPath'] != "") { $sql = "SELECT p.products_id, products_model, products_image, products_price, products_date_added, products_tax_class_id FROM products p, products_to_categories pc WHERE p.products_id = pc.products_id AND pc.categories_id = '" . $HTTP_GET_VARS['cPath'] . "' AND products_status=1 ORDER BY products_id DESC LIMIT " . MAX_DISPLAY_SEARCH_RESULTS; } else { $sql = "SELECT products_id, products_model, products_image, products_price, products_date_added, products_tax_class_id FROM products WHERE products_status=1 ORDER BY products_id DESC LIMIT " . MAX_DISPLAY_SEARCH_RESULTS; } Â FIND: Â $price = $row["products_price"]; Â ADD UNDER IT Â $added = date(r,strtotime($row['products_date_added'])); Â FIND: Â echo "<item> <title>" . $name . "</title> <link>" . $link . "</link> <description>" . $desc . "</description> <price>" . $price . "</price>\n"; Â REPLACE WITH: Â echo "<item> <title>" . $name . "</title> <link>" . $link . "</link> <description>" . $desc . "</description> <price>" . $price . "</price> <pubDate>' . $added . '</pubDate>' \n"; Â That should take care of your duplication problem. Quote Link to comment Share on other sites More sharing options...
radders Posted February 21, 2007 Share Posted February 21, 2007 I did a bit of research on utf-8 encoding. I must say I have been unable to get an RSS feed to validate without using it. I think this is do do with all the illegal characters like single quotes and accents that don't get stripped out of the output by other php functions. On the other hand php doesn't handle utf-8 all that well because it produces multibyte characters and some of the built-in string functions are not multi-byte safe. Also, as you mention, the headers are then probably not consistent withe the content. I'm not sure what you mean about European only though. I thought it handled most languages. Â Well I only did some research. I didn't manage to solve the issue! Quote Link to comment Share on other sites More sharing options...
lostndazed Posted February 22, 2007 Share Posted February 22, 2007 I FINALLY can end this monologue. I wish someone would have jumped in with words of advice. Â I now have my rss feed working properly AND it validates AND it shows all current products in the db AND it doesn't duplicate the items, etc. Want to know how I did it all? Â Visit http://www.oscommerce.com/community/contributions,1513 and see the new contribution. Quote Link to comment Share on other sites More sharing options...
lostndazed Posted February 22, 2007 Share Posted February 22, 2007 Hey Radders! I didn't see your post. Thank you for your help in researching. Â I had added utf-8 encoding to the new contribution. I kind of figured out it was important when my data was causing the errors in the feed without utf-8 encoding. Quote Link to comment Share on other sites More sharing options...
warrenerjm Posted February 22, 2007 Share Posted February 22, 2007 JULIE: Thank you for your response. You are apparently using an older version of rss.php. Here's a possible solution for stopping the duplicates. In rss.php FIND:  <?php // Create SQL statement if ($HTTP_GET_VARS['cPath'] != "") { $sql = "SELECT p.products_id, products_model, products_image, products_price, products_tax_class_id FROM products p, products_to_categories pc WHERE p.products_id = pc.products_id AND pc.categories_id = '" . $HTTP_GET_VARS['cPath'] . "' AND products_status=1 ORDER BY products_id DESC LIMIT " . MAX_DISPLAY_SEARCH_RESULTS; } else { $sql = "SELECT products_id, products_model, products_image, products_price, products_tax_class_id FROM products WHERE products_status=1 ORDER BY products_id DESC LIMIT " . MAX_DISPLAY_SEARCH_RESULTS; } REPLACE WITH:  // Create SQL statement if ($HTTP_GET_VARS['cPath'] != "") { $sql = "SELECT p.products_id, products_model, products_image, products_price, products_date_added, products_tax_class_id FROM products p, products_to_categories pc WHERE p.products_id = pc.products_id AND pc.categories_id = '" . $HTTP_GET_VARS['cPath'] . "' AND products_status=1 ORDER BY products_id DESC LIMIT " . MAX_DISPLAY_SEARCH_RESULTS; } else { $sql = "SELECT products_id, products_model, products_image, products_price, products_date_added, products_tax_class_id FROM products WHERE products_status=1 ORDER BY products_id DESC LIMIT " . MAX_DISPLAY_SEARCH_RESULTS; }  FIND:  $price = $row["products_price"];  ADD UNDER IT  $added = date(r,strtotime($row['products_date_added']));  FIND:  echo "<item> <title>" . $name . "</title> <link>" . $link . "</link> <description>" . $desc . "</description> <price>" . $price . "</price>\n";  REPLACE WITH:  echo "<item> <title>" . $name . "</title> <link>" . $link . "</link> <description>" . $desc . "</description> <price>" . $price . "</price> <pubDate>' . $added . '</pubDate>' \n";  That should take care of your duplication problem. :thumbsup: :) :thumbsup: Thanks for taking the time to solve the unanswered problems. Much appreciated as I do not have the knowledge to make all but simple code changes.  Julie Quote Link to comment Share on other sites More sharing options...
bjhampe Posted February 27, 2007 Share Posted February 27, 2007 Any way to list all products added in the last 30 days? Also, would like to put the time in the actual time instead of 12:00. Â Thanks. Quote Link to comment Share on other sites More sharing options...
bjhampe Posted February 28, 2007 Share Posted February 28, 2007 Also, I used the new version and I am still getting duplicates. Â Thanks. Quote Link to comment Share on other sites More sharing options...
Guest Posted February 28, 2007 Share Posted February 28, 2007 I've searched "headers +already +sent". Â All I can find out is that the rss.php file is sending headers when the include/header.php has already sent headers. Â Is there a way to fix this this problem? Â Double check that there is not an extra empty line at the end of the file: a simple carriage return at the end may cause this. Quote Link to comment Share on other sites More sharing options...
lostndazed Posted March 3, 2007 Share Posted March 3, 2007 Double check that there is not an extra empty line at the end of the file: a simple carriage return at the end may cause this. Â pixclinic, that was the very first thing I checked. It did not fix my original problem. Quote Link to comment Share on other sites More sharing options...
lostndazed Posted March 3, 2007 Share Posted March 3, 2007 Barry, you might want to check your db to see that when you added the products, you are adding the date to the db. Both your issues should be solved with the any rss feed that has the date code in it IF your products have the date in the db. Â If the dates are there, then I'm sorry. I don't know any other answer. Quote Link to comment Share on other sites More sharing options...
warrenerjm Posted March 6, 2007 Share Posted March 6, 2007 Hi  I have just realised my feed is saying "Internet Explorer was unable to update this feed and will try again later." & showing very old products so this has been there for while! :blush: Just remembered I didn't get round to recoding as Lostndazed said for duplicates. :blush: :blush: I will do that tonight. :-"  Does anyone have an idea why my feed isn't updating please? It has validated.  Thanks Julie Quote Link to comment Share on other sites More sharing options...
warrenerjm Posted March 8, 2007 Share Posted March 8, 2007 JULIE: Thank you for your response. You are apparently using an older version of rss.php. Here's a possible solution for stopping the duplicates. In rss.php FIND:  <?php // Create SQL statement if ($HTTP_GET_VARS['cPath'] != "") { $sql = "SELECT p.products_id, products_model, products_image, products_price, products_tax_class_id FROM products p, products_to_categories pc WHERE p.products_id = pc.products_id AND pc.categories_id = '" . $HTTP_GET_VARS['cPath'] . "' AND products_status=1 ORDER BY products_id DESC LIMIT " . MAX_DISPLAY_SEARCH_RESULTS; } else { $sql = "SELECT products_id, products_model, products_image, products_price, products_tax_class_id FROM products WHERE products_status=1 ORDER BY products_id DESC LIMIT " . MAX_DISPLAY_SEARCH_RESULTS; }  I have this: // Create SQL statement $category = $HTTP_GET_VARS['cPath']; if ($category != '') { // Check to see if we are in a subcategory if (strrpos($category, '_') > 0) { $category = substr($category, strrpos($category, '_') + 1, strlen($category)); } $sql = 'SELECT p.products_id, products_model, products_image, products_price, products_tax_class_id FROM products p, products_to_categories pc WHERE p.products_id = pc.products_id AND pc.categories_id = \'' . $category . '\' AND products_status=1 ORDER BY products_id DESC LIMIT ' . MAX_DISPLAY_SEARCH_RESULTS; } else { $sql = 'SELECT products_id, products_model, products_image, products_price, products_tax_class_id FROM products WHERE products_status=1 ORDER BY products_id DESC LIMIT ' . MAX_DISPLAY_SEARCH_RESULTS; } REPLACE WITH:  // Create SQL statement if ($HTTP_GET_VARS['cPath'] != "") { $sql = "SELECT p.products_id, products_model, products_image, products_price, products_date_added, products_tax_class_id FROM products p, products_to_categories pc WHERE p.products_id = pc.products_id AND pc.categories_id = '" . $HTTP_GET_VARS['cPath'] . "' AND products_status=1 ORDER BY products_id DESC LIMIT " . MAX_DISPLAY_SEARCH_RESULTS; } else { $sql = "SELECT products_id, products_model, products_image, products_price, products_date_added, products_tax_class_id FROM products WHERE products_status=1 ORDER BY products_id DESC LIMIT " . MAX_DISPLAY_SEARCH_RESULTS; }  FIND:  $price = $row["products_price"];  I have this: $price = $row['products_price']; ADD UNDER IT  $added = date(r,strtotime($row['products_date_added']));  FIND:  echo "<item> <title>" . $name . "</title> <link>" . $link . "</link> <description>" . $desc . "</description> <price>" . $price . "</price>\n";  I have this: echo '<item>' . "\n"; echo ' <title>' , $name , '</title>' . "\n"; echo ' <link>' , $link , '</link>' . "\n"; echo ' <description>' . "\n"; echo $desc . "\n"; echo ' </description>' . "\n"; REPLACE WITH:  echo "<item> <title>" . $name . "</title> <link>" . $link . "</link> <description>" . $desc . "</description> <price>" . $price . "</price> <pubDate>' . $added . '</pubDate>' \n";  That should take care of your duplication problem. Hi again  Finally got round to doing this & I have a few differences. I think the first two are similar, but the third one is quite a bit different.  Have I got the right bits? Alternatively do you have the correct version of the rss.php & I just need to amend my bits please? :D  Thanks Julie Quote Link to comment Share on other sites More sharing options...
Ralph2 Posted March 14, 2007 Share Posted March 14, 2007 (edited) Duplicate items? Here's the solution: Â First the cause: Â Duplicate items within the RSS feed are caused due to the fact that the links within the feed contain a session ID (e.g. osCsid=some unique number). This means that each time the feed is reloaded by a feed reader, the links within the feed receive a new session ID. This causes a feed reader (like the feed reader function of IE 7) to "think": "Hey, those links are new. So, the items they are linking to must be new too. Let's add all the items as new / unread items. Oh, I'm so smart." Â Wrong! The links aren't new, only the session ID numbers at the end of the links are "new". Â Solution: Â Get rid of those session IDs at the end of the links of your feed. Just follow the following steps: Â Open rss.php and find: Â $link = tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $id); Â Replace with: Â $link = tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $id, 'NONSSL', false); Â 'NONSSL' tells the tep_href_link function to build a non SSL link, leave the NON out if you prefer a SSL link. And false tells the tep_href_link function to leave the session ID out of the link that has to be build. Â That's all folks! Edited March 14, 2007 by Ralph2 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.