Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Banners Opening in Same Window


1Putts

Recommended Posts

Posted

I have my banner ads pointing towards specific product pages within the OSC site. It works fine except that it opens a new window (sort of like target="_blank"). I can see how this is useful when you're pointing towards a manufacturers site for example. But I'd rather it behave more like target="_self"

 

I'm guessing I have to modify the included redirect.php code somehow. Any advice is appreciated. TIA.

switch ($HTTP_GET_VARS['action']) {
   case 'banner':
     $banner_query = tep_db_query("select banners_url from " . TABLE_BANNERS . " where banners_id = '" . (int)$HTTP_GET_VARS['goto'] . "'");
     if (tep_db_num_rows($banner_query)) {
       $banner = tep_db_fetch_array($banner_query);
       tep_update_banner_click_count($HTTP_GET_VARS['goto']);

       tep_redirect($banner['banners_url']);
     }
     break;

Posted

Never mind, I found it. It's located in the /includes/functions/banner.php file...right where it says "target=_blank" Duh.

 

Just change it to "target=_self" and bam.

 

PS. This doesn't make the manufacturers link open in the same window (which is good).

Posted

Pat;

 

Helpful tip... thank you!

 

What would be another improvement would be to be able to dictate whether you wanted to open in the same window or in a new window, allowing you to have a mixture of banners pointing to your own site and others pointing to outside sites.

 

I'm also curious as to whether the ones opening in the same page retain the users session ID or not???

... if you want to REALLY see something that doesn't set up right out of the box without some tweaking,

try being a Foster Parent!

Posted
Pat;

 

Helpful tip... thank you!

 

What would be another improvement would be to be able to dictate whether you wanted to open in the same window or in a new window, allowing you to have a mixture of banners pointing to your own site and others pointing to outside sites.

 

I'm also curious as to whether the ones opening in the same page retain the users session ID or not???

 

That would be nice - options for one behavior or another depending on the application are always nice. I'll have to search and see of there are any banner manager enhancements available.

 

Actually, now that you mention it, it's not keeping the Session ID. Hmm, that is a problem.

Posted
Actually, now that you mention it, it's not keeping the Session ID. Hmm, that is a problem.

 

Any help with this from anyone would be appreciated. This if some code from banner.php - any ideas on how to get it to maintain the Session ID? I thought the tep_href_link was supposed to do that. Thanks...

 

if (tep_not_null($banner['banners_html_text'])) {
     $banner_string = $banner['banners_html_text'];
   } else {
     $banner_string = '<a href="' . tep_href_link(FILENAME_REDIRECT, 'action=banner&goto=' . $banner['banners_id']) . '" target="_self">' . tep_image(DIR_WS_IMAGES . $banner['banners_image'], $banner['banners_title']) . '</a>';
   }

Posted

I'm with you... this would be really helpful, but I'm not sure how to code it.

 

I would think an 'if' statement that recognized whther the URL was external or from the same domain that the catalog is housed on would be possible.

 

The 2 files that seem to have anything to do with banners are /includes/functions/banner.php and /redirect.php - not sure which one should be altered to accomplish this.

... if you want to REALLY see something that doesn't set up right out of the box without some tweaking,

try being a Foster Parent!

  • 2 weeks later...
Posted

I'm still struggling with this problem. I can't figure out why it's dropping the SID when the redirect happens.

 

Is there a way of changing the behaviour from a banner redirect to just a standard product info redirect?

  • 3 weeks later...
Posted

I have a related question ( I think...)

How do I adjust the size of the pop-up window which comes up from clicking on the banner ?

I tried inserting some javascript in the redirect.php file, but it basically ignores it and opens a new window at full size. I want to make a smaller pop-up.

 

V

 

I'm still struggling with this problem. I can't figure out why it's dropping the SID when the redirect happens.

 

Is there a way of changing the behaviour from a banner redirect to just a standard product info redirect?

  • 1 year later...
Posted

hello,

 

i have try to make the link of a banner in the same windows with sesion-ID.

but i dont know, if this a good solution

but it works ;-)

 

in redirect.php on line 22

		tep_redirect($banner['banners_url'].'&' . $SID);

 

 

in banner.php

	  $banner_string = '<a href="' . tep_href_link(FILENAME_REDIRECT, 'action=banner&goto=' . $banner['banners_id']) . '" target="_self">' . tep_image(DIR_WS_IMAGES . $banner['banners_image'], $banner['banners_title']) . '</a>';

 

 

you can try this way and give me response if this a good solution

 

 

ty

 

 

phd4life

  • 8 months later...
Posted
hello,

 

i have try to make the link of a banner in the same windows with sesion-ID.

but i dont know, if this a good solution

but it works ;-)

 

in redirect.php on line 22

		tep_redirect($banner['banners_url'].'&' . $SID);

in banner.php

	  $banner_string = '<a href="' . tep_href_link(FILENAME_REDIRECT, 'action=banner&goto=' . $banner['banners_id']) . '" target="_self">' . tep_image(DIR_WS_IMAGES . $banner['banners_image'], $banner['banners_title']) . '</a>';

you can try this way and give me response if this a good solution

ty

phd4life

 

Hello! After searching these forums and a zillion other forums for the solution to this issue I finally found this post.

I am using the banner manager for internal advertising within the shop in question and needed the function to keep the oscid and open links in the same window. This seems to work perfectly, Thank you so much for your solution!

Torgil Benigh

----------------------------------------------------------------

  • 4 years later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...