Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Addon - "Latest News" - Scrolling Box w/jQuery Mobile (f/ 234BS Gold)


Recommended Posts

I wanted a vertical scrolling 'News' box. I started with @@De Dokta 's "Latest News Multilingual for 2.3.x and BD2334

http://addons.oscommerce.com/info/9147

I converted it to a box, and enabled vertical scrolling using the HTML Marquee command. It worked ok.

Then, I was following @@De Dokta and @@auzStar go round and round with their conversion of the whats_new and specials modules to replace the Marquee command with javascript (or the Bootstrap carousel command).

 

http://www.oscommerce.com/forums/topic/399585-old-addon-do-not-fit-with-osc234bs/

 

So, I figured I'd try to adapt their javascript to my project. Using bits of code from all three examples from the above mentioned,  I finally have something that is working ...

 *** No files to edit !!! ***

 

Just copy, install, configure, and go !

 

Latest News jQuery Scroller.zip

 

Features:

 

* Control the location (left/right column), box size, scroll speed, and pause duration from within Admin.

 

* Automatically creates databases and menu choices during installation. Has the option to save or delete the database when un-installing.

 

* Manage (add/edit/delete) all the 'News' from within Admin.

 

Known Issues:

 

* There is a jerk in the scroll when each news item reaches the top of the screen. I do not know how to fix this.

 

* This module installs and uses the file:  /ext/jquery/jquery.scrollbox.min.js.  This is installed into your store using a separate header_tag file (see the enclosed instructions). If you already have a file with this name installed, you can see if this module will work with your existing file. Otherwise, some edits will be needed.

 

* There must be at least 2 active news items for this to scroll. In addition, each news item must be long enough so that there is always at least one news item still in cache left to display. This means that you will need either several news items, and/or that each news item must be several lines long, and/or the height of the news box can not be too tall.

 

For example: I can have 3 news items, and each is only one line of text. This will work if the box height is kept short, say, 100px. Any longer, and it will not scroll.

 

Another example: I can have 2 news items; one very long, and one only 1 line long. If the box height is too tall (say, 200px), it won't scroll since the both the end of the long news item and the short news item will be displayed in the box, and there's nothing new left in the scroll cache. The solution is to either add an additional news item, or make the 1 line news item longer, or to make the box shorter.

 

 

I have tried to make this module conform to all of the suggestions made in the Best Practices thread:

 

http://www.oscommerce.com/forums/topic/407530-addon-development-best-practices/

 

Please let me know if something's not working, or if you have any suggestions for improvement. B)

 

Malcolm

 

Link to comment
Share on other sites

I get the following fault when adding news :

 

1062 - Duplicate entry '4' for key 'PRIMARY'

insert into latest_news_content (headline, content, news_id, language_id) values ('test 1', 'test bericht', '4', '4')

[TEP STOP]

Link to comment
Share on other sites

@@pmsmiers

 

Let me know if this works ...

 

in catalog/includes/modules/boxes/bm_latest_news.php

 

Find:

    function install() {
      tep_db_query("CREATE TABLE IF NOT EXISTS latest_news (news_id int(11) NOT NULL auto_increment, date_added datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, status int(1) DEFAULT '0' NOT NULL, important int(1) DEFAULT '0', PRIMARY KEY (news_id))");

      tep_db_query("CREATE TABLE IF NOT EXISTS latest_news_content (news_id int(11) NOT NULL,language_id int(11) NOT NULL, headline varchar(255) NOT NULL,content text NOT NULL, PRIMARY KEY (news_id))");

Replace with:

    function install() {
      tep_db_query("CREATE TABLE IF NOT EXISTS latest_news (news_id int(11) NOT NULL auto_increment, date_added datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, status int(1) DEFAULT '0' NOT NULL, important int(1) DEFAULT '0', PRIMARY KEY (news_id))");

      tep_db_query("CREATE TABLE IF NOT EXISTS latest_news_content (news_id int(11) NOT NULL,language_id int(11) NOT NULL, headline varchar(255) NOT NULL,content text NOT NULL)");

Malcolm

Link to comment
Share on other sites

@@pmsmiers

 

Let me know if this works ...

 

in catalog/includes/modules/boxes/bm_latest_news.php

 

Find:

    function install() {
      tep_db_query("CREATE TABLE IF NOT EXISTS latest_news (news_id int(11) NOT NULL auto_increment, date_added datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, status int(1) DEFAULT '0' NOT NULL, important int(1) DEFAULT '0', PRIMARY KEY (news_id))");

      tep_db_query("CREATE TABLE IF NOT EXISTS latest_news_content (news_id int(11) NOT NULL,language_id int(11) NOT NULL, headline varchar(255) NOT NULL,content text NOT NULL, PRIMARY KEY (news_id))");

Replace with:

    function install() {
      tep_db_query("CREATE TABLE IF NOT EXISTS latest_news (news_id int(11) NOT NULL auto_increment, date_added datetime DEFAULT '0000-00-00 00:00:00' NOT NULL, status int(1) DEFAULT '0' NOT NULL, important int(1) DEFAULT '0', PRIMARY KEY (news_id))");

      tep_db_query("CREATE TABLE IF NOT EXISTS latest_news_content (news_id int(11) NOT NULL,language_id int(11) NOT NULL, headline varchar(255) NOT NULL,content text NOT NULL)");

Malcolm

Yes, after I deleted the tables in the database and used the above SQL commands to make the new tables it works like a charn.

 

Thanks

 

With regards,

Peter

Link to comment
Share on other sites

  • 2 years later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...