commerce_checkout_progress_init() needs to go away because it overrides $_GET['q']. This is ugly. See #1296218: Commerce Checkout Progress comment #3.

The issue is that the first checkout page doesn't display the page id. Every other page does. The path for the first checkout page is 'checkout/1'. The problem comes when setting the pages to display the block on. We need a way of telling the block to only show on the first checkout pages and not the others. How do we tell a block to only show on that page when the number is always changing? Something like 'checkout/*' will display on every sub-page like 'checkout/1/payment'. I'd like to be able to set a visibility setting like 'checkout/*/' but that doesn't work.

The easy solution is to use a drupal_goto within the commerce_checkout_progress_commerce_checkout_router() function. But that seems ugly to.

Comments

webmasterkai’s picture

The thing is, it's just not actually that big of a deal.
commerce/modules/checkout/commerce_checkout.module line 13

function commerce_checkout_menu() {
  $items = array();

  $items['checkout/%commerce_order'] = array(
    'title' => 'Checkout',
    'page callback' => 'commerce_checkout_router',
    'page arguments' => array(1),
    'access arguments' => array('access checkout'),
    'type' => MENU_CALLBACK,
    'file' => 'includes/commerce_checkout.pages.inc',
  );
  $items['checkout/%commerce_order/%commerce_checkout_page'] = array(
    'title' => 'Checkout',
    'page callback' => 'commerce_checkout_router',
    'page arguments' => array(1, 2),
    'access arguments' => array('access checkout'),
    'type' => MENU_CALLBACK,
    'file' => 'includes/commerce_checkout.pages.inc',
  );

commerce/modules/checkout/includes/commerce_checkout.pages.inc line 12

function commerce_checkout_router($order, $checkout_page = NULL) {
  $checkout_pages = commerce_checkout_pages();

  // If no checkout page is specified, default to the first one.
  if (empty($checkout_page)) {
    $checkout_page = reset($checkout_pages);
  }

This module uses hook_init() to do the following

$page = reset(commerce_checkout_pages());
$_GET['q'] = 'checkout/' . arg(1) . '/' . $page['page_id'];

I don't really see how it's much different.

webmasterkai’s picture

In talking with Andy T (thehong) we talked about setting the page visibility settings with "checkout/*" and then checking a variable for what pages NOT to display the block on within the commerce_checkout_progress_block_view() function.

thehong’s picture

thehong’s picture

Status: Active » Fixed
webmasterkai’s picture

Status: Fixed » Closed (fixed)

Everything is working well for me. I removed the redirect via drupal_goto().