summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPedro Cambra2012-08-17 09:33:25 (GMT)
committer Pedro Cambra2012-08-17 09:33:25 (GMT)
commit3ef94ef1c29bc5689094620441bc37a073f4b32c (patch)
tree922a8135b10b4d0623537861d91f550b2005b666
parent4f4b1b548395266706e52e3ec7315279d9315ee1 (diff)
Issue #1426830 by nielsonm, jonathan_hunt: Fixed Some code docs for commerce_coupon().checkout_pane().inc.7.x-1.0-beta6
-rw-r--r--includes/commerce_coupon.checkout_pane.inc13
1 files changed, 11 insertions, 2 deletions
diff --git a/includes/commerce_coupon.checkout_pane.inc b/includes/commerce_coupon.checkout_pane.inc
index 9f7c126..53bd71c 100644
--- a/includes/commerce_coupon.checkout_pane.inc
+++ b/includes/commerce_coupon.checkout_pane.inc
@@ -3,6 +3,9 @@
/**
* @file
* Coupon checkout panes.
+ *
+ * Expose a textfield for entering a coupon code during checkout, and show list
+ * of coupons applied to current order.
*/
/**
@@ -32,16 +35,19 @@ function commerce_coupon_pane_checkout_form($form, &$form_state, $checkout_pane,
return $pane_form;
}
+/**
+ * Check whether the coupon code is valid.
+ */
function commerce_coupon_pane_checkout_form_validate($form, &$form_state, $checkout_pane, $order) {
//@todo I think global function should start and end with an underscore
global $commerce_coupon_validation_error_message;
- // Check if it is empty
+ // Check if coupon code is empty.
if (empty($form_state['values']['commerce_coupon']['coupon_code'])) {
return TRUE;
}
- // Valdiate the coupon code
+ // Validate the coupon code.
if (commerce_coupon_code_is_valid($form_state['values']['commerce_coupon']['coupon_code'], $order)) {
return TRUE;
}
@@ -58,6 +64,9 @@ function commerce_coupon_pane_checkout_form_validate($form, &$form_state, $check
}
}
+/**
+ * We have a valid coupon code, so submit it.
+ */
function commerce_coupon_pane_checkout_form_submit($form, &$form_state, $checkout_pane, $order) {
// Only redeem coupon if no validation errors on form and coupon code is set
// This prevents trying to add the same coupon twice on validation error in another pane