multimixer Posted September 16, 2009 Posted September 16, 2009 Hello all I have paypal express installed since a while and everything was working fine, till today, where I discovered that paypal overides the shipping method chosen by the customer and is replacing this by the cheapest that exist: I have 2 shipping methods: Flat rate (=9eur) and store pickup (=0eur). Paypal return url is set to checkout_confirmation.php When somebody place an order, choosing the flat shipping rate and after that paypal express, after returning back from paypal to the order_confirmation.php, the flat rate is overwritten by the storepickup rate. If I change the chargings (ie flat=1 eur, storepickup = 2 eur), then the flat rate appears "automatically". Changing the shipping method (after paypal) in checkout_confirmation.php, everything goes fine, the customer is getting charged the shipping cost and I receive the money, but only then. I found some cases in the forum where people were reporting similar issues, but never a clear answer. Does anyone has an idea or a tip what to do? tanwardeepaks 1 Quote My community profile | Template system for osCommerce - New: Responsive | Feedback channel
multimixer Posted September 17, 2009 Author Posted September 17, 2009 Some more information 1) Here are some recent questions of people with similar problems, unfortunately no answer topic1: The problem here is exactly oposite, paypal choose the flat rate instead of free shipping topic2: Also oposite issue, paypal choose the table rate instead of "collect in person" (=0) 2) The issue happens doesn't matter if somebody click on checkout at the shopping cart or after choosing paypal as payment in the regular checkout process. In the first case (shopping cart) could be expectable, because no shipping method was chosen yet. But why after shipping was chosen? 3) As said, my return url is checkout_confirmation.php. I guess that if just the shopping cart button would be in use, the return should be at checkout_shipping.php. Because I made this button invisible in shopping_cart.php, the only way people have to use paypal express is during the regular checkout as a payment option. So I don't want them to return back to chose the shipping, thats why I send them to the confirmation page. Could it be that it is in the "nature" of the express module, not to recognize any shipping method, because normally it is getting activated BEFORE the shipping choice? That makes a sense to me, because if I change the shipping method going back from the confirmation page, everything works fine and paypal charges correctly 4) In checkout_shipping.php, the automatic selection of the cheapest method is commented out //if ( !tep_session_is_registered('shipping') || ( tep_session_is_registered('shipping') && ($shipping == false) && (tep_count_shipping_modules() > 1) ) ) $shipping = $shipping_modules->cheapest(); . Is this also set somewhere else except in this file? I wonder why the cheapest method is getting chosen 5) In my paypal account settings, under "shipping calculations" I have "Allow transaction-based shipping settings to override profile settings (Optional)." clicked on, but it doesn't make any difference, customer can still choose his address in paypal. Even the customer is loged in in my store with an Afghanistan address (=no store pick up), after coming back from paypal with his Greek address, store pickup is chosen. If anyone has the time to give any idea to this issue, will be highly appreciated Quote My community profile | Template system for osCommerce - New: Responsive | Feedback channel
multimixer Posted September 17, 2009 Author Posted September 17, 2009 Some progress, slow maybe, but still I found that the cheapest shipping method is chosen in catalog/ext/payment/paypal/express.php There you can find following code // load all enabled shipping modules include(DIR_WS_CLASSES . 'shipping.php'); $shipping_modules = new shipping; $free_shipping = false; if ( defined('MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING') && (MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING == 'true') ) { $pass = false; switch (MODULE_ORDER_TOTAL_SHIPPING_DESTINATION) { case 'national': if ($order->delivery['country_id'] == STORE_COUNTRY) { $pass = true; } break; case 'international': if ($order->delivery['country_id'] != STORE_COUNTRY) { $pass = true; } break; case 'both': $pass = true; break; } if ( ($pass == true) && ($order->info['total'] >= MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER) ) { $free_shipping = true; include(DIR_WS_LANGUAGES . $language . '/modules/order_total/ot_shipping.php'); } } if (!tep_session_is_registered('shipping')) tep_session_register('shipping'); $shipping = false; if ( (tep_count_shipping_modules() > 0) || ($free_shipping == true) ) { if ($free_shipping == true) { $shipping = 'free_free'; } else { // get all available shipping quotes $quotes = $shipping_modules->quote(); // 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 in particular, this here, that is selecting the cheapest method $shipping = $shipping_modules->cheapest(); Now, the question is, how to make it to take over the previously selected shipping method? I don't mean to have a fixed one (ie flat), just whatever was chosen before by the customer. Quote My community profile | Template system for osCommerce - New: Responsive | Feedback channel
multimixer Posted September 17, 2009 Author Posted September 17, 2009 To get all the time the flat shipping method and rate selected by paypal, then, in catalog/ext/payment/paypal/express.php this code $shipping = $shipping_modules->cheapest(); $shipping = $shipping['id']; need to be replaced by this $array_flat = array('id' => 'flat_flat'); $shipping = 'flat_flat'; $shipping = $array_flat['id']; But how to make it to get the method the customer selected before? (I'm always talking about the case of using paypal express in the common checkout process, not directly at the shopping cart) Any idea would be great Quote My community profile | Template system for osCommerce - New: Responsive | Feedback channel
krugeros Posted April 5, 2010 Posted April 5, 2010 hi there, try this: in catalog\ext\modules\payment\paypal\express.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; Works fine with my shop. multimixer 1 Quote
Guest Posted April 12, 2011 Posted April 12, 2011 hi there, try this: in catalog\ext\modules\payment\paypal\express.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; Works fine with my shop. Hi, I am using OSC 2.3.1 and having same problem with paypal express overriding free shipping. With above solution,I get the following: Parse error: syntax error, unexpected T_ELSE in /home/namadisk/public_html/ext/modules/payment/paypal/express.php on line 472 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 Quote
satish Posted April 24, 2011 Posted April 24, 2011 in express checkout your site communicates with paypal server thrice. If you can collect request and response for these three steps that will put some light into where things are going wrong. This in turn will put you on track to debug and fix code. Satish Quote Ask/Skype for Free osCommerce value addon/SEO suggestion tips for your site. Check My About US For who am I and what My company does.
greasemonkey Posted December 18, 2014 Posted December 18, 2014 But how to make it to get the method the customer selected before? (I'm always talking about the case of using paypal express in the common checkout process, not directly at the shopping cart) @@multimixer Hi George, where you ever able to resolve this? Quote
TheKnight Posted March 22, 2015 Posted March 22, 2015 We had this problem too. We use Paypal Express 3.1 and osc 2.3.3.4. At the beginning Paypal worked well, shipping have been calculated correctly. From one day to the other, shipping method was always set to free pick up in store. In the checkout_confirmation and at the paypal side, the correct shipping method and the correct shipping cost were displayed. However, the wrong shipping method and the false shipping cost were sent to the customer and were stored into our db. With the reference of the thread http://www.oscommerce.com/forums/topic/398267-paypal-express-31-update-not-pushing-shipping-method-selected/ to the instant notification function and the descriptions in the manual of the contribution I have found the cause of the error. Many thanks to Kevin for his hint. The cause is the missing 'Payment Zone' for Paypal. Goto 'Locations / Taxes' -> 'Tax Zones' in the admin menu. Then create a tax zone for the countries from which you want to accept the paypal payments, for example 'worldwide'. I used the contribution "Rest of the World tax zone". (Contrib "Rest of the World tax zone" from 21.Jul 2014 contains an error and does not work. Change line45 to: <?php echo tep_draw_form('doprocess', 'setup_international_zone.php', 'action=' . $_SERVER['PHP_SELF'], 'post'); ?> and it works fine). You can also manually create the new tax zone or perhaps there is already an appropriate zone. If the new zone has been created, then go to 'Modul' -> 'Payment' -> 'PayPal Express Checkout'. Scroll down to 'Payment Zone' and select 'worldwide' (or the name you've chossed) from the pull-down menu. The default '--none--' does not work and causes the described incorrect behaviour.Click Save and afterwards enjoy the working 'PayPal Express Checkout'. Quote
steeevo85 Posted May 4, 2015 Posted May 4, 2015 I'm still having this issue. Shipping costs aren't getting sent to paypal when using the express checkout button. but the checkout proccess is ok when going through the oscommerce regular checkout procedure. Any Ideas? I'm set the rest of worl tax zone as shown above with no changes. Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.