When a user adds a commerce registration to their cart, goes to the cart, and clicks 'Continue' to go to the Registration page, the order is marked from cart to checkout_registration status.

When commerce_order_load is called, it loops through all order statuses defined, including statuses dynamically created from implementing hook_commerce_checkout_page_info(). Thus, the order is set to checkout_registration, however, when commerce_order_load is called, checkout_registration never seems to be in the array of order statuses.

What happens then is if you bail out of the checkout process at any time, like going back to the home page, then going to your cart, your cart says it is empty despite having an active order open.

To get around this quickly, I created a Rule that looked for an updated order, checked if its status was 'Checkout: Registration' and updated it to 'Checkout: Checkout'. Now, a user can exit the checkout process and come back to their cart and start the checkout workflow again with information they already entered. Otherwise, they get locked out and it is rather frustrating/clunky experience.

But the order status is not being picked up on within Drupal Commerce, which is a bug.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

kevinquillen’s picture

Status: Active » Needs review

Okay - I think I have figured out what the issue is. It's pretty broken as it stands, the moment you exit the checkout process your order is screwed. Also, once you enter registration information, you can't edit it again without both assigning field permission and commenting out this line of code on line 75 of includes/commerce_registration.checkout_pane.inc:

        // -------------------------------------------------------------------------
        // All the following code can be deleted if we use the form builder from ER.
        // -------------------------------------------------------------------------
        $options = registration_access_people($entity);
        /*if ((count($options) == 0)
          || !registration_register_page_access('commerce_product', $product->value())) {
          $pane_form[$prodkey][$prodkey . '-reg-' . $i]['no_reg'] = array(
            '#markup' => t('You do not have permission to register for this item.'),
          );
          $pane_form[$prodkey][$prodkey . '-reg-' . $i]['no_reg_permission'] = array(
            '#type' => 'hidden',
            '#value' => TRUE,
          );
          return $form;
        }*/

On top of that, the status_cart property needs to be FALSE so a user can exit and come back to a cart workflow uninterrupted. When I made this change, I no longer got access denied, and I could disable the Rule that auto changes the order status.

/**
 * Implements hook_commerce_checkout_page_info().
 */
function commerce_registration_commerce_checkout_page_info() {
  $pages = array();
  $pages['registration'] = array(
    'name' => t('Registration'),
    'title' => t('Registration Information'),
    'weight' => -1,
    'status_cart' => FALSE,
    'buttons' => TRUE,
  );
  return $pages;
}
RaceCorp’s picture

This worked for me.

RaceCorp’s picture

Issue summary: View changes
FileSize
2.09 KB

Adding a patch.

Status: Needs review » Needs work

The last submitted patch, 3: let_users_edit_their_registration.patch, failed testing.