My client wants a checkout review and payment pane in a modal window, structured and styled a very specific way. Getting a form into a modal isn't an issue, as I've done that many times, but I'm curious about the best way to present the checkout payment pane where the credit card info is entered, and how to advance the checkout to the next step after they enter their payment info.

It seems like I build my form to display in the modal, and within a section of the form, I call commerce_checkout_pane_load() to load my payment pane, and it looks like DC takes it from there. The client was only specific about the review and payment display. On the form, I have other order info from custom order fields surrounding the payment pane.

Is it as simple as this? Or, is the best way to do it when the user is ready to check out, I have some callbacks hooked in to call my specific review and payment forms? I think I have the concept, so I'm just trying to get some clarity. The flow I need is:

  1. From the cart page, they click check-out and it calls the my modal custom form.
  2. They review the form contents displaying the custom fields
  3. The click from there and, are taken to a modal payment form where they enter their cc info into the payment pane. After that, they continue along the normal flow and let Rules handle the confirmation email, and some other tasks I have configured.
  • 1
    The best way is not something completely objective; it depends from many factors, and the answer would change also basing on subjective criteria. Generally speaking, this site doesn't aim to be a whiteboard for code you need to write; we prefer talking about actual code you are writing, similarly to what Stack Overflow does. – kiamlaluno Mar 20 '14 at 4:36
  • No. The "best way" is to let Drupal do the work and to stay within the flow of the Drupal architecture as much as possible. So, no, there are better ways and not better ways to do things. Nevertheless, my apologies for not posting code. I think I found the answer, and if it works, I'll post back with a revised question and post an answer. I will revise my question now though with some relevant code. Thank you though. – vintorg Mar 20 '14 at 6:14
  • In Drupal there is more than one way to do something; there are ways that are better than others, but still what you call better is rather subjective, without seeing any code. Within code, I can surely tell you (for example), when it is better to use variable_get() or drupal_static(); without code, and with a broad question, that is not that easy. – kiamlaluno Mar 20 '14 at 8:25
  • Yes, I agree with that. I'll provide some code and more detail. – vintorg Mar 20 '14 at 8:48
  • Did you solve this? I am also working on a custom modal that will set the user and payment method for a transaction, then complete the transaction. I'm working through setting up the modal now: drupal.stackexchange.com/questions/118890/… – Joe Beuckman Jun 19 '14 at 15:38

Browse other questions tagged or ask your own question.