function uc_order_load_product_select in Ubercart 5
Same name and namespace in other branches
- 6.2 uc_order/uc_order.admin.inc \uc_order_load_product_select()
When the Catalog module or uBrowser aren't enabled, use this product select.
1 string reference to 'uc_order_load_product_select'
- uc_order_menu in uc_order/
uc_order.module - Implementation of hook_menu().
File
- uc_order/
uc_order.module, line 1934
Code
function uc_order_load_product_select($order_id) {
foreach (module_invoke_all('product_types') as $type) {
$typestr .= "'{$type}', ";
}
$typestr = substr($typestr, 0, strlen($typestr) - 2);
if (!empty($_POST['search'])) {
$search = strtolower(str_replace('*', '%', check_plain($_POST['search'])));
$result = db_query("SELECT n.nid, n.title FROM {node} AS n LEFT JOIN " . "{uc_products} AS p ON n.nid = p.nid WHERE n.type IN " . "({$typestr}) AND (LOWER(n.title) LIKE '%s' OR LOWER(p.model) LIKE '%s')" . " ORDER BY n.title", strtolower($search), strtolower($search));
}
else {
$result = db_query("SELECT nid, title FROM {node} WHERE type IN ({$typestr}) " . "ORDER BY title");
}
while ($row = db_fetch_object($result)) {
$options[$row->nid] = $row->title;
}
$output = drupal_get_form('uc_order_product_select_form', $order_id, $options);
print $output;
exit;
}