Forums / Basic Configuration / Banner set to No new window not working

Banner set to No new window not working

Started by ec_web on 13 Jan 2016, 2:38 PM · Views: 1,980

Results 1 to 11 of 11
13 Jan 2016, 2:38 PM
#1
ec_web avatar

ec_web

New Zenner

Join Date:
Feb 2011
Posts:
89
Plugin Contributions:
0

Banner set to No new window not working

Hello,
My site:
https://www.earthscauldron.com
I have all the banners (banners are a slide show on the home page) set to NOT open in a new window. They are all opening in a new window.
Any suggestions on what may be going on here?
Thanks so much!

13 Jan 2016, 7:21 PM
#2
kobra avatar

kobra

Black Belt

Join Date:
Aug 2005
Location:
Arizona
Posts:
31,500
Plugin Contributions:
4

Re: Banner set to No new window not working

in your admin > toold > banner manager screen - do all of your banners have a red "X" in the "New Window" box??

Zen-Venom Get Bitten

13 Jan 2016, 7:35 PM
#3
ec_web avatar

ec_web

New Zenner

Join Date:
Feb 2011
Posts:
89
Plugin Contributions:
0

Re: Banner set to No new window not working

kobra:

in your admin > toold > banner manager screen - do all of your banners have a red "X" in the "New Window" box??

Yes they do. Every one of them. I'm not sure what is happening.

13 Jan 2016, 8:30 PM
#4
carlwhat avatar

carlwhat

zennedOut

Join Date:
Nov 2005
Location:
los angeles
Posts:
2,974
Plugin Contributions:
8

Re: Banner set to No new window not working

you need to look at the code that generates the slideshow. the html <a> link has a target of _blank which most browsers will cause to open in a new window or tab.

i am unfamiliar with this template and more specifically the construction of the slideshow, but i would search for where _target is in the code and more specifically in the construction of that slideshow.

from your home page:

<li class="slide-2 activeslide" style="visibility: visible; opacity: 1;">
<a href="http://earthscauldron.com/index.php?main_page=redirect&action=banner&goto=17&zenid=7bi8jr7oshlssc96i86q2ka7c1" target="_blank">    
<img src="http://earthscauldron.com/images/banners/slide4.jpg" style="width: 1840px; height: 956.8px; left: 0px;">
</a>
</li>

author of square Webpay, now with Apple Pay and Google Pay.
mXworks
donations: venmo or paypal accepted.
premium consistent excellent support. available for hire.

13 Jan 2016, 10:19 PM
#5
ec_web avatar

ec_web

New Zenner

Join Date:
Feb 2011
Posts:
89
Plugin Contributions:
0

Re: Banner set to No new window not working

I found the line of code in includes/functions/banner.php
This:
Line #142 : $banner_string = '<a href="' . zen_href_link(FILENAME_REDIRECT, 'action=banner&goto=' . $banner->fields['banners_id']) . '" target="_blank">' . zen_image(DIR_WS_IMAGES . $banner->fields['banners_image'], $banner->fields['banners_title']) . '</a>';

How would I go about this. Do I comment it out or type something else there? Do I delete "target=_blank" altogether? I'm not sure what to do. Nothing else seems to be working that I've tried. Except breaking the slide show a few times :oops:

13 Jan 2016, 10:28 PM
#6
ec_web avatar

ec_web

New Zenner

Join Date:
Feb 2011
Posts:
89
Plugin Contributions:
0

Re: Banner set to No new window not working

I also found this on line 42:
if ($banner->fields['banners_open_new_windows'] == '1')
Does that '1' have anything to do with it?

13 Jan 2016, 10:49 PM
#7
design75 avatar

design75

Totally Zenned

Join Date:
Dec 2009
Location:
Amersfoort, The Netherlands
Posts:
2,862
Plugin Contributions:
5

Re: Banner set to No new window not working

My suspicion is that there is nothing wrong with the zc files, but that the slide-show script is the culprit. From what I can decipher, the script defaults all links to be target="blank"

14 Jan 2016, 12:41 AM
#8
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Banner set to No new window not working

I would agree that it is not the php code of ZC, though looking at least at one of the more recent versions there are more possibilities that target="_blank" and not that...

Another thought though kobra asked about the current state, can you confirm that the state can change of the banner, and then also compare the resulting source code differences to help further the troubleshoot.

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

14 Jan 2016, 1:43 AM
#9
carlwhat avatar

carlwhat

zennedOut

Join Date:
Nov 2005
Location:
los angeles
Posts:
2,974
Plugin Contributions:
8

Re: Banner set to No new window not working

the OP confirmed that the banners are turned off in the banner manager. perhaps EC's banners function has changed; perhaps it never worked in V1.5.1. i do not know.

the code the OP listed on line 42 suggests that the template may honor the flag associated with the banners opening in a new window; however if the banner link construction is being done on line 142, my guess is that the 100 lines of code is far too many for them to be related.

EC, i would compare your code to the following code around your line 142:

if ($banner->fields['banners_open_new_windows'] == '1') {
    $banner_string = '<a href="' . zen_href_link(FILENAME_REDIRECT, 'action=banner&goto=' . $banner->fields['banners_id']) . '" target="_blank">' . zen_image(DIR_WS_IMAGES . $banner->fields['banners_image'], $banner->fields['banners_title']) . '</a>';
} else {
    $banner_string = '<a href="' . zen_href_link(FILENAME_REDIRECT, 'action=banner&goto=' . $banner->fields['banners_id']) . '">' . zen_image(DIR_WS_IMAGES . $banner->fields['banners_image'], $banner->fields['banners_title']) . '</a>';
}

this is how it looks under v1.5.4 and it would seem to honor the flags mentioned above. if your code does not look like this, you should copy this code to replace your line 142 and see if that works.

line 42 should be left alone.... although i'm not really sure what it is doing up there.

on your single line, you code just change the following, but then your flags would not work (which is what is currently happening anyway):

//original line
$banner_string = '<a href="' . zen_href_link(FILENAME_REDIRECT, 'action=banner&goto=' . $banner->fields['banners_id']) . '" target="_blank">' . zen_image(DIR_WS_IMAGES . $banner->fields['banners_image'], $banner->fields['banners_title']) . '</a>';

//new line
$banner_string = '<a href="' . zen_href_link(FILENAME_REDIRECT, 'action=banner&goto=' . $banner->fields['banners_id']) . '" >' . zen_image(DIR_WS_IMAGES . $banner->fields['banners_image'], $banner->fields['banners_title']) . '</a>';

good luck!

author of square Webpay, now with Apple Pay and Google Pay.
mXworks
donations: venmo or paypal accepted.
premium consistent excellent support. available for hire.

14 Jan 2016, 2:41 AM
#10
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: Banner set to No new window not working

No, the op confirmed that the admin reflected an off condition... That is different than 1) transitioning from off to on or back, and 2) how the front end and this "non-functioning" feature relate...

As to the code provided above by the OP that is the code from ZC 1.5.1. http://github.com/zencart/zencart/blob/v151/includes/functions/banner.php. It does seem that one "solution" would be to upgrade (at least to take advantage of other options), but not likely to resolve this issue. Further, it seems as if the issue is more either in a javascript file (.js) or a database entry meaning that any developer's toolkit searches should target files other than .php for that content...

Also, by copying just the text of the identified line numbers would/could end up affecting operation to where if the option(s) aren't tracking properly then more issues could result... One issue is/would be is that if only those lines were duplicated then when the image should be popup it wouldn't do so because the target variable would still be empty... Reverse trouble...

Also, there is no indication about the history of this installation in particular the remaining parts of the posting tips...

ZC Installation/Maintenance Support <- Site
Contribution for contributions welcome...

14 Jan 2016, 11:59 AM
#11
ec_web avatar

ec_web

New Zenner

Join Date:
Feb 2011
Posts:
89
Plugin Contributions:
0

Re: Banner set to No new window not working

Design75:

My suspicion is that there is nothing wrong with the zc files, but that the slide-show script is the culprit. From what I can decipher, the script defaults all links to be target="blank"

Success!!! :clap::clap::clap:
It was in the slide show script. every one was set to target="_blank. I changed them all (after saving a copy of the original in my files just in case) to read target="_self

It seems to have fixed the problem without messing anything else up or corrupting anything.
If someone wouldn't mind looking at my site again and letting me know that it looks right to you now also, I would greatly appreciate it!
I appreciate all of your time and energy and suggestions here. I wouldn't have been able to figure it out without you :) You are all truly a blessing on this forum.