Andreas2003 Posted June 26, 2009 Posted June 26, 2009 Hi there, I have a question. I have placed a hyperlink to a friends' webpage. But I didn't use the banner manager. But now, I want to have the click statistics from that hyperlink updated in the banner statistic history. Therefore I have to add some code to the hyperlink. I saw that there is a function in the banner.php called "tep_update_display_count" and "tep_update_banner_click_count". The code for the hyperlink is very simple right now: <td><a rel="nofollow" target="_blank" href="http://www.domain.com"></td> Can someone please guide me a little bit, how the code has to be for counting the displays and the counts, like a real banner? I found the activation of the banner in the application_top.php, but that leads me no further. I know, that I have to set up that "virtual" banner in the database manually, in order to simulate a banner for the hyperlink and to have a banner-id, where the clicks can be added to. Is that possible or am I on the wrong way? Thank you very much in advance, Regards Andreas
germ Posted June 26, 2009 Posted June 26, 2009 Look at the code in /includes/functions/banner.php $banner_string = '<a href="' . tep_href_link(FILENAME_REDIRECT, 'action=banner&goto=' . $banner['banners_id']) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $banner['banners_image'], $banner['banners_title']) . '</a>'; Then in redirect.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; That's how osCommerce does it. If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you. "Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice." - Me - "Headers already sent" - The definitive help "Cannot redeclare ..." - How to find/fix it SSL Implementation Help Like this post? "Like" it again over there >
Andreas2003 Posted June 30, 2009 Author Posted June 30, 2009 So, first of all, thank you for your answer. The code still confuses me. I have set up a new banner with banner_id = 2 via admin. The banner is being displayed, so its activated correctly. Now I want to count clicks additionally on a specific hyperlink, so when someone clicks on that hyperlink, the same banner-id will get the click in addition to the normal banner display. The application_top checks if a banner is activated and give all banner-data to the function, is that right ? require(DIR_WS_FUNCTIONS . 'banner.php'); tep_activate_banners(); tep_expire_banners(); And the footer code is for displaying activated banners, right? <?php if ($banner = tep_banner_exists('dynamic', '468x50')) { ?> <br> <table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td align="center"><?php echo tep_display_banner('static', $banner); ?></td> </tr> </table> <?php } ?> Where is the function called in order to update the shown banners? The update function for clicks will get called when a banner is clicked, right? For the $banner_string: can I somehow manipulate the banner_string to call my banner-id = 2 as mentioned in my example above? Very confusing, thanks for any help, regards Andreas
Recommended Posts
Archived
This topic is now archived and is closed to further replies.