ArtcoInc Posted May 28, 2015 Share Posted May 28, 2015 I wanted a vertical scrolling 'News' box. I started with @@De Dokta 's "Latest News Multilingual for 2.3.x and BD2334http://addons.oscommerce.com/info/9147I 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 More sharing options...
♥14steve14 Posted May 29, 2015 Share Posted May 29, 2015 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 Link to comment Share on other sites More sharing options...
ArtcoInc Posted May 29, 2015 Author Share Posted May 29, 2015 @@14steve14 http://addons.oscommerce.com/info/9318 Malcolm Link to comment Share on other sites More sharing options...
pmsmiers Posted May 29, 2015 Share Posted May 29, 2015 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 More sharing options...
ArtcoInc Posted May 29, 2015 Author Share Posted May 29, 2015 @@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 More sharing options...
pmsmiers Posted May 30, 2015 Share Posted May 30, 2015 @@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 More sharing options...
ArtcoInc Posted May 30, 2015 Author Share Posted May 30, 2015 I'll make a correction in the uploaded files ... Thanks! Malcolm Link to comment Share on other sites More sharing options...
tornrawks Posted December 13, 2017 Share Posted December 13, 2017 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? Link to comment Share on other sites More sharing options...
ArtcoInc Posted December 13, 2017 Author Share Posted December 13, 2017 @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 Link to comment Share on other sites More sharing options...
tornrawks Posted December 13, 2017 Share Posted December 13, 2017 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. Link to comment Share on other sites More sharing options...
ArtcoInc Posted December 13, 2017 Author Share Posted December 13, 2017 @tornrawks How many news items do you have? How long are each of them? Malcolm Link to comment Share on other sites More sharing options...
tornrawks Posted December 14, 2017 Share Posted December 14, 2017 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. Link to comment Share on other sites More sharing options...
ArtcoInc Posted December 14, 2017 Author Share Posted December 14, 2017 @tornrawks Can you try this ... add a couple more sentences to the second news item. Malcolm Link to comment Share on other sites More sharing options...
tornrawks Posted December 14, 2017 Share Posted December 14, 2017 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. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.