RSS Feed contribution support thread
#41
Posted 07 April 2007, 05:05
We place products in several categories. When this happens we end up with the same product listed several time in the rss feed. Is there any way to have the product show once in the rss feed even-though it is linked to several categories?
feed://www.thinkdifferentstore.com/rss.php
Thanks
Long Island, New York
#42
Posted 07 April 2007, 14:11
Roaddoctor, on Apr 4 2007, 09:13 AM, said:
Now with the new code. the dropdown appears, but with 3 identical statements... no indication of which link is for which language. So the customer is confused and sometimes selects the wrong language.
<?php
if (!isset($lng) || (isset($lng) && !is_object($lng))) {
include(DIR_WS_CLASSES . 'language.php');
$lng = new language;
}
reset($lng->catalog_languages);
while (list($key, $value) = each($lng->catalog_languages)) {
?>
<link rel="alternate" type="application/rss+xml" title="<?php echo STORE_NAME . ' - ' . BOX_INFORMATION_RSS; ?>" href="<?php echo tep_href_link(FILENAME_RSS, 'language=' . $key, 'NONSSL', false); ?>">
<?php
}
?>
any advice appreciated
Anybody? the code that worked is this
<?php
if (!isset($lng) || (isset($lng) && !is_object($lng))) {
include(DIR_WS_CLASSES . 'language.php');
$lng = new language;
}
reset($lng->catalog_languages);
while (list($key, $value) = each($lng->catalog_languages)) {
echo '<link rel="alternate" type="application/rss+xml" title="' . STORE_NAME . ' ' . BOX_INFORMATION_RSS . ' ' . $value['name'] . '" href="' . FILENAME_RSS . '?language=' . $key . '" />';
}
?>
is there any reason to not use the original code vs the updated?
Also - another bug - For the link in the information box, no matter what language I am in while browsing the store, the link always pops up english version...
Thanks for the help.
#43
Posted 07 April 2007, 18:33
@ mkelly1: I'm sorry, but I didn't have the time to work out something regarding the randomization of the feed. But I'll check it out as promised.
Quote
We place products in several categories. When this happens we end up with the same product listed several time in the rss feed. Is there any way to have the product show once in the rss feed even-though it is linked to several categories?
feed://www.thinkdifferentstore.com/rss.php
Thanks
Nice looking shop by the way. Anyway, tomorrow I'll add a new feature to the contribution, which will give the admin the possibility to decicde whether or not a certain product should be added to the feed simply by checking or unchecking a checkbox.
Quote
Also - another bug - For the link in the information box, no matter what language I am in while browsing the store, the link always pops up english version...
Tomorrow I'll look for a solution.
Regarding the info box issue: that particular link is build in an array, which makes it impossible to add the code needed for the verification of the languages. There are 2 solutions for this problem:
1 - Each language gets its own link.
2 (this'll look better) - Take the link out of the array and build it in a similar way as the footer link.
#44
Posted 08 April 2007, 15:34
Ralph2, on Apr 7 2007, 01:33 PM, said:
@ mkelly1: I'm sorry, but I didn't have the time to work out something regarding the randomization of the feed. But I'll check it out as promised.
Thanks for remembering Ralph. I'm patient
Michael
www.wholesaleplace.net
#45
Posted 08 April 2007, 16:13
Random products:
Find (in rss.php):
$sql = 'SELECT p.products_id, products_model, products_image, products_date_added 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_RSS_ARTICLES;
} else {
$sql = 'SELECT products_id, products_model, products_image, products_date_added FROM products WHERE products_status=1 ORDER BY products_id DESC LIMIT ' . MAX_RSS_ARTICLES;
}
Replace with:
$sql = 'SELECT p.products_id, products_model, products_image, products_date_added 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 RAND() DESC LIMIT ' . MAX_RSS_ARTICLES;
} else {
$sql = 'SELECT products_id, products_model, products_image, products_date_added FROM products WHERE products_status=1 ORDER BY RAND() DESC LIMIT ' . MAX_RSS_ARTICLES;
}
Add or remove products from a feed:
Please, check out v1.2.
NOTE: In case you've already ran adminsetting.sql, your DB might not accept adminsettings.sql because of duplicate data. In that case you can run the following sql in your DB:
ALTER TABLE products ADD products_to_rss TINYINT default '1' NOT NULL
Problematic link rel:
Replace the following:
<link rel="alternate" type="application/rss+xml" title="<?php echo STORE_NAME . ' - ' . BOX_INFORMATION_RSS; ?>" href="<?php echo tep_href_link(FILENAME_RSS, 'language=' . $key, 'NONSSL', false); ?>">
With:
<link rel="alternate" type="application/rss+xml" title="<?php echo STORE_NAME . ' - ' . BOX_INFORMATION_RSS; ?>" href="<?php echo FILENAME_RSS, '?language=' . $key; ?>">
The tep_href_link function might be the cause of the problematic link rel, I removed it and it seems to work fine. Please note that I can't test it on a shop with multiple languages, since my shop utilizes only 1 language.
Could you / someone please let me know whether the link rel works correctly with multiple languages now? Thanks!
Information box link:
Open catalog/includes/boxes/information.php file:
Find:
?> <!-- information //-->
Replace with:
if (!isset($lng) || (isset($lng) && !is_object($lng))) {
include(DIR_WS_CLASSES . 'language.php');
$lng = new language;
}
reset($lng->catalog_languages);
while (list($key, $value) = each($lng->catalog_languages)) {
?>
<!-- information //-->
Find:
$info_box_contents[] = array('text' => '<a href="' . tep_href_link(FILENAME_SHIPPING) . '">' . BOX_INFORMATION_SHIPPING . '</a><br>' .
'<a href="' . tep_href_link(FILENAME_PRIVACY) . '">' . BOX_INFORMATION_PRIVACY . '</a><br>' .
'<a href="' . tep_href_link(FILENAME_CONDITIONS) . '">' . BOX_INFORMATION_CONDITIONS . '</a><br>' .
'<a href="' . tep_href_link(FILENAME_CONTACT_US) . '">' . BOX_INFORMATION_CONTACT . '</a>');
Replace with:
$info_box_contents[] = array('text' => '<a href="' . tep_href_link(FILENAME_SHIPPING) . '">' . BOX_INFORMATION_SHIPPING . '</a><br>' .
'<a href="' . tep_href_link(FILENAME_PRIVACY) . '">' . BOX_INFORMATION_PRIVACY . '</a><br>' .
'<a href="' . tep_href_link(FILENAME_CONDITIONS) . '">' . BOX_INFORMATION_CONDITIONS . '</a><br>' .
'<a href="' . tep_href_link(FILENAME_CONTACT_US) . '">' . BOX_INFORMATION_CONTACT . '</a><br>' .
'<a href="' . FILENAME_RSS . '?language=' . $key . '">' . BOX_INFORMATION_RSS . '</a>');
Find:new infoBox($info_box_contents);
Replace with:
new infoBox($info_box_contents); }
The info box link appears to be working fine with a 1 language shop. Could you / someone please let me know whether the info box link works correctly with multiple languages now? Thanks!
Many thanks to all of you for your patience
#46
Posted 08 April 2007, 17:02
I downloaded the new version. I made the update in my DB manually. I'm lost trying to figure out how to add or remove products selectively. Other than update the DB was there more I needed to do as far as file changes?
The Problematic link rel: what file is it that needs changed?
I did the changes in the information.php and got the following error when I went the the store;
Quote
Again, THANKS so much
Michael
www.wholesaleplace.net
Edited by mkelly1, 08 April 2007, 17:03.
#47
Posted 08 April 2007, 19:25
Ralph2, on Apr 8 2007, 11:13 AM, said:
Problematic link rel:
Replace the following:
<link rel="alternate" type="application/rss+xml" title="<?php echo STORE_NAME . ' - ' . BOX_INFORMATION_RSS; ?>" href="<?php echo tep_href_link(FILENAME_RSS, 'language=' . $key, 'NONSSL', false); ?>">
With:
<link rel="alternate" type="application/rss+xml" title="<?php echo STORE_NAME . ' - ' . BOX_INFORMATION_RSS; ?>" href="<?php echo FILENAME_RSS, '?language=' . $key; ?>">
The tep_href_link function might be the cause of the problematic link rel, I removed it and it seems to work fine. Please note that I can't test it on a shop with multiple languages, since my shop utilizes only 1 language.
Could you / someone please let me know whether the link rel works correctly with multiple languages now? Thanks!
I dont think the tep_href_link was problematic, it was the inclusion of the language descriptor text in the drop down that was missing. This is working perfectly for me now on 3 language shop.
<link rel="alternate" type="application/rss+xml" title="<?php echo STORE_NAME . ' - ' . BOX_INFORMATION_RSS . ' ' . $value['name']; ?>" href="<?php echo FILENAME_RSS, '?language=' . $key; ?>">
Excellent support - Thanks Ralph!
I'll take a look at info box stuff next
#48
Posted 08 April 2007, 20:28
Ralph2, on Apr 8 2007, 11:13 AM, said:
Information box link:
Open catalog/includes/boxes/information.php file:
Find:
?> <!-- information //-->
Replace with:
if (!isset($lng) || (isset($lng) && !is_object($lng))) {
include(DIR_WS_CLASSES . 'language.php');
$lng = new language;
}
reset($lng->catalog_languages);
while (list($key, $value) = each($lng->catalog_languages)) {
?>
<!-- information //-->
Find:
$info_box_contents[] = array('text' => '<a href="' . tep_href_link(FILENAME_SHIPPING) . '">' . BOX_INFORMATION_SHIPPING . '</a><br>' .
'<a href="' . tep_href_link(FILENAME_PRIVACY) . '">' . BOX_INFORMATION_PRIVACY . '</a><br>' .
'<a href="' . tep_href_link(FILENAME_CONDITIONS) . '">' . BOX_INFORMATION_CONDITIONS . '</a><br>' .
'<a href="' . tep_href_link(FILENAME_CONTACT_US) . '">' . BOX_INFORMATION_CONTACT . '</a>');
Replace with:
$info_box_contents[] = array('text' => '<a href="' . tep_href_link(FILENAME_SHIPPING) . '">' . BOX_INFORMATION_SHIPPING . '</a><br>' .
'<a href="' . tep_href_link(FILENAME_PRIVACY) . '">' . BOX_INFORMATION_PRIVACY . '</a><br>' .
'<a href="' . tep_href_link(FILENAME_CONDITIONS) . '">' . BOX_INFORMATION_CONDITIONS . '</a><br>' .
'<a href="' . tep_href_link(FILENAME_CONTACT_US) . '">' . BOX_INFORMATION_CONTACT . '</a><br>' .
'<a href="' . FILENAME_RSS . '?language=' . $key . '">' . BOX_INFORMATION_RSS . '</a>');
Find:new infoBox($info_box_contents);
Replace with:
new infoBox($info_box_contents); }
The info box link appears to be working fine with a 1 language shop. Could you / someone please let me know whether the info box link works correctly with multiple languages now? Thanks!
Many thanks to all of you for your patience
Causing 3 of the entire infoboxes to appear in column
#49
Posted 09 April 2007, 14:24
I'm glad that random products works correct
mkelly1 said:
Nope, if you've updated your DB and the files correctly, then it should work.
I'm not using an English shop, so I'm not really sure about the names of the settings. But you'll get an idea of where to look:
Just go to your admin section -> Catalog -> Articles -> and edit or add an article. On the edit/add article page there should be a checkbox (Add this product to the RSS feed:) under the 'weight' textfield.
mkelly1 said:
It's that bit of code above the </head> tag within your php files of the catalog directory. The code that makes browsers light up or show their RSS icon. You need to change all of the files which contain the old code. Look for the files with the following bit of code in them:
<link rel="alternate" type="application/rss+xml" title="
mkelly1 said:
Oh, I think you've made a copy/paste mistake. No problem, according to Roaddoctor the code wasn't working correctly anyway. Just read my answer to Roaddoctor for the correct code.
@ David (Roaddoctor)
At least the link rel is working correct now
The new info box problem is probably caused because its whole code is now within the code of the language code. And the lang. code makes as many links as there are languages, which is now happening to the whole info box.
Anyway, I've some new code for the info box which automatically selects the current language as selected by the user.
Start with a 'fresh' information.php file and follow the following steps:
Find:
?> <!-- information //-->
Replace with:
// Recover the code (en, fr, etc) of the current language
if ($HTTP_GET_VARS['language'] == '') {
$lang_query = tep_db_query('select code from ' . TABLE_LANGUAGES . ' where directory = \'' . $language . '\'');
} else {
$cur_language = tep_db_output($HTTP_GET_VARS['language']);
$lang_query = tep_db_query('select code from ' . TABLE_LANGUAGES . ' where code = \'' . $cur_language . '\'');
}
$lang_a = tep_db_fetch_array($lang_query);
$lang_code = $lang_a['code'];
?>
<!-- information //-->
Find:
'<a href="' . tep_href_link(FILENAME_CONTACT_US) . '">' . BOX_INFORMATION_CONTACT . '</a>');
Replace with:
'<a href="' . tep_href_link(FILENAME_CONTACT_US) . '">' . BOX_INFORMATION_CONTACT . '</a><br>' . '<a href="' . FILENAME_RSS . '?language=' . $lang_code . '">' . BOX_INFORMATION_RSS . '</a>');
Despite the fact that I believe that this code works fine, could you please let me know whether that's also the case with a multi language shop? Thanks in advance
BTW, could you / someone please check whether the footer link works correctly with multiple languages? It should display 1 RSS icon (with a link based on the selected language) in the footer, but I've a feeling it'll display 1 RSS icon for each available language.
If the code from the installation guide (@ step 7) indeed causes multiple icons to appear in the footer, you might try the following code:
Open a 'fresh' catalog/includes/footer.php file and find:
require(DIR_WS_INCLUDES . 'counter.php');
Replace with:
require(DIR_WS_INCLUDES . 'counter.php');
if ($HTTP_GET_VARS['language'] == '') {
$lang_query = tep_db_query('select code from ' . TABLE_LANGUAGES . ' where directory = \'' . $language . '\'');
} else {
$cur_language = tep_db_output($HTTP_GET_VARS['language']);
$lang_query = tep_db_query('select code from ' . TABLE_LANGUAGES . ' where code = \'' . $cur_language . '\'');
}
$lang_a = tep_db_fetch_array($lang_query);
$lang_code = $lang_a['code'];
Find:
<td class="footer"> <?php echo strftime(DATE_FORMAT_LONG); ?> </td> <td align="right" class="footer"> <?php echo $counter_now . ' ' . FOOTER_TEXT_REQUESTS_SINCE . ' ' . $counter_startdate_formatted; ?> </td>
Replace with:
<td class="footer"> <?php echo strftime(DATE_FORMAT_LONG); ?> </td> <td align="center" class="footer"><a href="<?php echo FILENAME_RSS, '?language=' . $lang_code; ?>" title="<?php echo BOX_INFORMATION_RSS; ?>"><?php echo tep_image(DIR_WS_IMAGES . "icons/rss_icon.jpg" , STORE_NAME . " - " . BOX_INFORMATION_RSS); ?></a></td> <td align="right" class="footer"> <?php echo $counter_now . ' ' . FOOTER_TEXT_REQUESTS_SINCE . ' ' . $counter_startdate_formatted; ?> </td>
It would be really great if someone can verify whether this piece of code works correctly with a multi language shop! If the code works correct, then I can update the contribution knowing that it works correctly in combination with multi language shops. Thanks in advance!
#50
Posted 09 April 2007, 19:54
Ralph2, on Apr 9 2007, 09:24 AM, said:
At least the link rel is working correct now
The new info box problem is probably caused because its whole code is now within the code of the language code. And the lang. code makes as many links as there are languages, which is now happening to the whole info box.
Anyway, I've some new code for the info box which automatically selects the current language as selected by the user.
Start with a 'fresh' information.php file and follow the following steps:
Find:
?> <!-- information //-->
Replace with:
// Recover the code (en, fr, etc) of the current language
if ($HTTP_GET_VARS['language'] == '') {
$lang_query = tep_db_query('select code from ' . TABLE_LANGUAGES . ' where directory = \'' . $language . '\'');
} else {
$cur_language = tep_db_output($HTTP_GET_VARS['language']);
$lang_query = tep_db_query('select code from ' . TABLE_LANGUAGES . ' where code = \'' . $cur_language . '\'');
}
$lang_a = tep_db_fetch_array($lang_query);
$lang_code = $lang_a['code'];
?>
<!-- information //-->
Find:
'<a href="' . tep_href_link(FILENAME_CONTACT_US) . '">' . BOX_INFORMATION_CONTACT . '</a>');
Replace with:
'<a href="' . tep_href_link(FILENAME_CONTACT_US) . '">' . BOX_INFORMATION_CONTACT . '</a><br>' . '<a href="' . FILENAME_RSS . '?language=' . $lang_code . '">' . BOX_INFORMATION_RSS . '</a>');
Despite the fact that I believe that this code works fine, could you please let me know whether that's also the case with a multi language shop? Thanks in advance
That is working great now. Awesome!
One last question - for seo reasons, can that code be tweaked to NOT show the "?language=en" if it is english language?
thanks again
#51
Posted 09 April 2007, 20:16
Quote
CODE
'<a href="' . tep_href_link(FILENAME_CONTACT_US) . '">' . BOX_INFORMATION_CONTACT . '</a>');
Replace with:
CODE
'<a href="' . tep_href_link(FILENAME_CONTACT_US) . '">' . BOX_INFORMATION_CONTACT . '</a><br>' .
'<a href="' . FILENAME_RSS . '?language=' . $lang_code . '">' . BOX_INFORMATION_RSS . '</a>');
I did this and still had the same error. I found the problem. There was a "}" on the next line below this insert. I deleted it and all seems to be working good. More then likely I did a cut and paste error but you may want to check just in case.
I know I say this a lot but thanks so much.
#52
Posted 09 April 2007, 20:24
Quote
I don't have "Articles" in admin->Catalog-> I have "BOX_CATALOG_IMP_EXP" that when I click on it gives me an error. I will assume I messed up somewhere in the cut & pasting. Any chance you can lead me into the right direction of trouble shooting this?
Thanks
#53
Posted 09 April 2007, 21:41
mkelly1, on Apr 9 2007, 03:24 PM, said:
Thanks
#54
Posted 10 April 2007, 12:38
David said:
Via a .htaccess rewrite: didn't work.
Via a SEO contribution (e.g. Ultimate SEO URLs): should be possible, but I don't have the time to figure out how.
With some php: works, though it doesn't come up with a .html URL (like Ultimate SEO URLs does for example). But it does get rid of the "?language=en" part and it's very easy to implement.
I don't have the time to work it out completely, but the following should get you started (and it looks like it's working fine):
Open catalog/includes/filenames.php and add the following code to it (for each language):
define('FILENAME_RSS_EN', 'rss-english.php');
Then rename / copy rss.php to rss-english.php (repeat this step for each language).
Open for example catalog/index.php, go to the link rel code and replace:
<?php
if (!isset($lng) || (isset($lng) && !is_object($lng))) {
include(DIR_WS_CLASSES . 'language.php');
$lng = new language;
}
reset($lng->catalog_languages);
while (list($key, $value) = each($lng->catalog_languages)) {
?>
<link rel="alternate" type="application/rss+xml" title="<?php echo STORE_NAME . ' - ' . BOX_INFORMATION_RSS; ?>" href="<?php echo FILENAME_RSS, '?language=' . $key; ?>">
<?php
}
?>
With:
<?php
if (!isset($lng) || (isset($lng) && !is_object($lng))) {
include(DIR_WS_CLASSES . 'language.php');
$lng = new language;
}
reset($lng->catalog_languages);
while (list($key, $value) = each($lng->catalog_languages)) {
if ($key == 'en') {
$rss_link = FILENAME_RSS_EN
?>
<link rel="alternate" type="application/rss+xml" title="<?php echo STORE_NAME . ' - ' . BOX_INFORMATION_RSS; ?>" href="<?php echo $rss_link; ?>">
<?php
}
}
?>
Now the browser RSS icon should be linking to an URL which looks like: http://www.kjhsdflskdflsjkdf.com/rss-english.php.
The only thing you've to do is to get it working with multiple languages and the info box link. Good luck
@ Michael:
Good luck
#55
Posted 10 April 2007, 13:00
Quote
Good luck
#57
Posted 11 April 2007, 12:53
great contrib but i keep getting an rss error??? can anyboby help? my rss feed url is http://www.norfolklights.com/rss
#58
Posted 11 April 2007, 13:01
zarren, on Apr 11 2007, 01:53 PM, said:
great contrib but i keep getting an rss error??? can anyboby help? my rss feed url is http://www.norfolklights.com/rss
line 6, column 23: XML parsing error: <unknown>:6:23: not well-formed (invalid token)
here is the line in question:
<title>Norfolk Lights & Hydroponics Centre LTD</title>
#59
Posted 11 April 2007, 13:48
zarren, on Apr 11 2007, 02:01 PM, said:
line 6, column 23: XML parsing error: <unknown>:6:23: not well-formed (invalid token)
here is the line in question:
<title>Norfolk Lights & Hydroponics Centre LTD</title>
Hey I found why i was getting the first error,
first is:
line 320, column 0: description should not contain onclick attribute
next is:
Problematical RFC 822 date-time value: Wed, 4 Apr 2007 15:16:56 +0100 (20 occurrences)
help please!!!
ty in advance
#60
Posted 11 April 2007, 19:42
zarren, on Apr 11 2007, 02:48 PM, said:
first is:
line 320, column 0: description should not contain onclick attribute
next is:
Problematical RFC 822 date-time value: Wed, 4 Apr 2007 15:16:56 +0100 (20 occurrences)
help please!!!
ty in advance
Hey, I checked your feed output with a validator and it says the following:
This feed is valid, but may cause problems for some users. We recommend fixing these problems.
Don't worry, it works fine. I wouldn't bother to dive into the code for this. I've seen big websites with the same validator result.
About the '&' symbol, if you don't like using 'and' then try to use:
&
Maybe the validator takes it.














