2 replies [Last post]
Alaska's picture
Offline
Joined: 10/16/2007
Juice: 1434
Was this information Helpful?

Using the reorder module which places a button on the order history page. When selected, prior ordered items will be placed in the cart. A nice feature for return customers. (using Uber 1.6 and Drupal 5.12)

However, there is a failure to generate a correct URL to display the cart. The generated URL is:

http://localhost/drupal-5.12/user/4/user/4/orders/reorder/64

The issue is the double set of user/4's. If one set is deleted, then the URL is processed correctly - items added to cart - cart displayed - all is well.

This looks like the code that is being used to generate the callback URL.

/**
* Reorder form - consists of just the reorder button
*
* @param  $href  Callback URL
*/
function uc_reorder_reorder_form($href) {
  $form['reorder'] = array(
    '#type'  => 'button',
    '#value' => t('Re-Order'),
  );
  $form['#action'] = $href;

  return $form;
}

Suggestions on changes to correct this issue would be appreciated.

TR
TR's picture
Offline
Bug FinderFAQ ModeratorGetting busy with the Ubercode.
Joined: 11/05/2007
Juice: 3286
Re: Reorder Button Dispalys Incorrect URL

Curious. It seems the Form API has changed, since the above code used to work (and still does) under older version of Drupal.

The fix is to change this:

$form['#action'] = $href;

to this:

$form['#action'] = url($href);
<tr>.
Alaska's picture
Offline
Joined: 10/16/2007
Juice: 1434
Fix

TR:

Yes, that did it. Now Uber 1.6 is most happy.

Thanks so much for the code change.

It is most appreciated.