Jump to content
Sign in to follow this  
mom2doubles

Paypal Express and Shipping Override Issue

Recommended Posts

Hello!

 

I am using PayPal Express (I downloaded the add-on directly from the paypal site. I am having an issue with the express.php selecting the cheapest shipping method instead of the shipping method selected by the customer.

 

I found a contribution to remove the cheapest shipping method. However I have not been able to get it to work?

My link

 

In the Add-on it has

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;

 

I found that I had to add two if the } } back in then when I attempted to run I got the following message:

Fatal error: Cannot redeclare class shipping in /home/content/s/c/r/scrapbook1999/html/shopbeta/catalog/includes/classes/shipping.php on line 13

 

I have tried moving the lines above around and commenting out the require(DIR_WS_CLASSES . 'shipping.php'); in the confirmation page... but I have no clue what I am doing. Any ideas would be greatly appreciated. This is last thing I need to get working for my site to go live.

 

Thanks

Share this post


Link to post
Share on other sites

Hi,

I am using OSC 2.3.1 and having problem with paypal express overriding free shipping.

 

 

Is there anything that one can change in ths code to make it work--

 

// 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']);

}

}

}

}

 

 

Please help !!!!!

 

Best Regards

Share this post


Link to post
Share on other sites

Try replacing the code 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;
		}
	  }

Share this post


Link to post
Share on other sites

First of all I don't understand what the hell that does -- it doesn't make any sense.

Secondly, if you try and replace it like you say - you get errors because one ore more { } brackets get messed up. :(

But thanks anyway

Share this post


Link to post
Share on other sites

correction: stubbsy you have added two }'s which prevents any compile errors, but this doesn't solve the problem.

I wonder if it's a version thing - I am using 2.2rc2a e

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×