Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

RSS Feed contribution support thread


Ralph2

Recommended Posts

  • Replies 372
  • Created
  • Last Reply

Top Posters In This Topic

I am having a heck of a time with the SQL file attached in V1.0, its telling me I have a duplicate entry key 80. Any help would be appreciated..

 

Thanks.

 

 

Any help would be appreciated on this, I am trying to run a products feed from OSC to one of my other sites in RSS if there is another contrib please let me know .

 

Thanks

Link to comment
Share on other sites

Any help would be appreciated on this, I am trying to run a products feed from OSC to one of my other sites in RSS if there is another contrib please let me know .

 

Thanks

 

Here is the error I get.

 

Error

 

SQL query:

 

INSERT INTO configuration( configuration_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function )

VALUES (

'80', 'RSS Articles', 'MAX_RSS_ARTICLES', '20', 'Number of articles displayed by the RSS feed', '3', '25', '2007-03-14 22:15:35', '2007-03-14 22:15:35', NULL , NULL

)

 

MySQL said: Documentation

#1062 - Duplicate entry '80' for key 1

Link to comment
Share on other sites

I'm getting the same eror. The '80' entry currently is 'Shipping Cost'. What should we do about that ? Change the number for any one that isn't in use?

Here is the error I get.

 

Error

 

SQL query:

 

INSERT INTO configuration( configuration_id, configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, last_modified, date_added, use_function, set_function )

VALUES (

'80', 'RSS Articles', 'MAX_RSS_ARTICLES', '20', 'Number of articles displayed by the RSS feed', '3', '25', '2007-03-14 22:15:35', '2007-03-14 22:15:35', NULL , NULL

)

 

MySQL said: Documentation

#1062 - Duplicate entry '80' for key 1

Link to comment
Share on other sites

I changed 80 for a number not in use (166 in my case), I'll see if it works.

I'm getting the same eror. The '80' entry currently is 'Shipping Cost'. What should we do about that ? Change the number for any one that isn't in use?
Link to comment
Share on other sites

I have the new version working good. My question is - it has the same products in it every time I check it. I thought it changed automatically. Is there a way to put products in there I want or to make it update regularly? I'm new to this stuff. Please help educate myself. :)

Link to comment
Share on other sites

I have the new version working good. My question is - it has the same products in it every time I check it. I thought it changed automatically. Is there a way to put products in there I want or to make it update regularly? I'm new to this stuff. Please help educate myself. :)

 

 

I also notice that the products are listed in date order as they were adde3d to the site, is there anyway we can change this to category or random??

Link to comment
Share on other sites

Hello people, I see it's getting busy here :) Sorry for my late reply, but I didn't have the time to get back here sooner.

 

My answers to your questions:

 

I am having a heck of a time with the SQL file attached in V1.0, its telling me I have a duplicate entry key 80. Any help would be appreciated

 

Just follow effisk's advice (Post: #35), and you'll solve the problem.

 

Another solution:

 

Open the file adminsetting.sql and look for '80', just gradually increase this number (and run the SQL again after each increase) until your DB takes it.

 

I have the new version working good. My question is - it has the same products in it every time I check it. I thought it changed automatically. Is there a way to put products in there I want or to make it update regularly? I'm new to this stuff. Please help educate myself.

 

Each time you add new products to your shop, these will be automatically added to your feed. So, the feed updates automatically.

 

I also notice that the products are listed in date order as they were adde3d to the site, is there anyway we can change this to category or random??

 

It should be possible to hard code something like that in rss.php. But in the end it's the user's feed reader which sorts everything out based on the user's settings. Maybe there're feed readers out there which make it possible to randomize feeds. I know for sure that some feed readers can filter on categories, IE7's feed reader can do that for example.

 

In order to make it possible for feed readers to filter products on categories, I just updated the contribution: contribution

Edited by Ralph2
Link to comment
Share on other sites

Each time you add new products to your shop, these will be automatically added to your feed. So, the feed updates automatically.

 

I was hoping for something that would randomly pick items to list in the RSS.

Link to comment
Share on other sites

I've got a minor bug regarding this code. My shop runs 3 languages. In the 0.83 version, in IE and FF, when the RSS icon was clicked, a dropdown with 3 RSS feeds were listed, including text indicating which link was for which language...

 

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

-Dave

Link to comment
Share on other sites

HI

 

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

Link to comment
Share on other sites

I've got a minor bug regarding this code. My shop runs 3 languages. In the 0.83 version, in IE and FF, when the RSS icon was clicked, a dropdown with 3 RSS feeds were listed, including text indicating which link was for which language...

 

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.

-Dave

Link to comment
Share on other sites

Ok, time for a new round of advice :)

 

@ 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.

 

HI

 

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.

 

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...

 

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.

Link to comment
Share on other sites

Ok, time for a new round of advice :)

 

@ 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 :) I did go into the database and changed the add date to newer dates on products I wanted to have show in the RSS feed. It didn't work though :( So... I'm still waiting but have so much to keep me busy in the mean time. Again, thank you Ralph and I will keep my eye on the thread for any updates.

 

Michael

www.wholesaleplace.net

Link to comment
Share on other sites

Solutions:

 

 

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 :thumbsup:

Link to comment
Share on other sites

Thanks Ralph. It's randomly picking products. Made my day :)

 

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;

 

Parse error: parse error, unexpected ')' in \includes\boxes\information.php on line 33

 

Again, THANKS so much :)

 

Michael

www.wholesaleplace.net

Edited by mkelly1
Link to comment
Share on other sites

Solutions:

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

-Dave

Link to comment
Share on other sites

Solutions:

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 :thumbsup:

 

Causing 3 of the entire infoboxes to appear in column

-Dave

Link to comment
Share on other sites

@ Michael (mkelly1)

 

I'm glad that random products works correct :D

 

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?

 

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.

 

The Problematic link rel: what file is it that needs changed?

 

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="

 

I did the changes in the information.php and got the following error when I went the the store;

 

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 :thumbsup:

 

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 :thumbsup:

 

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!

Link to comment
Share on other sites

@ David (Roaddoctor)

 

At least the link rel is working correct now :thumbsup:

 

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 :thumbsup:

 

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

-Dave

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...