Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[CONTRIBUTION] Latest News v1.0.0


Guest

Recommended Posts

http://www.oscommerce.com/downloads.php/co...ions,640/type,3

 

There are already a number of 'news' contributions that have been made for osCommerce. I tried all of these first, the following were the outcomes:

[*] one implored me _not_ to install it if my admin folder was installed in my catalog folder (which it is).

[*] the other two were in German, and BabelFish didn't translate them very well.

 

This contribution aims to alleviate all of these problems. It currently has the following features:

[*] News is stored in the database.

[*] News display on homepage -- achieved with a 'module' type interface, similar to the 'new products for ...' box that is already there.

[*] Doesn't display the module if there is no news to display.

[*] Number of news items to display can be configured from the existing administration interface.

[*] The news can be controlled from a new administration page that ties in both visually and behaviourally with the existing interface.

[*]Articles can be activated and deactivated -- If you write up an article then realise you put it up too soon, you don't have to re-type it!

 

Any problems with it, email me. Knowing my luck i forgot a file :P

Link to comment
Share on other sites

Hello Will,

 

I receive the following error on default.php:

 

1064 - You have an error in your SQL syntax near 'MAX_DISPLAY_LATEST_NEWS' at line 1

 

SELECT * from latest_news WHERE status = 1 ORDER BY date_added DESC LIMIT MAX_DISPLAY_LATEST_NEWS

 

Probably something is missing??

 

Regards,

Liesbeth

Link to comment
Share on other sites

I receive the following error on default.php:

 

1064 - You have an error in your SQL syntax near 'MAX_DISPLAY_LATEST_NEWS' at line 1

 

SELECT * from latest_news WHERE status = 1 ORDER BY date_added DESC LIMIT MAX_DISPLAY_LATEST_NEWS

 

Probably something is missing?

 

I don't think i missed anything. I just checked the file 'latest_news.sql' that i included with the package and the query to insert this was in there.

 

Are you sure that you loaded the file 'latest_news.sql' into your database via either mySQL or phpMyAdmin?

 

In case you missed it, the SQL file contains the following:

# Create the table to hold the latest news.

CREATE TABLE latest_news (

  news_id int(11) DEFAULT '0' NOT NULL auto_increment,

  headline varchar(255) NOT NULL,

  content text NOT NULL,

  date_added datetime DEFAULT '0000-00-00 00:00:00' NOT NULL,

  status tinyint(1) DEFAULT '0' NOT NULL,

  PRIMARY KEY (news_id)

);



# Insert some test data

INSERT INTO latest_news (

  headline,

  content,

  date_added,

  status

  ) VALUES (

  'Latest News v1.0.0',

  'If you can see this message, you have successfully installed the 'Latest News' contribution for osCommerce. Visit the administration area to remove this news item and add your own!',

  now();

  1

  );



# Insert configuration items into the configuration table.

INSERT INTO configuration (

  configuration_title,

  configuration_key,

  configuration_value,

  configuration_description,

  configuration_group_id,

  date_added

  ) VALUES (

  'Latest News',

  'MAX_DISPLAY_LATEST_NEWS',

  3,

  'maximum number of items to display in the Latest News box',

  3,

  NOW()

  );

Link to comment
Share on other sites

I've just installed this, and incase you've not sussed it, look below:

 

 

# Create the table to hold the latest news. 

CREATE TABLE latest_news ( 

  news_id int(11) DEFAULT '0' NOT NULL auto_increment, 

  headline varchar(255) NOT NULL, 

  content text NOT NULL, 

  date_added datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, 

  status tinyint(1) DEFAULT '0' NOT NULL, 

  PRIMARY KEY (news_id) 

); 



# Insert some test data 

INSERT INTO latest_news ( 

  headline, 

  content, 

  date_added, 

  status 

  ) VALUES ( 

  'Latest News v1.0.0', 

  'If you can see this message, you have successfully installed the 'Latest News' contribution for osCommerce. Visit the administration area to remove this news item and add your own!', 

  now(); <this semi-colan should be a comma> 

  1 

  ); 



# Insert configuration items into the configuration table. 

INSERT INTO configuration ( 

  configuration_title, 

  configuration_key, 

  configuration_value, 

  configuration_description, 

  configuration_group_id, 

  date_added 

  ) VALUES ( 

  'Latest News', 

  'MAX_DISPLAY_LATEST_NEWS', 

  3, 

  'maximum number of items to display in the Latest News box', 

  3, 

  NOW() 

  );

 

Cheers

John

 

www.itsupplies.net

Link to comment
Share on other sites

this is a handy module, I installed it ok after the database comma thing was corrected, I inserted some test news items and I am getting a date of Friday 31 January, 2003 for each news item?

 

regards

Link to comment
Share on other sites

Crap yes, I got the same, missed that one :(

 

Well after checking the DB, all dates are being recorded fine. So I checked the code where it displays it in /catalog/includes/modules/latest_news.php, at the bottom:

 

$info_box_contents[$row] = array('align' => 'left',

                                      'params' => 'class="smallText" valign="top"',

                                      'text' => '<b>' . $latest_news['headline'] . '</b> - <i>' . strftime(DATE_FORMAT_LONG, mktime($latest_news['date_added'])) . '</i><br>' . nl2br($latest_news['content']) . '<br>');

 

That date conversion looked at bit suss, so after checking other code I tried changing to this:

 

$info_box_contents[$row] = array('align' => 'left',

                                      'params' => 'class="smallText" valign="top"',

                                      'text' => '<b>' . $latest_news['headline'] . '</b> - <i>' .

 tep_date_long($latest_news['date_added']) . '</i><br>' . nl2br($latest_news['content']) . '<br>'

);

 

And bugger me it worked...!!!

 

This gives:

 

Forum Now Live! - Saturday 09 November, 2002

Please take time to visit our Forum.

 

New Products - Friday 08 November, 2002

Many new products to be added in the next few weeks. Mail us for a preview!

 

RS/6000's - Friday 08 November, 2002

Coming soon : IBM RS/6000's - 43p-140's (200mhz,233mhz,332mhz)

 

Or you can change it to 'tep_date_short' for:

 

Forum Now Live! - 11/09/2002

Please take time to visit our Forum.

 

New Products - 11/08/2002

Many new products to be added in the next few weeks. Mail us for a preview!

 

RS/6000's - 11/08/2002

Coming soon : IBM RS/6000's - 43p-140's (200mhz,233mhz,332mhz)

 

:)

 

John

www.itsupplies.net

Link to comment
Share on other sites

hehehe sorry about all that people.

 

The SQL to add a sample news item was added as an afterthought (i thought of it while i was packaging it up).

 

As per the post by 'Guyver', that date thing (which does look suss on re-examination) was taken from one of the existing modules (which one i can't remember). The fix you suggested will be incorporated when i next reboot.

 

Is there a working example of this great mod :) ?

First of all, thanks for the compliment!! i don't have an official site up as yet, my client's site will hopefully be going live very soon. It seems that Guyver / John has implemented this mod on his website -- so hopefully he won't mind me saying that, for the moment, the example can be found at http://www.itsupplies.net. (preemptive thanks for this John -- if i ever need a server -- which i hopefully will -- i will try and buy it from you).

 

In the next version of the mod, (to be released sometime in the next 48 hours), the following problems will be fixed:

[*] the date problem -- using the suggestions mentioned on this thread

[*] SQL file -- i will actually test it fully this time :)

As this will only be a patch release, i will not announce it via a new thread, but by adding a further post to this thread.

 

As for some requests via email:

 

... And I have a litle feature request could you build in a picture upload for in the news messages? ...

This is an extended feature that is not _desparately_ required. (basically my way of saying i am stupid, please explain in short simple words). If there is enough need for it, i will include it in a future release.

 

... I haven't tried it yet, but also, is there anyway you can change it (or maybe I can) so that it just lists all new things added (much like this contribution download page does) ...

As in similar to the 'new products for november' type deal that is already there? do you mean to give a list of all the products added for x previous days, linking to the product page? this would be a seperate mod ... but i could create it, yes.

Link to comment
Share on other sites

Will,

 

No worries, use my site as an example is fine, more visitors the better 8)

 

Glad I could help with the mod. Like others say, its a nice feature, I was doing it all via the 'define main page' by Burt (I think :)).

 

Thanks

 

John

Link to comment
Share on other sites

I've got the mod installed on my site also and after fixing the code (thx Guyver) the dates work like a charm! To see it check my site: http://www.unit9toy.com

 

Guyver, I have a question for you, how did you remove the text (welcom text) at the top of the page? I am trying to get rid of this myself but I'm not quite sure how. Thanks.

Link to comment
Share on other sites

Okay ... status update might be worthwhile.

 

The following features will be released in the next 24-48 hours:

* spanish translation

* date fix

* sql file fix

* the 'insert news' button for the admin

 

As this will include the spanish translation (Thanks to Emiliano Castano), it will be a point release, instead of a patch release. And as for the button ... i forgot to make it for the first release. hopefully PSP plays nice with the photoshop template.

Link to comment
Share on other sites

As I told you by mail it'd be nice to have this features:

 

*Short text news in default.php.. and a link to a full story file inside the site.. a master/detail page...

*The posibility to insert images..

 

 

Thanks in advance

 

Emiliano Casta?o

Link to comment
Share on other sites

Emliano,

 

Check the TODO list in v1.1.0, to be uploaded to the contributions area sometime tonight -- these features have made it in, as have your translations. thanks heaps!! i will post here when i have uploaded it!!

Link to comment
Share on other sites

  • 5 weeks later...
just for the record, my name is emiliano casta?o

I figured that, but the different character accents show up differently in some operating systems (especially in non-unicode fonts). For the readme file is it alright if i leave off the tilde (~)??

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