Forums / General Questions / Banner Manager

Banner Manager

Views: 4,502

Results 21 to 26 of 26
30 Dec 2013, 6:41 PM
#21
rbarbour avatar

rbarbour

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??

Here is a link to what it should produce...

30 Dec 2013, 7:24 PM
#22
divavocals avatar

divavocals

Totally Zenned

Join Date:
Jan 2007
Location:
Los Angeles, California, United States
Posts:
10,011
Plugin Contributions:
3

Re: Banner Manager

rbarbour:

Here is a link to what it should produce...

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.

31 Dec 2013, 12:26 AM
#23
rbarbour avatar

rbarbour

Totally Zenned

Join Date:
Feb 2010
Posts:
2,159
Plugin Contributions:
10

Re: Banner Manager

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

31 Dec 2013, 5:34 AM
#24
rbarbour avatar

rbarbour

Totally Zenned

Join Date:
Feb 2010
Posts:
2,159
Plugin Contributions:
10

Re: Banner Manager

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
	});
31 Dec 2013, 1:03 PM
#25
balihr avatar

balihr

Totally Zenned

Join Date:
Oct 2008
Location:
Croatia
Posts:
1,807
Plugin Contributions:
22

Re: Banner Manager

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

31 Dec 2013, 7:43 PM
#26
rbarbour avatar

rbarbour

Totally Zenned

Join Date:
Feb 2010
Posts:
2,159
Plugin Contributions:
10

Re: Banner Manager

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!