News:

Support the VirtueMart project and become a member

Main Menu

Error: PayPal returned: Order total is invalid.

Started by Anthony C., September 11, 2010, 01:45:01 AM

Previous topic - Next topic

Anthony C.

Use Paypal_api module. When the total is 0 (100% off coupon applied), the api returns that value.

Is there a way to skip the paypal_api when the total is 0?

The old paypal and other CC payment are skipped when total is 0.

Thank you

Anthony

Claude LaBadie

Hi,

Today I am happy I can give back to our great community by sharing how I solved this problem for myself. :D

The fact I found is that it is around lines 1190-1200 in the virtuemart file administrator/components/com_virtuemart/classes/ps_checkout.php that you can fix the erroneous checkout behavior.

The checkout process checks for the existence of payment processing capabilities before testing for a 0.00 total order amount.  ???

The solution I chose is to switch the order of those 2 tests, checking for a total of zero, then else for payment processing. ;D

on my version here is the code before my change:

      if (isset($_PAYMENT)) {
          if( $enable_processor == "Y" || stristr($_PAYMENT->payment_code, '_API' ) !== false ) {
         if( $d['new_order_status'] != 'P' ) {
             $d['order_status'] = $d['new_order_status'];
             $update_order = true;
         } elseif( defined($_PAYMENT->payment_code.'_VERIFIED_STATUS')) {
             $d['order_status'] = constant($_PAYMENT->payment_code.'_VERIFIED_STATUS');
             $update_order = true;
         }
          }
      } elseif( $order_total == 0.00 ) {
          // If the Order Total is zero, we can confirm the order to automatically enable the download
          $d['order_status'] = ENABLE_DOWNLOAD_STATUS;
          $update_order = true;
      }


and the code after the change:

      // If the Order Total is zero, we can confirm the order to automatically enable the download
      if ( $order_total == 0.00 ) {
          $d['order_status'] = ENABLE_DOWNLOAD_STATUS;
          $update_order = true;

      } elseif ( isset($_PAYMENT) ) {
          if( $enable_processor == "Y" || stristr($_PAYMENT->payment_code, '_API' ) !== false ) {
         if( $d['new_order_status'] != 'P' ) {
             $d['order_status'] = $d['new_order_status'];
             $update_order = true;
         } elseif( defined($_PAYMENT->payment_code.'_VERIFIED_STATUS')) {
             $d['order_status'] = constant($_PAYMENT->payment_code.'_VERIFIED_STATUS');
             $update_order = true;
         }
          }
      }



Have a nice day. :-*

[attachment cleanup by admin]
Claude LaBadie
http://claudelabadie.com

forresttw

Which version of VM are you on? I'm on VM1.1.5 and it didn't work

Claude LaBadie

The version this change worked on was VM 1.1.15
Claude LaBadie
http://claudelabadie.com