Reorder Button Dispalys Incorrect URL

Posts: 405
Joined: 10/16/2007

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.

Posts: 974
Joined: 11/05/2007
Bug FinderFAQ ModeratorGetting busy with the Ubercode.

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>.

Posts: 405
Joined: 10/16/2007

TR:

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

Thanks so much for the code change.

It is most appreciated.