Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Getting error when trying to use shipping table


jamescalvin

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.

Link to comment
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

Link to comment
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.

Link to comment
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.

Link to comment
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.

Link to comment
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 ?

Link to comment
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.

Link to comment
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.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...