Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

News Blog V1.0


natewlew

Recommended Posts

With some help I have found a problem with the /catalog/news.php.

Find:

$news_query = tep_db_query("select n.date_created, nd.name, nd.content from " . TABLE_NEWS . " n, " . TABLE_NEWS_DESC . " nd where n.id = $id and nd.language_id = '" . (int)$languages_id . "'");

Change it to:

$news_query = tep_db_query("select n.date_created, nd.name, nd.content from " . TABLE_NEWS . " n, " . TABLE_NEWS_DESC . " nd where nd.news_id = '" . (int)$id . "' and n.id = '" . (int)$id . "' and nd.language_id = '" . (int)$languages_id . "'");

Other great Open Source (Free) programs: (Free as in free speech not free beer)

The Gimp - An image program. | Firefox - All you have to do is add the Web Developer add-on to make this web browser complete. | FileZilla - An ftp program. | Inkscape - A good program to create images with. | Thunderbird - An email program. | Openoffice.org - An office suite that is compatible with MS Office. | Abiword - Another office suite. | Audacity - A sound recording tool. | ddp's Picks | Wordpress - An easy to use blogging software. | Joomla - An easy to use CMS that has ecommerce plug-ins. | Drupal - Another CMS

How do I find these programs? Google Search!

Link to comment
Share on other sites

Thanks!

 

I will have a new version that does not require manual editing for the multi languages. I also found a problem with the /catalog/rss.php in V 1.2.

Find:

$news_query_raw = tep_db_query("select nd.name, n.date_created, nd.content, n.id from " . TABLE_NEWS . " n, " . TABLE_NEWS_DESC . " nd where nd.language_id = '" . (int)$languages_id . "' order by n.id desc limit " . NEWS_RSS_ARTICLE);

Replace with:

$news_query_raw = tep_db_query("select nd.name, n.date_created, nd.content, n.id from " . TABLE_NEWS . " n, " . TABLE_NEWS_DESC . " nd where nd.language_id = '" . (int)$languages_id . "' and n.id = nd.news_id order by n.id desc limit " . NEWS_RSS_ARTICLE);
Edited by natewlew

Other great Open Source (Free) programs: (Free as in free speech not free beer)

The Gimp - An image program. | Firefox - All you have to do is add the Web Developer add-on to make this web browser complete. | FileZilla - An ftp program. | Inkscape - A good program to create images with. | Thunderbird - An email program. | Openoffice.org - An office suite that is compatible with MS Office. | Abiword - Another office suite. | Audacity - A sound recording tool. | ddp's Picks | Wordpress - An easy to use blogging software. | Joomla - An easy to use CMS that has ecommerce plug-ins. | Drupal - Another CMS

How do I find these programs? Google Search!

Link to comment
Share on other sites

hey guys

 

Just installed this mod and got this error in admin:

 

Fatal error: Call to undefined function: tep_reply() in /vhost/vhost5/n/o/r/norfolklights.com/www/catalog/admin/news.php on line 315

 

 

Can anybody help??

 

EDIT:

 

here is the code around lines 315:

			  <tr class="dataTableRow">
			<td class="dataTableContent"><?php echo tep_date_short($products['date_created']); ?></td>
			<td class="dataTableContent"><u><?php echo '<a href="' . tep_href_link(FILENAME_NEWS, 'action=edit&id=' . $products['id'] . '&page=' . $HTTP_GET_VARS['page'], 'NONSSL') . '">' . $products['name'] . '</a></u>'; ?></td>
			<td class="dataTableContent"><u><?php if ($products['replys'] > 0) echo '<a href="' . tep_href_link(FILENAME_NEWS, 'action=edit_reply&id=' . $products['id'] . '&page=' . $HTTP_GET_VARS['page'], 'NONSSL') . '">' . HEADING_REPLY . '</a></u>'; ?></td>
			<td class="dataTableContent" align="left" valign="bottom"><?php echo HEADING_REPLIES; ?> <?php echo $products['replys']; ?> <?php if (tep_reply($products['id'])) echo tep_image(DIR_WS_IMAGES . 'news.gif'); ?>
	</td>
		  </tr>

Edited by zarren
Link to comment
Share on other sites

In the readme.txt it says:

Open /catalog/admin/includes/fuctions/general.php and add this at the bottom, right above: ?>

 

function tep_reply($news_id) {

$reply_query = tep_db_query("select approved from " . TABLE_NEWS_REPLYS . " where news_id = '" . (int)$news_id . "'");

while ($reply = tep_db_fetch_array($reply_query)) {

$reply_test .= $reply['approved'];

}

if (preg_match("/0/", $reply_test)) {

return true;

} else {

return false;

}

}

This will fix your error.

 

 

I will be fixing the rss.php so it will validate. Thanks for bringing this to my attention.

Other great Open Source (Free) programs: (Free as in free speech not free beer)

The Gimp - An image program. | Firefox - All you have to do is add the Web Developer add-on to make this web browser complete. | FileZilla - An ftp program. | Inkscape - A good program to create images with. | Thunderbird - An email program. | Openoffice.org - An office suite that is compatible with MS Office. | Abiword - Another office suite. | Audacity - A sound recording tool. | ddp's Picks | Wordpress - An easy to use blogging software. | Joomla - An easy to use CMS that has ecommerce plug-ins. | Drupal - Another CMS

How do I find these programs? Google Search!

Link to comment
Share on other sites

I updated a fix for the invalid rss.

 

I still get a "Problematical RFC 822 date-time value". I do know the time is RFC 822. I think there is a extra space after the day. This is from the php date function.

 

Anyways the feed is now valid.

Other great Open Source (Free) programs: (Free as in free speech not free beer)

The Gimp - An image program. | Firefox - All you have to do is add the Web Developer add-on to make this web browser complete. | FileZilla - An ftp program. | Inkscape - A good program to create images with. | Thunderbird - An email program. | Openoffice.org - An office suite that is compatible with MS Office. | Abiword - Another office suite. | Audacity - A sound recording tool. | ddp's Picks | Wordpress - An easy to use blogging software. | Joomla - An easy to use CMS that has ecommerce plug-ins. | Drupal - Another CMS

How do I find these programs? Google Search!

Link to comment
Share on other sites

Many thanks Nate my feed is now working :-)

I changed one more thing in order to get the whole feed to show- using utf8_encode to sanitize some of the special characters that didn't get picked up by htmlentities. Maybe it was just my system that needed it but I mention it here in case anyone else gets a partial feed showing up.

Link to comment
Share on other sites

Many thanks Nate my feed is now working :-)

I changed one more thing in order to get the whole feed to show- using utf8_encode to sanitize some of the special characters that didn't get picked up by htmlentities. Maybe it was just my system that needed it but I mention it here in case anyone else gets a partial feed showing up.

In the admin you can change the amount of characters that show in each article. The default is 250. You can also change the amount of articles that show in the feed. The default is 10. If that is what you are talking about?

 

hehehe sorry i should try to slow down a bit and READ biggrin.gif the installation instructions!!!! whistling.gif blink.gif

No big deal :)

Edited by natewlew

Other great Open Source (Free) programs: (Free as in free speech not free beer)

The Gimp - An image program. | Firefox - All you have to do is add the Web Developer add-on to make this web browser complete. | FileZilla - An ftp program. | Inkscape - A good program to create images with. | Thunderbird - An email program. | Openoffice.org - An office suite that is compatible with MS Office. | Abiword - Another office suite. | Audacity - A sound recording tool. | ddp's Picks | Wordpress - An easy to use blogging software. | Joomla - An easy to use CMS that has ecommerce plug-ins. | Drupal - Another CMS

How do I find these programs? Google Search!

Link to comment
Share on other sites

Hope I havent left another part of the instructions lol but I still get an error when clicking to view the blog in admin...

 

Here is the error I get:

 

Fatal error: Call to undefined function: tep_get_news_name() in /vhost/vhost5/x/x/x/ywzywxz.com/xxx/catalog/admin/news.php on line 195

Edited by zarren
Link to comment
Share on other sites

This is in the same spot in the read_me.txt.

Open /catalog/admin/includes/fuctions/general.php and add this at the bottom, right above: ?>

 

function tep_get_news_name($name_id, $language_id = 0) {

global $languages_id;

 

if ($language_id == 0) $language_id = $languages_id;

$name_query = tep_db_query("select name from " . TABLE_NEWS_DESC . " where news_id = '" . (int)$name_id . "' and language_id = '" . (int)$language_id . "'");

$name = tep_db_fetch_array($name_query);

 

return $name['name'];

}

 

function tep_get_news_content($news_id, $language_id) {

$news_query = tep_db_query("select content from " . TABLE_NEWS_DESC . " where news_id = '" . (int)$news_id . "' and language_id = '" . (int)$language_id . "'");

$news = tep_db_fetch_array($news_query);

 

return $news['content'];

}

Edited by natewlew

Other great Open Source (Free) programs: (Free as in free speech not free beer)

The Gimp - An image program. | Firefox - All you have to do is add the Web Developer add-on to make this web browser complete. | FileZilla - An ftp program. | Inkscape - A good program to create images with. | Thunderbird - An email program. | Openoffice.org - An office suite that is compatible with MS Office. | Abiword - Another office suite. | Audacity - A sound recording tool. | ddp's Picks | Wordpress - An easy to use blogging software. | Joomla - An easy to use CMS that has ecommerce plug-ins. | Drupal - Another CMS

How do I find these programs? Google Search!

Link to comment
Share on other sites

  • 2 weeks later...

ok i installled everything as it should be done. the admin side is working fine however i want to have a link on my store that points to news.php . When i try to run news.php i get this error

 

 

Fatal error: Cannot redeclare tep_show_category() (previously declared in /home/asta/public_html/store/includes/header.php:147) in /home/asta/public_html/store/includes/boxes/categories.php on line 13

 

please let me know.

Thanks

Link to comment
Share on other sites

I am not sure what that is. tep_show_category() is not something I put in the news.php. Did you make any modifications?

Other great Open Source (Free) programs: (Free as in free speech not free beer)

The Gimp - An image program. | Firefox - All you have to do is add the Web Developer add-on to make this web browser complete. | FileZilla - An ftp program. | Inkscape - A good program to create images with. | Thunderbird - An email program. | Openoffice.org - An office suite that is compatible with MS Office. | Abiword - Another office suite. | Audacity - A sound recording tool. | ddp's Picks | Wordpress - An easy to use blogging software. | Joomla - An easy to use CMS that has ecommerce plug-ins. | Drupal - Another CMS

How do I find these programs? Google Search!

Link to comment
Share on other sites

My breadcrumb is showing "NAVBAR_TITLE" rather than "news" when I am on the news page. Does anyone know why?

(It might be only for me because I corrected the typo of "replys" to "replies" on every page and instruction that I found it - I may have missed one or two.) :blush:

Also, is there a way to disable users adding comments-not even showing that viewers can add comments. I would like it just as a news section for my site, without the ability of anyone to add comments.

 

Thanksk

Link to comment
Share on other sites

Hi,

I installed the latest version, and while it seems I can read and post news on my site, I get an error when I try to access news in the admin control panel. When I go to tools and click on "news", I get this error:

 

Not Found

The requested URL /catalog/admin/FILENAME_NEWS was not found on this server.

 

Any ideas why? :huh:

 

Thanks!

Link to comment
Share on other sites

You will find this in the read_me.txt:

Open /catalog/admin/includes/filenames.php and add this line at the bottom, right above: ?>

 

define('FILENAME_NEWS', 'news.php');

define('FILENAME_RSS', 'rss.php');

This should fix your problem.

Other great Open Source (Free) programs: (Free as in free speech not free beer)

The Gimp - An image program. | Firefox - All you have to do is add the Web Developer add-on to make this web browser complete. | FileZilla - An ftp program. | Inkscape - A good program to create images with. | Thunderbird - An email program. | Openoffice.org - An office suite that is compatible with MS Office. | Abiword - Another office suite. | Audacity - A sound recording tool. | ddp's Picks | Wordpress - An easy to use blogging software. | Joomla - An easy to use CMS that has ecommerce plug-ins. | Drupal - Another CMS

How do I find these programs? Google Search!

Link to comment
Share on other sites

Thanks! I somehow missed that page.... :rolleyes:

 

But now when I click "news" in the admin tools, a page comes up that just has the word "News" at the top left and a blank, grayed out drop down menu at the top right. That's it. I see no options presented to change any settings.

Geez, did I miss something else?

Link to comment
Share on other sites

Well, my joy was short lived-

when I go to admin / configuration / news blog it works fine.

But there is still nothing in admin / tools/ news. I assume this is where the admin can post news and delete/edit user posts. This might come in handy. ;)

Any ideas on what might be wrong?

Thanks!

Link to comment
Share on other sites

Did you make any changes to the admin/news.php?

Other great Open Source (Free) programs: (Free as in free speech not free beer)

The Gimp - An image program. | Firefox - All you have to do is add the Web Developer add-on to make this web browser complete. | FileZilla - An ftp program. | Inkscape - A good program to create images with. | Thunderbird - An email program. | Openoffice.org - An office suite that is compatible with MS Office. | Abiword - Another office suite. | Audacity - A sound recording tool. | ddp's Picks | Wordpress - An easy to use blogging software. | Joomla - An easy to use CMS that has ecommerce plug-ins. | Drupal - Another CMS

How do I find these programs? Google Search!

Link to comment
Share on other sites

You could try this contrib: http://www.oscommerce.com/community/contributions,3081

 

It displays rss news feeds in an info box. You could display your own rss feed. It doesn't add any database tables and I don't believe it will conflict with the news blog.

Other great Open Source (Free) programs: (Free as in free speech not free beer)

The Gimp - An image program. | Firefox - All you have to do is add the Web Developer add-on to make this web browser complete. | FileZilla - An ftp program. | Inkscape - A good program to create images with. | Thunderbird - An email program. | Openoffice.org - An office suite that is compatible with MS Office. | Abiword - Another office suite. | Audacity - A sound recording tool. | ddp's Picks | Wordpress - An easy to use blogging software. | Joomla - An easy to use CMS that has ecommerce plug-ins. | Drupal - Another CMS

How do I find these programs? Google Search!

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