0

I need to know how the drupal Commerce review page is being created and where the submit handler is which precedes that page. I have added a couple of fields which aren't being picked up in the panes, and I want to debug in the handler (or even a review page tpl file). Where can I find this? I have looking though the code and havn't found the answer.

1

All checkout page forms are built using the checkout pane info David Thomas indicated through the function commerce_checkout_form() in commerce_checkout.pages.inc. The validate handler does double duty for the checkout form, validating and actually submitting data on a pane by pane basis to capture valid data as soon as possible. This function is aptly named commerce_checkout_form_validate(). Your best bet will be to log debug messages using watchdog instead of displaying them on the screen via drupal_set_message(), because we do some status message processing in there to put messages inline with the panes that generated them - that can make it hard to force a debug message to show when you expect it.

2
  • So, if I want to add some functionality after the user clicks the submit button on the first checkout page, do I need to set new validate handler or a new submit handler? Nov 12 '13 at 20:06
  • You can do either one depending on when you need your code to be executed. Make it a validate handler prepended to the existing #validate array of the checkout form's submit button if it needs to go first or append it to the end or just add it to #submit array if it doesn't matter. Just make sure you're adding handlers to the button, not the form level #validate / #submit arrays - those are ignored. Nov 13 '13 at 5:35
0

If you want to add checkout panes to the review process you can use

hook_commerce_checkout_pane_info

In particular:

review: boolean indicating whether or not the pane should be included in the review checkout pane; defaults to TRUE

and also:

callbacks: an array of callback function names for the various types of callback required for all the checkout pane operations, arguments per callback in parentheses: ....
review($form, $form_state, $checkout_pane, $order): returns data used in the construction of the Review checkout pane

If you want to alter existing checkout panes, e.g the form or the content on the review page, you can use

hook_commerce_checkout_pane_info_alter

and adjust the checkout_form or review property there.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.