You are here

function uc_coupon_autocomplete_node in Ubercart Discount Coupons 6

Same name and namespace in other branches
  1. 5 uc_coupon.module \uc_coupon_autocomplete_node()
  2. 7.3 uc_coupon.admin.inc \uc_coupon_autocomplete_node()
  3. 7.2 uc_coupon.admin.inc \uc_coupon_autocomplete_node()
1 string reference to 'uc_coupon_autocomplete_node'
uc_coupon_menu in ./uc_coupon.module
Implementation of hook_menu().

File

./uc_coupon.admin.inc, line 817

Code

function uc_coupon_autocomplete_node($string) {
  $matches = array();
  $product_types = module_invoke_all('product_types');
  $result = db_query_range("SELECT nid, title FROM {node} WHERE type IN ('" . implode("','", $product_types) . "') AND title LIKE '%%%s%'", $string, 0, 10);
  while ($row = db_fetch_object($result)) {
    $title = check_plain($row->title);
    $matches[$title . ' [nid:' . $row->nid . ']'] = $title;
  }
  print drupal_to_js($matches);
  exit;
}