Closed (duplicate)
Project:
Commerce Core
Version:
7.x-1.x-dev
Component:
Checkout
Priority:
Normal
Category:
Task
Assigned:
Reporter:
Created:
1 Dec 2012 at 15:16 UTC
Updated:
13 Feb 2013 at 06:00 UTC
Jump to comment: Most recent file
Currently the code is as follows
$checkout_pages = module_invoke_all('commerce_checkout_page_info');
drupal_alter('commerce_checkout_page_info', $checkout_pages);
$count = 0;
foreach ($checkout_pages as $page_id => $checkout_page) {
$defaults = array(
'page_id' => $page_id,
'name' => $checkout_page['title'],
'title' => '',
'help' => '',
'status_cart' => TRUE,
'buttons' => TRUE,
'back_value' => t('Go back'),
'submit_value' => t('Continue to next step'),
'prev_page' => NULL,
'next_page' => NULL,
);
$checkout_pages[$page_id] += $defaults;
// Set a weight that preserves the order of 0 weighted pages.
if (empty($checkout_page['weight'])) {
$checkout_pages[$page_id]['weight'] = $count++ / count($checkout_pages);
}
}
A problem occurs that when commerce_checkout_pages() is called from within a hook implementation that's triggered by the drupal_alter call. A solution is to move the call to drupal_alter right after the for-loop.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | commerce-move_drupal_alter_invocation_in_commerce_checkout_pages-1855900-1.patch | 848 bytes | cvangysel |
Comments
Comment #1
cvangysel commentedPatch.
Comment #2
JulienD commentedNice catch @cvangysel, It's perfectly make sens to run drupal_alter() after the default implementation.
The patch is working fine.
Comment #3
rszrama commentedI'll need to cross-reference the change with our notes in #1357376: Resolve order of info alter hooks in relation to UI settings. Previously we had decided to table this change until Commerce 2.x.
Comment #4
rszrama commentedAs this patch turned out to be unnecessary for the Express Checkout integration, I'm going to mark it as a duplicate of the other and make a note in there that the same discussion applies to checkout page alteration. In the case of PayPal EC, I actually changed the module to alter the checkout router as opposed to simply trying to alter checkout pages to make the multiple checkout flows work.
Comment #4.0
rszrama commentedspell check