You are here

function uc_product_administration in Ubercart 6.2

Same name and namespace in other branches
  1. 5 uc_product/uc_product.module \uc_product_administration()

Lists all products.

1 string reference to 'uc_product_administration'
uc_product_menu in uc_product/uc_product.module
Implements hook_menu().

File

uc_product/uc_product.admin.inc, line 11
Product administration menu items.

Code

function uc_product_administration() {
  $output = '';
  $header = array();
  $tbl_columns = uc_product_table_header();
  foreach ($tbl_columns as $column) {
    $header[] = $column['cell'];
  }
  $order = substr(tablesort_sql($header), 10);
  if (empty($_REQUEST['order'])) {
    $order = 'p.ordering, n.title, n.nid';
  }
  $nids = array();

  // Display 50 products per page.
  $types = "('" . implode("', '", uc_product_types()) . "')";
  $result = pager_query("SELECT n.nid, n.type FROM {node} AS n INNER JOIN {uc_products} AS p ON n.vid = p.vid WHERE n.type IN {$types} ORDER BY " . $order, 50, 0, NULL);
  while ($product = db_fetch_object($result)) {
    $nids[] = $product->nid;
  }
  $table = tapir_get_table('uc_product_table', $nids);

  // Display the product table and pager if necessary.
  $output .= drupal_render($table) . theme('pager');
  return $output;
}