You are here

function uc_cart_links_report in Ubercart 5

Same name and namespace in other branches
  1. 6.2 uc_cart_links/uc_cart_links.admin.inc \uc_cart_links_report()
  2. 7.3 uc_cart_links/uc_cart_links.admin.inc \uc_cart_links_report()
1 string reference to 'uc_cart_links_report'
uc_cart_links_menu in uc_cart_links/uc_cart_links.module
Implementation of hook_menu().

File

uc_cart_links/uc_cart_links.module, line 130
Allows store owners to create links to add products to carts and send customers on to checkout.

Code

function uc_cart_links_report() {
  $header = array(
    array(
      'data' => t('ID'),
      'field' => 'cart_link_id',
    ),
    array(
      'data' => t('Clicks'),
      'field' => 'clicks',
    ),
    array(
      'data' => t('Last click'),
      'field' => 'last_click',
      'sort' => 'desc',
    ),
  );
  $rows = array();
  $result = pager_query("SELECT * FROM {uc_cart_link_clicks}" . tablesort_sql($header), 25, 1);
  while ($data = db_fetch_object($result)) {
    $rows[] = array(
      check_plain($data->cart_link_id),
      $data->clicks,
      format_date($data->last_click, 'short'),
    );
  }
  if (empty($rows)) {
    $rows[] = array(
      array(
        'data' => t('No cart links have been tracked yet.'),
        'colspan' => 3,
      ),
    );
  }
  return theme('table', $header, $rows) . theme('pager', array(), 25, 1);
}