Jump to content
Latest News: (loading..)
ArtcoInc

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://forums.oscommerce.com/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://forums.oscommerce.com/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

 


If you are running the "official" osC 2.3.4 or 2.3.4.1 download, your installation is obsolete! Get the latest community-supported responsive "Frozen" release here

Share this post


Link to post
Share on other sites

The only thing wrong is that it is not uploaded to the addons area so no one will be able to find and use it.


REMEMBER BACKUP, BACKUP AND BACKUP

Before installing the official version of oscommerce first look at a responsive version here

It's very easy to over complicate what are simple things in life

Share this post


Link to post
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]

Share this post


Link to post
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


If you are running the "official" osC 2.3.4 or 2.3.4.1 download, your installation is obsolete! Get the latest community-supported responsive "Frozen" release here

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

I'll make a correction in the uploaded files ...

 

Thanks!

 

Malcolm


If you are running the "official" osC 2.3.4 or 2.3.4.1 download, your installation is obsolete! Get the latest community-supported responsive "Frozen" release here

Share this post


Link to post
Share on other sites

It seems to work as expected with one exception.  It just stops scrolling after the final item even when infiniteLoop: true has been defined (directly in the .js file, also in the function).

Anyone still use this and have a solution?

Share this post


Link to post
Share on other sites

@tornrawks

I have been using this on a live site for over two years. Can you check to see if you don't have an empty news item in your database?

Malcolm


If you are running the "official" osC 2.3.4 or 2.3.4.1 download, your installation is obsolete! Get the latest community-supported responsive "Frozen" release here

Share this post


Link to post
Share on other sites

Just checked (phpmyadmin) and there is nothing but the 2 items I've added for testing.

I didn't mention before should it matter...I'm using BS Edge, I believe it is the September master release.

Edited by tornrawks
Supply ocC version in use

Share this post


Link to post
Share on other sites

@tornrawks

How many news items do you have? How long are each of them?

Malcolm


If you are running the "official" osC 2.3.4 or 2.3.4.1 download, your installation is obsolete! Get the latest community-supported responsive "Frozen" release here

Share this post


Link to post
Share on other sites

Just two at the moment...one is longer - has to scroll the view full content.  Second one is one sentence. This is the one it halts on. 

I got kind of busy so I haven't been able to do much since with it.

Share this post


Link to post
Share on other sites

@tornrawks

Can you try this ... add a couple more sentences to the second news item.

Malcolm


If you are running the "official" osC 2.3.4 or 2.3.4.1 download, your installation is obsolete! Get the latest community-supported responsive "Frozen" release here

Share this post


Link to post
Share on other sites

I overlooked that as being the cause since another "longer" message did exist. 

Yes, it was the short message that caused it to halt.

Thanks, that had me chasing my tail for 2 days.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×