Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Changing links on the added banners


kori80

Recommended Posts

Hi everybody, under the section of header.php, I have 3 pictures/banners each individually rotate in 2 pictures and there are links attached to them. So there are total of 6 banners rotating. My problem is changing the links that are already in there. When I mouse over a banner it shows

 

.../redirect.php?action=banner&goto=3 and 4 5 6 for the other banners when they rotate..I checked the redirect.php and I was hoping to find the attached links in there but instead I found this...

 

require('includes/application_top.php');

 

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;

 

so then I checked the application_top.php cuz its the file has been called below..and found this associated lines...

 

require(DIR_WS_FUNCTIONS . 'banner.php');

tep_activate_banners();

tep_expire_banners();

 

then I checked banner.php...and found the redirect order but Im still not able to locate the links I want to alter. I know Its more like a php question than oscommerce but maybe someone could guide me to finding the links I want to change in what file.Thnx. Heres the part of the banner.php

 

function tep_set_banner_status($banners_id, $status) {

if ($status == '1') {

return tep_db_query("update " . TABLE_BANNERS . " set status = '1', date_status_change = now(), date_scheduled = NULL where banners_id = '" . (int)$banners_id . "'");

} elseif ($status == '0') {

return tep_db_query("update " . TABLE_BANNERS . " set status = '0', date_status_change = now() where banners_id = '" . (int)$banners_id . "'");

} else {

return -1;

}

}

 

////

// Auto activate banners

function tep_activate_banners() {

$banners_query = tep_db_query("select banners_id, date_scheduled from " . TABLE_BANNERS . " where date_scheduled != ''");

if (tep_db_num_rows($banners_query)) {

while ($banners = tep_db_fetch_array($banners_query)) {

if (date('Y-m-d H:i:s') >= $banners['date_scheduled']) {

tep_set_banner_status($banners['banners_id'], '1');

}

}

}

}

 

////

// Auto expire banners

function tep_expire_banners() {

$banners_query = tep_db_query("select b.banners_id, b.expires_date, b.expires_impressions, sum(bh.banners_shown) as banners_shown from " . TABLE_BANNERS . " b, " . TABLE_BANNERS_HISTORY . " bh where b.status = '1' and b.banners_id = bh.banners_id group by b.banners_id");

if (tep_db_num_rows($banners_query)) {

while ($banners = tep_db_fetch_array($banners_query)) {

if (tep_not_null($banners['expires_date'])) {

if (date('Y-m-d H:i:s') >= $banners['expires_date']) {

tep_set_banner_status($banners['banners_id'], '0');

}

} elseif (tep_not_null($banners['expires_impressions'])) {

if ( ($banners['expires_impressions'] > 0) && ($banners['banners_shown'] >= $banners['expires_impressions']) ) {

tep_set_banner_status($banners['banners_id'], '0');

}

}

}

}

}

 

////

// Display a banner from the specified group or banner id ($identifier)

function tep_display_banner($action, $identifier) {

if ($action == 'dynamic') {

$banners_query = tep_db_query("select count(*) as count from " . TABLE_BANNERS . " where status = '1' and banners_group = '" . $identifier . "'");

$banners = tep_db_fetch_array($banners_query);

if ($banners['count'] > 0) {

$banner = tep_random_select("select banners_id, banners_title, banners_image, banners_html_text from " . TABLE_BANNERS . " where status = '1' and banners_group = '" . $identifier . "'");

} else {

return '<b>TEP ERROR! (tep_display_banner(' . $action . ', ' . $identifier . ') -> No banners with group \'' . $identifier . '\' found!</b>';

}

} elseif ($action == 'static') {

if (is_array($identifier)) {

$banner = $identifier;

} else {

$banner_query = tep_db_query("select banners_id, banners_title, banners_image, banners_html_text from " . TABLE_BANNERS . " where status = '1' and banners_id = '" . (int)$identifier . "'");

if (tep_db_num_rows($banner_query)) {

$banner = tep_db_fetch_array($banner_query);

} else {

return '<b>TEP ERROR! (tep_display_banner(' . $action . ', ' . $identifier . ') -> Banner with ID \'' . $identifier . '\' not found, or status inactive</b>';

}

}

} else {

return '<b>TEP ERROR! (tep_display_banner(' . $action . ', ' . $identifier . ') -> Unknown $action parameter value - it must be either \'dynamic\' or \'static\'</b>';

}

 

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>';

}

 

tep_update_banner_display_count($banner['banners_id']);

 

return $banner_string;

}

Link to comment
Share on other sites

Don't you set up the links in the banner manager in the admin section? If you want the same banner with a different link just duplicate the banner and change the link in the banner manager.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...