Jump to content

Paypal payment received - no order in back office. PHP warning


Recommended Posts

Hello guys,

Every now and then I receive a Paypal payment without creating an order in the back office. After checking the error log, it shows the following for these orders:

 

PHP Warning:  Division by zero in /override/classes/PaymentModule.php on line 171

 

I checked this file and lines 170-171 say the following:

$order_status = new OrderState((int)$id_order_state, (int)$this->context->language->id);
		if (!Validate::isLoadedObject($order_status))

I'm not able to create order from the shopping cart either because these shopping carts reset to $0.00 after Paypal payment.

 

Any magical tricks to fix this?

Thanks!

Link to comment
Share on other sites

PHP Warning:  Division by zero in /override/classes/PaymentModule.php on line 171

I think you should first start by trying to figure out why you have an override of the PaymentModule.  Perhaps you have installed a custom module that added this.  The issue could be caused by this override

Link to comment
Share on other sites

Thank you for your response. I'm not really sure what exactly PaymentModule is. I have the default Paypal USA/Canada module and Authorize.net by Presto-Changeo.

PHP Warning:  Division by zero in /override/classes/PaymentModule.php on line 171

I think you should first start by trying to figure out why you have an override of the PaymentModule.  Perhaps you have installed a custom module that added this.  The issue could be caused by this override

 

Link to comment
Share on other sites

Those are Payment Modules.

OK... So, I have 2 payment modules. Which of them is the PaymentModule? The issue is related to Paypal. Am I likely to receive assistance with this on the Paypal forum?

Thank you.

Link to comment
Share on other sites

neither of them are the PaymentModule class in your override folder.

 

As I already said...

I think you should first start by trying to figure out why you have an override of the PaymentModule.  Perhaps you have installed a custom module that added this.  The issue could be caused by this override

 

Link to comment
Share on other sites

The error is being produced by their override, it is trying to divide something by zero.  There is nothing in the code you supplied that is dividing, so you have likely provided the wrong line of code.

 

Let's start by seeing the correct line of code and going from there.

Link to comment
Share on other sites

The error is being produced by their override, it is trying to divide something by zero.  There is nothing in the code you supplied that is dividing, so you have likely provided the wrong line of code.

 

Let's start by seeing the correct line of code and going from there.

OK, I copied over the line it was showing in the error log. I'm attaching the entire paymentmodule.php file since there is a lot of code in it.

Thanks so much.

PaymentModule.php

Link to comment
Share on other sites

                        if (!is_null($carrier) && Validate::isLoadedObject($carrier)){
                            if (isset($productTaxes['0_'.round($order->total_shipping_tax_excl)]))
                            $order->carrier_tax_rate = (float)(($productTaxes['0_'.round($order->total_shipping_tax_excl)] * 100 )/$order->total_shipping_tax_excl);

                        }

this is the code in question, more specifically, this is line 171

$order->carrier_tax_rate = (float)(($productTaxes['0_'.round($order->total_shipping_tax_excl)] * 100 )/$order->total_shipping_tax_excl);

as  you can see, this line of code tries to divide using the variable $order->total_shipping_tax_excl, which is the cost of shipping for an order.  Well, tell me what happens when the cost of shipping is zero (aka free)?  This is an issue with their module, not with Prestashop, as they need to account for the fact that shipping can be free

 

Link to comment
Share on other sites

                        if (!is_null($carrier) && Validate::isLoadedObject($carrier)){
                            if (isset($productTaxes['0_'.round($order->total_shipping_tax_excl)]))
                            $order->carrier_tax_rate = (float)(($productTaxes['0_'.round($order->total_shipping_tax_excl)] * 100 )/$order->total_shipping_tax_excl);

                        }

this is the code in question, more specifically, this is line 171

$order->carrier_tax_rate = (float)(($productTaxes['0_'.round($order->total_shipping_tax_excl)] * 100 )/$order->total_shipping_tax_excl);

as  you can see, this line of code tries to divide using the variable $order->total_shipping_tax_excl, which is the cost of shipping for an order.  Well, tell me what happens when the cost of shipping is zero (aka free)?  This is an issue with their module, not with Prestashop, as they need to account for the fact that shipping can be free

 

 

Interesting. The orders I had issues with did not have free shipping. Shipping fee was charged and paid. There were no discounts or anything special. Just regular-priced items and out-of-state orders (no tax calculated).

The only thing these orders had in common was that Paypal was showing that the orders were not eligible for seller protection and addresses were unverified.

What a puzzle...

Thanks so much for looking into this!

Link to comment
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
×
×
  • Create New...