KADILO Posted April 15, 2015 Share Posted April 15, 2015 Hi Guys I need to change this addone to madule box. can you help me? Thanks Link to comment Share on other sites More sharing options...
ArtcoInc Posted April 20, 2015 Share Posted April 20, 2015 @@KADILO I have been working on this this afternoon, and have a rough version sort of working. Where would you want the 'News' to display? Left Column, Right Column, Header, Footer, or in the body? Malcolm Link to comment Share on other sites More sharing options...
KADILO Posted April 21, 2015 Author Share Posted April 21, 2015 Hi Malcolm I Would Like Display To Right Column in 2.3.4 BS Version. Thanks alot Link to comment Share on other sites More sharing options...
ArtcoInc Posted April 27, 2015 Share Posted April 27, 2015 @@KADILO See if this works. I've used the HTML Marquee command to make this scroll. It's a depreciated command, but still seems to work in all of the browsers I've tested. You could easily change it to use any other scrolling code you want. 0) As always, BACK UP ... BACK UP ... BACK UP ... BACK UP 1) Install the add-on. (personally, I did not want the news on the home page, so I skipped step 2.1) 2) Copy the code below into a new file: /catalog/includes/modules/boxes/bm_latest_news.php <?php /* $Id$ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2015 osCommerce Released under the GNU General Public License */ class bm_latest_news { var $code = 'bm_latest_news'; var $group = 'boxes'; var $title; var $description; var $sort_order; var $enabled = false; function bm_latest_news() { $this->title = MODULE_BOXES_LATEST_NEWS_TITLE; $this->description = MODULE_BOXES_LATEST_NEWS_DESCRIPTION; if ( defined('MODULE_BOXES_LATEST_NEWS_STATUS') ) { $this->sort_order = MODULE_BOXES_LATEST_NEWS_SORT_ORDER; $this->enabled = (MODULE_BOXES_LATEST_NEWS_STATUS == 'True'); switch (MODULE_BOXES_LATEST_NEWS_CONTENT_PLACEMENT) { case 'Left Column': $this->group = 'boxes_column_left'; break; default: $this->group = 'boxes_column_right'; } } } function execute() { global $languages_id, $oscTemplate; $data = '<div class="panel panel-default hidden-xs hidden-sm">' . ' <div class="panel-heading">' . MODULE_BOXES_LATEST_NEWS_BOX_TITLE . '</div>' . ' <div class="panel-body">' . ' <marquee direction="up" height="200" scrolldelay="250">' ; $lnews_query_raw = "select nec.content, nec.headline, ne.date_added, ne.status from " . TABLE_LATEST_NEWS . " ne left join " . TABLE_LATEST_NEWS_CONTENT . " nec on ne.news_id = nec.news_id where nec.language_id= '" . (int)$languages_id . "' and ne.status = 1 order by date_added DESC"; $lnews_query = tep_db_query($lnews_query_raw); while ($lnews = tep_db_fetch_array($lnews_query)) { $data .= ' <strong>' . ' <font size=2>' . ($lnews["headline"]) . ' </font>' . ' </strong>' . ' <br />' . sprintf(tep_date_short($lnews["date_added"])) . ' <br />' . ($lnews["content"]) . ' <hr >'; } $data .= ' </marquee>' . ' </div>' . '</div>'; $oscTemplate->addBlock($data, $this->group); } function isEnabled() { return $this->enabled; } function check() { return defined('MODULE_BOXES_LATEST_NEWS_STATUS'); } function install() { tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Latest News Module', 'MODULE_BOXES_LATEST_NEWS_STATUS', 'True', 'Do you want to add the module to your shop?', '6', '1', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Content Placement', 'MODULE_BOXES_LATEST_NEWS_CONTENT_PLACEMENT', 'Right Column', 'Should the module be loaded in the left or right column?', '6', '1', 'tep_cfg_select_option(array(\'Left Column\', \'Right Column\'), ', now())"); tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_BOXES_LATEST_NEWS_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '1', now())"); } function remove() { tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); } function keys() { return array('MODULE_BOXES_LATEST_NEWS_STATUS', 'MODULE_BOXES_LATEST_NEWS_CONTENT_PLACEMENT', 'MODULE_BOXES_LATEST_NEWS_SORT_ORDER'); } } 3) Copy the code below into a new file: /catalog/includes/languaqes/english/modules/boxes/bm_latest_news.php <?php /* osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Released under the GNU General Public License */ define('NAVBAR_TITLE', 'News'); define('HEADING_TITLE', 'News and Announcements'); define('TEXT_NO_LATEST_NEWS', 'There are no news.'); define('BOX_LATEST_NEWS', 'News'); define('TABLE_HEADING_LATEST_NEWS', 'Latest News'); define('TEXT_NEWS_DATE_ADDED', 'News of %s'); define('TEXT_DISPLAY_NUMBER_OF_NEWS', 'News <b>%d</b> to <b>%d</b> (of <b>%d</b>)'); define('TABLE_HEADING_LATEST_NEWS', 'Latest news'); define('MODULE_BOXES_LATEST_NEWS_TITLE', 'Latest News'); define('MODULE_BOXES_LATEST_NEWS_DESCRIPTION', 'Latest News'); define('MODULE_BOXES_LATEST_NEWS_BOX_TITLE', 'Latest News'); ?> 4) If you are using 234 Responsive Gold, you will have to make these changes: 4.1) In catalog/includes/modules/boxes/templates/information.php Insert before closing: </ul> </div> </div> <li><a href="<?php echo tep_href_link('latest_news.php'); ?>"><?php echo MODULE_BOXES_INFORMATION_BOX_NEWS; ?></a></li> 4.2) In catalog/includes/modules/content/footer/templates/links.php Insert before closing: </ul> </div> </div> <li><a href="<?php echo tep_href_link('latest_news.php'); ?>"><?php echo MODULE_BOXES_INFORMATION_BOX_NEWS; ?></a></li> 5) Install the new module through Admin. Create come content. Now watch the news scroll by ... Let me know how this works for you :) Malcolm Link to comment Share on other sites More sharing options...
KADILO Posted May 5, 2015 Author Share Posted May 5, 2015 Fantastic! It Work , Thanks Malcom Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.