Skip to main content
3 of 3
added 16 characters in body
kenorb
  • 14.3k
  • 10
  • 98
  • 168

Drupal 6

I've defined some custom bypassing function as below:

/**
 * Implementation of hook_menu().
 */
function foo_menu() {

  // URL for user to be directed to on test order completion
  $items['test/order/%/complete'] = array(
    'title' => 'Fake payment bypass.',
    'page callback' => 'foo_test_order_complete',
    'page arguments' => array(2),
    // 'access callback' => variable_get('my_environment', 'live') <> 'live', // disabled on live
    'access callback' => 'user_access',
    'access arguments' => array('administer site configuration'), // Only admin can test that
    'type' => MENU_CALLBACK,
  );

  return $items;
}

/**
 * Test order completion page
 */
function foo_test_order_complete($order_id) {

  if (empty($_SESSION['cart_order'])) {
    $_SESSION['cart_order'] = $order_id;
  }

  $order = uc_order_load($_SESSION['cart_order']);

  // This lets us know it's a legitimate access of the complete page.
  $_SESSION['do_complete'] = TRUE;
  module_load_include('inc', 'uc_cart', 'uc_cart.pages');
  uc_cart_checkout_complete();
  drupal_goto('cart/checkout/complete');

}

So when submit your Review order, after that you can go to:

test/order/12345/complete where 12345 is number of your order or just:

test/order/current/complete to load the order from the session.

These URLs are accessible only by admin, but you can free to extend the permissions as you wish.

kenorb
  • 14.3k
  • 10
  • 98
  • 168