Totally Zenned
- Join Date:
- Feb 2010
- Posts:
- 2,159
- Plugin Contributions:
- 10
Banner Manager
DivaVocals:
Nice.. As always you rock.. do you have a test site where one can see this in action??
Views: 4,502
Totally Zenned
DivaVocals:
Nice.. As always you rock.. do you have a test site where one can see this in action??
Totally Zenned
rbarbour:
Okay.. clearly there's some JS at work to support the transition effects.. Nice..
My Site - Zen Cart & WordPress integration specialist
I don't answer support questions via PM. Post add-on support questions in the support thread. The question & the answer will benefit others with similar issues.
Totally Zenned
DivaVocals:
Okay.. clearly there's some JS at work to support the transition effects.. Nice..
Of course, I use:
jQuery & the jQuery Cycle Plugin
I like it, each banner group has a transition option of:
scrollLeft,
scrollDown,
scrollRight,
scrollUp',
blindX,
blindY,
blindZ,
cover,
curtainX,
curtainY,
fade,
fadeZoom,
growX,
growY,
none,
scrollUp,
scrollDown,
scrollLeft,
scrollRight,
scrollHorz,
scrollVert,
shuffle,
slideX,
slideY,
toss,
turnUp,
turnDown,
turnLeft,
turnRight,
uncover,
ipe,
zoom
Totally Zenned
rbarbour:
Of course, I use:
jQuery & the jQuery Cycle Plugin
Plan to update to jQuery Cycle 2 Plugin which supports RWD (Responsive Web Design)
For anyone else interested in this thread and looking for this solution, here is my version, @balihr gave you the main part of the code, I just broke it down and added what I did:
Create a template file called tpl_jquery_banners.php and upload it to /includes/templates/YOUR_TEMPLATE/templates/
<?php
/**
* Plugin Template
*
* @package templateSystem
* @copyright Copyright 2003-2005 Zen Cart Development Team
* @copyright Portions Copyright 2003 osCommerce
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* Added by rbarbour (ZCAdditions.com), jQuery Banners (29)
*/
// removes $content .= '<br /><br />';
define('CONFIG_JQUERY_BANNERS', 'true');
// adds EXTRA div for jQuery Cycle Plugin
define('CONFIG_SHOW_JQUERY_BANNERS', 'true');
$content = "";
// select banners_group to be used
$new_banner_search = $find_banners;
// secure pages
switch ($request_type) {
case ('SSL'):
$my_banner_filter=" and banners_on_ssl= " . "1 ";
break;
case ('NONSSL'):
$my_banner_filter='';
break;
}
$sql = "select banners_id from " . TABLE_BANNERS . " where status = 1 " . $new_banner_search . $my_banner_filter . " order by banners_sort_order";
$banners = $db->Execute($sql);
// if no active banner in the specified banner group then the box will not show
$banner_cnt = 0;
// Removes div for jQuery Cycle Plugin (change value at top of this file)
if (CONFIG_SHOW_JQUERY_BANNERS == 'true') {
// $id was added to give each div a unique id for jQuery Cycle
$content .= '<div class="slider" id="slider' . $id . '">';
}
while (!$banners->EOF) {
$banner_cnt++;
$banner = $show_banner;
$content .= zen_display_banner('static', $banners->fields['banners_id']);
// add spacing between banners (change value at top of this file)
if ($banner_cnt < $banners->RecordCount() && CONFIG_JQUERY_BANNERS == 'false') {
$content .= '<br /><br />';
}
$banners->MoveNext();
}
// Removes div for jQuery Cycle Plugin (change value at top of this file)
if (CONFIG_SHOW_JQUERY_BANNERS == 'true') {
$content .= '</div>';
}
echo $content;
?>
Now you have 4 banners in /includes/templates/YOUR_TEMPLATE/common/tpl_main_page.php
&
1 banner in /includes/templates/YOUR_TEMPLATE/common/tpl_header.php
&
1 banner in /includes/templates/YOUR_TEMPLATE/common/tpl_footer.php
changing:
<?php
if (SHOW_BANNERS_GROUP_SET1 != '' && $banner = zen_banner_exists('dynamic', SHOW_BANNERS_GROUP_SET1)) {
if ($banner->RecordCount() > 0) {
?>
<div id="bannerOne" class="banners"><?php echo zen_display_banner('static', $banner); ?></div>
<?php
}
}
?>
to:
<?php
if (SHOW_BANNERS_GROUP_SET[B]1 [/B]!= '' && $banner = zen_banner_exists('dynamic', SHOW_BANNERS_GROUP_SET[B]1[/B])) {
if ($banner->RecordCount() > 0) {
$find_banners = zen_build_banners_group(SHOW_BANNERS_GROUP_SET[B]1[/B]);
$show_banner = zen_banner_exists('dynamic', SHOW_BANNERS_GROUP_SET[B]1[/B]);
$id = '[B]1[/B]';
?>
<div id="banner[B]One[/B]" class="banners"><?php require($template->get_template_dir('tpl_jquery_banners.php',DIR_WS_TEMPLATE, $current_page_base,'templates'). '/tpl_jquery_banners.php'); ?></div>
<?php
}
}
?>
Changing the code in RED for each banner group.
upload jQuery & jQuery Cycle 2
$id simply adds a unique # (i use same as group) to the div id added for jQuery Cycle 2
the jQuery is pretty straight forward create a jQuery_banners.js file, upload to (/includes/templates/YOUR_TEMPLATE/jQuery/)
$('#slider1') .cycle({
fx: 'uncover', // I showed acceptable values in thread #23
speed: 'slow',
timeout: 10000
});
or put it in /includes/templates/YOUR_TEMPLATE/common/html_header.php
but make sure to include
$(document).ready(function(){
//above code
});
Totally Zenned
OK, I just wrote a small novel in my reply and somehow it got reset when I tried to post... So frustrating...
Anyway, sorry to go MIA, I didn't subscribe to this thread. I'm glad the solution worked.
@rbarbour: Thanks for sharing the rest of the code, hopefully it will be useful for someone else...
Happy New Year, everyone!!!
My site - Pro ZC Help
My portfolio | My plugins
Totally Zenned
balihr:
OK, I just wrote a small novel in my reply and somehow it got reset when I tried to post... So frustrating...
Anyway, sorry to go MIA, I didn't subscribe to this thread. I'm glad the solution worked.
@rbarbour: Thanks for sharing the rest of the code, hopefully it will be useful for someone else...
Happy New Year, everyone!!!
No Problem,
Happy New Year Everyone, I shall return Next Year!
Tell staff why this post should be reviewed.