Jump to content
Sign in to follow this  
jamescalvin

Getting error when trying to use shipping table

Recommended Posts

Hey everyone, I'm usually pretty good about finding out my own answers but for the past few days I've been stuck on this one. Can anyone help me out please??

 

Problem:

I set my shipping table to the following: 10:8.99,20:16.99,25:19.99,35:23.99,40:27.99,50:31.98 but when a customer goes to check out, they get the following error:

 

Warning: Division by zero in ...catalog/includes/classes/shipping.php on line 76

 

Warning: Division by zero in ...catalog/includes/classes/shipping.php on line 77

 

Upon getting this error, the customer can still check out without paying a shipping price.

 

Does anyone know what this means?


Web Development, 365... 366 in a leap year.

Share this post


Link to post
Share on other sites
Hey everyone, I'm usually pretty good about finding out my own answers but for the past few days I've been stuck on this one. Can anyone help me out please??

 

Problem:

I set my shipping table to the following: 10:8.99,20:16.99,25:19.99,35:23.99,40:27.99,50:31.98 but when a customer goes to check out, they get the following error:

 

Warning: Division by zero in ...catalog/includes/classes/shipping.php on line 76

 

Warning: Division by zero in ...catalog/includes/classes/shipping.php on line 77

 

Upon getting this error, the customer can still check out without paying a shipping price.

 

Does anyone know what this means?

 

It did work before ?! Have you done any mods especially to this file ?

In my unaltered classes/shipping.php those two line numbers point to

  }
}

which doesn't give much of a clue

Share this post


Link to post
Share on other sites
It did work before ?! Have you done any mods especially to this file ?

In my unaltered classes/shipping.php those two line numbers point to

  }
}

which doesn't give much of a clue

 

Yes, there was some modifications done on that page. My lines 76 and 77 look like this:

 

		  
$shipping_num_boxes = ceil($shipping_weight/SHIPPING_MAX_WEIGHT);
$shipping_weight = $shipping_weight/$shipping_num_boxes;

 

Any clues??


Web Development, 365... 366 in a leap year.

Share this post


Link to post
Share on other sites
Yes, there was some modifications done on that page. My lines 76 and 77 look like this:

 

		  
$shipping_num_boxes = ceil($shipping_weight/SHIPPING_MAX_WEIGHT);
$shipping_weight = $shipping_weight/$shipping_num_boxes;

 

Any clues??

 

Yep, that makes a difference for sure :rolleyes:

Your SHIPPING_MAX_WEIGHT is not set right/coming thru making the $shipping_num_boxes always zero.

The original code in shipping.php says

		if ($shipping_weight > SHIPPING_MAX_WEIGHT) { // Split into many boxes
	  $shipping_num_boxes = ceil($shipping_weight/SHIPPING_MAX_WEIGHT);
	  $shipping_weight = $shipping_weight/$shipping_num_boxes;
	}

so those lines are only executed when the calculated shipping weight for the total products inside the shopping cart is larger then the Maximum shipping weight you have set within your admin->configuration->shipping/packaging

 

If you left that check of you might get a value of zero for the variable $shipping_num_boxes and when that happens the next line will give a division by zero.

Share this post


Link to post
Share on other sites

I'm not exactly sure I know what all that means. So should I add this:

 

 if ($shipping_weight > SHIPPING_MAX_WEIGHT) { // Split into many boxes


Web Development, 365... 366 in a leap year.

Share this post


Link to post
Share on other sites
I'm not exactly sure I know what all that means. So should I add this:

 

 if ($shipping_weight > SHIPPING_MAX_WEIGHT) { // Split into many boxes

 

Actually, I just went back to my code and checked, it's already added...


Web Development, 365... 366 in a leap year.

Share this post


Link to post
Share on other sites
Actually, I just went back to my code and checked, it's already added...

 

Yes, probably your source is just pushed a bit down when doing changes. What is your setting for the Maximum Weight to ship ? And what changes have you made to your shipping.php ?

Share this post


Link to post
Share on other sites
Yes, probably your source is just pushed a bit down when doing changes. What is your setting for the Maximum Weight to ship ? And what changes have you made to your shipping.php ?

 

How can I find my setting for the Maximum Weight to ship? I'm not exactly sure what was modified because I had a programmer make a modification to a contribution. Is it possible I can PM you my code so you can take a look at it?


Web Development, 365... 366 in a leap year.

Share this post


Link to post
Share on other sites
How can I find my setting for the Maximum Weight to ship? I'm not exactly sure what was modified because I had a programmer make a modification to a contribution. Is it possible I can PM you my code so you can take a look at it?

 

The maximum shipping weight is set in your admin->configuration->shipping/packaging. PM the code and I'll take a look.

Share this post


Link to post
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
Sign in to follow this  

×