Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

PayPal Express Checkout switching to cheapest method after returning from PayPal


mikekorn

Recommended Posts

Hello,

 

I'm having an issue with the PayPal Express Checkout module found here: http://addons.oscommerce.com/info/5658. It seems when a customer returns from the PayPal log in page after selecting their payment method and shipping method, that the shipping method is being defaulted back to the cheapest method. I want it to stay as the method they chose prior to that.

 

After researching a bit I found a supposed solution that looked like this:

 

1) If Paypal overrides your shipping method you should try this solution:

 

in catalogextmodulespaymentpaypalexpress.php find :


// select cheapest shipping method
$shipping = $shipping_modules->cheapest();
$shipping = $shipping['id'];
}
}

if (strpos($shipping, '_')) {
list($module, $method) = explode('_', $shipping);

if ( is_object($$module) || ($shipping == 'free_free') ) {
if ($shipping == 'free_free') {
$quote[0]['methods'][0]['title'] = FREE_SHIPPING_TITLE;
$quote[0]['methods'][0]['cost'] = '0';
} else {
$quote = $shipping_modules->quote($method, $module);
}

if (isset($quote['error'])) {
tep_session_unregister('shipping');

tep_redirect(tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL'));
} else {
if ( (isset($quote[0]['methods'][0]['title'])) && (isset($quote[0]['methods'][0]['cost'])) ) {
$shipping = array('id' => $shipping,
'title' => (($free_shipping == true) ? $quote[0]['methods'][0]['title'] : $quote[0]['module'] . ' (' . $quote[0]['methods'][0]['title'] . ')'),
'cost' => $quote[0]['methods'][0]['cost']);
}
}
}
}

 

and replace with this :

// load the selected shipping module
require(DIR_WS_CLASSES . 'shipping.php');
$shipping_modules = new shipping($shipping);

require(DIR_WS_CLASSES . 'order_total.php');
$order_total_modules = new order_total;

 

This however only gave me an error. But I think the person was on the right track. It seems like right here:

// select cheapest shipping method
$shipping = $shipping_modules->cheapest();
$shipping = $shipping['id'];

 

is where it is selecting the cheapest method. Is there any known solution for this to make it so it chooses the original method?

 

Any help would be greatly appreciated!

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...