Zen Cart Logo
Forums / Built-in Shipping and Payment Modules / PP Express and Austpost Error

PP Express and Austpost Error

Locked

Views: 1,181

Results 1 to 8 of 8
This thread is locked. New replies are disabled.
21 Sep 2007, 11:10 AM
#1
neilg avatar

neilg

New Zenner

Join Date:
Dec 2006
Posts:
75
Plugin Contributions:
0

PP Express and Austpost Error

Hi all,

I hope you can help me! Paypal Express was working fine up till now. I have installed the AustPost module and the regular checkout process seems to work fine.

However when i click on PayPal Express, it takes me to Paypal with no problems but when it comes back to my site for shipping confirmation i get the following:

Warning: Division by zero in /var/virtual/web/w0713/html/store/includes/modules/shipping/austpost.php on line 166

Warning: Cannot modify header information - headers already sent by (output started at /var/virtual/web/w0713/html/store/includes/modules/shipping/austpost.php:166) in /var/virtual/web/w0713/html/store/includes/functions/functions_general.php on line **44

**Can anyone please help?
Cheers,
Neil

23 Sep 2007, 12:19 AM
#2
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: PP Express and Austpost Error

G'day Neil,

Your problem is a real puzzler. The reason being is that the Austpost module has no code associated with it that would cause it to act differently on the basis of method of payment.
Furthermore, to the best of my knowledge, the PPexpress should NOT be coming back to your store to 'confirm shipping price', and even if it did do this, the portion of code producing the error shouldn't be executed because this is part of the code that 'builds' ALL of the shipping quotes, not just the quote that had been previously selected prior to clicking the PP express link.

In other words, as the author of the austPost module, I'm totally at a loss to explain the ultimate cause of the problem.

What I can tell you (in addition to the above) is even though this code shouldn't be executed after the payment link has been clicked, the actual error (Division by zero) is being caused because the product(s) in the cart at the time of the error are missing one or more of their dimensions.. This is probably because the code is called with no valid data, which is kinda what I'd expect to occur if it is being executed when it shouldn't be.

About the only useful thing I can suggest at this stage is for you to double check what page the PP express module is returning you too, because it really shouldn't be returning to the austpost shipping module.

Cheers
Rod

23 Sep 2007, 12:26 AM
#3
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: PP Express and Austpost Error

Just to clarify ...

The PayPal Express Checkout module does return to the store and proceed through the normal checkout stages. But, it does so just as if the customer had clicked on the checkout_shipping page link to commence checkout. It uses the customer's address coming back from PayPal, and builds shipping quotes based on the products in the cart, just as it would for any normal checkout process.

The customer may never see this happen if the administrator has the PP module set to auto-select the cheapest shipping method ... but it still has to go through the normal quoting process in order to determine said method.

23 Sep 2007, 12:51 AM
#4
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: PP Express and Austpost Error

DrByte:

Just to clarify ...

The PayPal Express Checkout module does return to the store and proceed through the normal checkout stages. But, it does so just as if the customer had clicked on the checkout_shipping page link to commence checkout. It uses the customer's address coming back from PayPal, and builds shipping quotes based on the products in the cart, just as it would for any normal checkout process.

The customer may never see this happen if the administrator has the PP module set to auto-select the cheapest shipping method ... but it still has to go through the normal quoting process in order to determine said method.

DrB, thanks for the clarification. Alas, I'm not sure if it helps solve Neils' problem of not (I'm still no closer to an explanation). Do YOU have any ideas on what would cause the shipping module to fail, but only with PP Express?

Neil, If you load /includes/modules/shipping/austpost.php into a text editor and locate line#96 you should see a line that reads "debug = 0", if you change this to 'debug = 1' the austpost module will spew out a lot of useful debugging information when it is called. This may or may not give you a clue as to what is going wrong.

Cheers
Rod

23 Sep 2007, 9:56 AM
#5
neilg avatar

neilg

New Zenner

Join Date:
Dec 2006
Posts:
75
Plugin Contributions:
0

Re: PP Express and Austpost Error

Rod/Dr Byte,

Thank you for your help so far. So I changed the debug as you suggested and now I get this:

via CartC 0 - W 0 - H 2 - L 0 - I
Warning: Division by zero in /var/virtual/web/w0713/html/store/includes/modules/shipping/austpost.php on line 166
Warning: Cannot modify header information - headers already sent by (output started at /var/virtual/web/w0713/html/store/includes/modules/shipping/austpost.php:98) in /var/virtual/web/w0713/html/store/includes/functions/functions_general.php on line 44

I have the dimensions on the product set to L=25 W=25 H=2 and 100 gms

Any other ideas?

Cheers,
Neil

23 Sep 2007, 10:09 AM
#6
neilg avatar

neilg

New Zenner

Join Date:
Dec 2006
Posts:
75
Plugin Contributions:
0

Re: PP Express and Austpost Error

hold that thought guys....i think I may have figured it out....will keep you posted so you know what the solution is!

23 Sep 2007, 10:44 AM
#7
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: PP Express and Austpost Error

G'day Neil,

now I get this:
via Cart

This implies the user is logged in (IOW, not a guest account). I'm not sure if this is important at this stage, but it is worth noting that due to the way zencart works, the Austpost module gets its data to calculate prices from one of two places.. either the users 'personal' shopping cart, OR, if the user isn't logged in, via data stored in the SESSION variables.
Data stored via the session variables should be copied into the users cart when the log in. I'm not sure at what point in the PayPal Express process this actually occurs.
In other words, the austpost module may be trying to obtain data from the users cart when it should really be getting it from the session data?

C 0 - W 0 - H 2 - L 0 - I

This pretty much confirms that the AustPost module doesn't have valid data to work with. The rest of the error messages can be ignored.

I have the dimensions on the product set
to L=25 W=25 H=2 and 100 gms

The "- W 0 - H 2 - L 0" in the debug message is telling us/me that it has a W=0, L=0, and H=2.
IOW, only the H variable appears valid.

The last, and only other time I've seen something similar to this was when someone was trying to use the austpost module with a zencart version earlier than 1.3.7, so I guess this is the first thing you need to check and confirm.

Another thing that may help in the debug process is to locate line 97 in austpost.php, and alter it so that instead of reading
if (isset($_SESSION['customer_id'])) {

It reads
if (isset($_SESSION['dummy'])) {

This will cause this check to FAIL, and therefore force the data to be obtained from the session variables rather than the users cart.
Needless to say, you should not leave the code this way, because it will break more than it fixes. I'm not even sure if this will have the effect I'm expecting or not, it is merely a means of trying to isolate where the valid data actually exists at the point in time it is being called.
Anyway, with this change in place, and debug still enabled, you should see among the output "via session"
and the "C 0 - W 0 - H 2 - L 0 - I " line should have no zeros.
If this IS the case, then we are one step closer to the solution, however, if you get 'via session' and no change on the zeros I/we are barking up the wrong tree.

Lemme know your results.
Cheers
Rod

25 Sep 2007, 1:26 AM
#8
neilg avatar

neilg

New Zenner

Join Date:
Dec 2006
Posts:
75
Plugin Contributions:
0

Re: PP Express and Austpost Error

ok Rod....i got there in the end and it was a simple fix!

in the payment options for ppexpress I had this selected to yes instead of No.

Express Checkout: Select Cheapest Shipping Automatically
No

It all seems to be good now.

I appreciate your help guys...again I couldnt have done it on my own without some of the ideas and suggestions you came up with.

Many thanks,
Neil