PDA

View Full Version : Paypal Express Checkout 1.0 - few changes



michael_s
04-07-2010, 05:00 AM
Hi there,

This is a small update/fix for those who are using Paypal Express Checkout contribution :

http://addons.oscommerce.com/info/5658


What it does :


1) keeps paypal from overriding your shipping method ( and charges the client for shipping costs in paypal's checkout )
2) removes "checkout with paypal" button from shopping cart page




__________________________________________________ _______________


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_SHIPP ING, '', '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;


__________________________________________________ _________________________


2) remove "checkout with paypal" button from shopping cart page :

comment below code found in paypal_express.php in includes/modules/payment:

function checkout_initialization_method() {
global $language;

if (file_exists(DIR_FS_CATALOG . 'ext/modules/payment/paypal/images/btn_express_' . basename($language) . '.gif')) {
$image = 'ext/modules/payment/paypal/images/btn_express_' . basename($language) . '.gif';
} else {
$image = 'ext/modules/payment/paypal/images/btn_express.gif';
}

$string = 'http://www.oscmax.com/forums/' . $image . ' (http://www.oscmax.com/forums/' . tep_href_link('ext/modules/payment/paypal/express.php', '', 'SSL') . ')';

return $string;
}


More... (http://addons.oscommerce.com/info/7333)