function uc_checkout_pane_comments in Ubercart 5
Same name and namespace in other branches
- 6.2 uc_cart/uc_cart_checkout_pane.inc \uc_checkout_pane_comments()
- 7.3 uc_cart/uc_cart_checkout_pane.inc \uc_checkout_pane_comments()
Allow a customer to make comments on the order.
1 string reference to 'uc_checkout_pane_comments'
- uc_cart_checkout_pane in uc_cart/
uc_cart.module - Implementation of hook_checkout_pane().
File
- uc_cart/
uc_cart_checkout_pane.inc, line 393 - This file contains the callbacks for the default checkout panes supplied with Ubercart and their corresponding helper functions.
Code
function uc_checkout_pane_comments($op, &$arg1, $arg2) {
switch ($op) {
case 'view':
$description = t('Use this area for special instructions or questions regarding your order.');
if (!empty($arg1->order_id)) {
$default = db_result(db_query("SELECT message FROM {uc_order_comments} WHERE order_id = %d", $arg1->order_id));
}
$contents['comments'] = array(
'#type' => 'textarea',
'#title' => t('Order comments'),
'#default_value' => $default,
);
return array(
'description' => $description,
'contents' => $contents,
);
case 'process':
if (strlen($arg2['comments']) > 0) {
db_query("DELETE FROM {uc_order_comments} WHERE order_id = %d", $arg1->order_id);
uc_order_comment_save($arg1->order_id, 0, $arg2['comments'], 'order', uc_order_state_default('post_checkout'), TRUE);
}
return TRUE;
case 'review':
$result = db_query("SELECT message FROM {uc_order_comments} WHERE order_id = %d", $arg1->order_id);
if ($comment = db_fetch_object($result)) {
$review[] = array(
'title' => t('Comment'),
'data' => check_plain($comment->message),
);
}
return $review;
}
}