BlazeSama Posted September 14, 2011 Posted September 14, 2011 Good day, Today I came across a little problem and I'm wondering if someone can help me with this. I'm working for a website owner who bought a template from templatemonster, such template does not include native Flash support, but this is not much of a problem because I've found a lot of topics regarding how to use flash in oscommerce. the problem is, this template uses a lot of modules that you enable and disable to change its look. This applies for the Main Banner which i think uses java script to generate banner slides. what i want to do is change that module so it stop calling in banners and have a flash a animation there, I've been trying to paste a lot of "how to add flash" codes in the module but noting seems to work or i just don't know how to code it correctly. an example of the website is this http://geovision-pa.com/ you can see the main banner sliding 3 images, in that space i would like a flash animation. the file that generate that code is called bm_looped_carousel.php and this is the code in that file. <?php /* $Id$ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2011 osCommerce Released under the GNU General Public License */ class bm_looped_carousel{ var $code = 'bm_looped_carousel'; var $group = 'boxes'; var $title; var $description; var $sort_order; var $enabled = false; function bm_looped_carousel() { $this->title = MODULE_BOXES_LOOPED_CAROUSEL_HEADER_TITLE; $this->description = MODULE_BOXES_LOOPED_CAROUSEL_HEADER_DESCRIPTION; $this->box_title = MODULE_BOXES_COIN_SLIDER_HEADER_BOX_TITLE; if ( defined('MODULE_BOXES_LOOPED_CAROUSEL_HEADER_STATUS') ) { $this->sort_order = MODULE_BOXES_LOOPED_CAROUSEL_HEADER_SORT_ORDER; $this->enabled = (MODULE_BOXES_LOOPED_CAROUSEL_HEADER_STATUS == 'True'); $this->group = 'looped_carousel'; } } function execute() { global $oscTemplate; $data = ''; $execute = false; if ( ($banner2 = tep_banner_exists('dynamic', 'banner2')) ){ $data1 .= '<div>'.tep_display_banner('static', $banner2).'</div>'; $execute = true; } if ( ($banner3 = tep_banner_exists('dynamic', 'banner3'))){ $data1 .= '<div>'.tep_display_banner('static', $banner3).'</div>'; $execute = true; } if ( ($banner4 = tep_banner_exists('dynamic', 'banner4'))){ $data1 .= '<div>'.tep_display_banner('static', $banner4).'</div>'; $execute = true; } $data .= ' <script type="text/javascript" charset="utf-8"> $(function(){ $(\'#loopedCarousel\').loopedCarousel(); }); </script> <div id="loopedCarousel"><div class="container"><div class="slides">'.$data1.'</div></div> <a href="#" class="previous2"></a> <a href="#" class="next2"></a> </div>'; if($execute){ $oscTemplate->addBlock($data, $this->group); } } function isEnabled() { return $this->enabled; } function check() { return defined('MODULE_BOXES_LOOPED_CAROUSEL_HEADER_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 Content Looped Carousel Module', 'MODULE_BOXES_LOOPED_CAROUSEL_HEADER_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_LOOPED_CAROUSEL_HEADER_CONTENT_PLACEMENT', 'Content Block', 'The module should be loaded in the header block only', '6', '1', 'tep_cfg_select_option(array(\'Content Block\'), ', 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_LOOPED_CAROUSEL_HEADER_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())"); } function remove() { tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); } function keys() { return array('MODULE_BOXES_LOOPED_CAROUSEL_HEADER_STATUS', 'MODULE_BOXES_LOOPED_CAROUSEL_HEADER_CONTENT_PLACEMENT', 'MODULE_BOXES_LOOPED_CAROUSEL_HEADER_SORT_ORDER'); } } ?> What i basically need is this module to stop calling in banners and have a flash animation there i wont be using banner manager so i don't care if i can just upload the flash somewhere and make it appear there in place of the carousel, the banner images are all 950x432px so the flash banner would be the same size, i would like some advice or someone to point me in the right direction of what do i need to modify since its not like a know a lot of PHP coding and i'm stuck with this. Thanks in advance.
hughesca Posted September 14, 2011 Posted September 14, 2011 Replace '.$data1.' in this line with your flash call.: <div id="loopedCarousel"><div class="container"><div class="slides">'.$data1.'</div></div> Hope this helps! Peace, Chris
hughesca Posted September 14, 2011 Posted September 14, 2011 Better yet...because you are just removing the call for the banner data, all the plug-in's functionality stays the same. You should be able to still add/remove it but one day you might want the banner rotation function again. So, just copy and then comment out the original code, past it below and replace '.$data1.' with your flash call and then if you ever want to go back, you can. Like so: $data .= ' <script type="text/javascript" charset="utf-8"> $(function(){ $(\'#loopedCarousel\').loopedCarousel(); }); </script> <!-- <div id="loopedCarousel"><div class="container"><div class="slides">'.$data1.'</div></div> --> <div id="loopedCarousel"><div class="container"><div class="slides"><embed>whatever you want here</embed></div></div> <a href="#" class="previous2"></a> <a href="#" class="next2"></a> </div>';
BlazeSama Posted September 14, 2011 Author Posted September 14, 2011 Better yet...because you are just removing the call for the banner data, all the plug-in's functionality stays the same. You should be able to still add/remove it but one day you might want the banner rotation function again. So, just copy and then comment out the original code, past it below and replace '.$data1.' with your flash call and then if you ever want to go back, you can. Like so: $data .= ' <script type="text/javascript" charset="utf-8"> $(function(){ $(\'#loopedCarousel\').loopedCarousel(); }); </script> <!-- <div id="loopedCarousel"><div class="container"><div class="slides">'.$data1.'</div></div> --> <div id="loopedCarousel"><div class="container"><div class="slides"><embed>whatever you want here</embed></div></div> <a href="#" class="previous2"></a> <a href="#" class="next2"></a> </div>'; Ok, that at least makes a lot of sense now, and sorry i don't understand a lot but as i said i don't know a lot of PHP coding, what i do more in that website is minimal adjustments so this is a real challenge for me. i tried the code but now the slide appears as a white empty box. (and about removing the banner call, that doesn't matter i backup all my files before modify them so if i ever want to get the original function back i can restore the backup, no problem with that.) Right now my flash is hosted in the following oscommerce dir "images/banners/main.swf" (it is a placeholder swf with 1 image at the moment) what should i need to do to to call in that swf file inside the <embed> code you write down there? as far as i know, there is no need to install any add on or anything special about inserting a flash in PHP i just don't get it right sometimes. also note that i had to remove the code <a href="#" class="previous2"></a> <a href="#" class="next2"></a> because i was still showing the arrows, what im trying to archive is to totally remove that script slide function and paste a SWF because with a flash movie i would have like infinite ways of recreate the sliding and even add more functionality and animations the default one seem way too limited. thanks.
BlazeSama Posted September 14, 2011 Author Posted September 14, 2011 Never mind in the end after a lot of experimenting with the code you gave me I managed to make the flash appear correctly http://geovision-pa.com/, now i just need to edit the flash and add my stuff which should be a breeze now. thank you very much for pointing me in the right direction. for reference this is the code I ended using. <?php /* $Id$ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2011 osCommerce Released under the GNU General Public License */ class bm_looped_carousel{ var $code = 'bm_looped_carousel'; var $group = 'boxes'; var $title; var $description; var $sort_order; var $enabled = false; function bm_looped_carousel() { $this->title = MODULE_BOXES_LOOPED_CAROUSEL_HEADER_TITLE; $this->description = MODULE_BOXES_LOOPED_CAROUSEL_HEADER_DESCRIPTION; $this->box_title = MODULE_BOXES_COIN_SLIDER_HEADER_BOX_TITLE; if ( defined('MODULE_BOXES_LOOPED_CAROUSEL_HEADER_STATUS') ) { $this->sort_order = MODULE_BOXES_LOOPED_CAROUSEL_HEADER_SORT_ORDER; $this->enabled = (MODULE_BOXES_LOOPED_CAROUSEL_HEADER_STATUS == 'True'); $this->group = 'looped_carousel'; } } function execute() { global $oscTemplate; $data = ''; $execute = true; if ( ($banner2 = tep_banner_exists('dynamic', 'banner2')) ){ $data1 .= '<div>'.tep_display_banner('static', $banner2).'</div>'; $execute = true; } if ( ($banner3 = tep_banner_exists('dynamic', 'banner3'))){ $data1 .= '<div>'.tep_display_banner('static', $banner3).'</div>'; $execute = true; } if ( ($banner4 = tep_banner_exists('dynamic', 'banner4'))){ $data1 .= '<div>'.tep_display_banner('static', $banner4).'</div>'; $execute = true; } $data .= ' <script type="text/javascript" charset="utf-8"> $(function(){ }); </script> <div id="loopedCarousel"><div class="container"><div align="middle"><embed src="http://avtech-pa.com/images/banners/main.swf" type="application/x-shockwave-flash" width="950" height="432"></embed></div></div> </div>'; if($execute){ $oscTemplate->addBlock($data, $this->group); } } function isEnabled() { return $this->enabled; } function check() { return defined('MODULE_BOXES_LOOPED_CAROUSEL_HEADER_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 Content Looped Carousel Module', 'MODULE_BOXES_LOOPED_CAROUSEL_HEADER_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_LOOPED_CAROUSEL_HEADER_CONTENT_PLACEMENT', 'Content Block', 'The module should be loaded in the header block only', '6', '1', 'tep_cfg_select_option(array(\'Content Block\'), ', 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_LOOPED_CAROUSEL_HEADER_SORT_ORDER', '0', 'Sort order of display. Lowest is displayed first.', '6', '0', now())"); } function remove() { tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')"); } function keys() { return array('MODULE_BOXES_LOOPED_CAROUSEL_HEADER_STATUS', 'MODULE_BOXES_LOOPED_CAROUSEL_HEADER_CONTENT_PLACEMENT', 'MODULE_BOXES_LOOPED_CAROUSEL_HEADER_SORT_ORDER'); } } ?> Yet again, thanks for your help
Recommended Posts
Archived
This topic is now archived and is closed to further replies.