Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Banner Click Trhough Percent


bjhampe

Recommended Posts

I have seached and have not found an answer to this one yet: Has anybody added a click through percent to the banner manager? I can figure it out manually but it would be easier to have it automatically displayed for all banners. Thanks in advance.

Link to comment
Share on other sites

Here is what I think I need to do:

 

-Add a new field in the banner_history table

-Peform the calculation (php or db?)

-Display the info

 

Is this the section of the php that I should be looking at:

 

<?php
   $banners_query_raw = "select banners_id, banners_title, banners_image, banners_group, status, expires_date, expires_impressions, date_status_change, date_scheduled, date_added from " . TABLE_BANNERS . " order by banners_title, banners_group";
   $banners_split = new splitPageResults($HTTP_GET_VARS['page'], MAX_DISPLAY_SEARCH_RESULTS, $banners_query_raw, $banners_query_numrows);
   $banners_query = tep_db_query($banners_query_raw);
   while ($banners = tep_db_fetch_array($banners_query)) {
     $info_query = tep_db_query("select sum(banners_shown) as banners_shown, sum(banners_clicked) as banners_clicked from " . TABLE_BANNERS_HISTORY . " where banners_id = '" . (int)$banners['banners_id'] . "'");
     $info = tep_db_fetch_array($info_query);

     if ((!isset($HTTP_GET_VARS['bID']) || (isset($HTTP_GET_VARS['bID']) && ($HTTP_GET_VARS['bID'] == $banners['banners_id']))) && !isset($bInfo) && (substr($action, 0, 3) != 'new')) {
       $bInfo_array = array_merge($banners, $info);
       $bInfo = new objectInfo($bInfo_array);
     }

     $banners_shown = ($info['banners_shown'] != '') ? $info['banners_shown'] : '0';
     $banners_clicked = ($info['banners_clicked'] != '') ? $info['banners_clicked'] : '0';

     if (isset($bInfo) && is_object($bInfo) && ($banners['banners_id'] == $bInfo->banners_id)) {
       echo '              <tr id="defaultSelected" class="dataTableRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_BANNER_STATISTICS, 'page=' . $HTTP_GET_VARS['page'] . '&bID=' . $bInfo->banners_id) . '\'">' . "\n";
     } else {
       echo '              <tr class="dataTableRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="document.location.href=\'' . tep_href_link(FILENAME_BANNER_MANAGER, 'page=' . $HTTP_GET_VARS['page'] . '&bID=' . $banners['banners_id']) . '\'">' . "\n";
     }
?>
               <td class="dataTableContent"><?php echo '<a href="javascript:popupImageWindow(\'' . FILENAME_POPUP_IMAGE . '?banner=' . $banners['banners_id'] . '\')">' . tep_image(DIR_WS_IMAGES . 'icon_popup.gif', 'View Banner') . '</a> ' . $banners['banners_title']; ?></td>
               <td class="dataTableContent" align="right"><?php echo $banners['banners_group']; ?></td>
               <td class="dataTableContent" align="right"><?php echo $banners_shown . ' / ' . $banners_clicked; ?></td>
               <td class="dataTableContent" align="right">

 

Any help is appreciated. Thanks.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...