jamescalvin Posted December 31, 2005 Share Posted December 31, 2005 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? Quote Web Development, 365... 366 in a leap year. Link to comment Share on other sites More sharing options...
wheeloftime Posted December 31, 2005 Share Posted December 31, 2005 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 Quote Link to comment Share on other sites More sharing options...
jamescalvin Posted December 31, 2005 Author Share Posted December 31, 2005 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?? Quote Web Development, 365... 366 in a leap year. Link to comment Share on other sites More sharing options...
wheeloftime Posted December 31, 2005 Share Posted December 31, 2005 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. Quote Link to comment Share on other sites More sharing options...
jamescalvin Posted December 31, 2005 Author Share Posted December 31, 2005 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 Quote Web Development, 365... 366 in a leap year. Link to comment Share on other sites More sharing options...
jamescalvin Posted December 31, 2005 Author Share Posted December 31, 2005 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... Quote Web Development, 365... 366 in a leap year. Link to comment Share on other sites More sharing options...
wheeloftime Posted December 31, 2005 Share Posted December 31, 2005 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 ? Quote Link to comment Share on other sites More sharing options...
jamescalvin Posted December 31, 2005 Author Share Posted December 31, 2005 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? Quote Web Development, 365... 366 in a leap year. Link to comment Share on other sites More sharing options...
wheeloftime Posted December 31, 2005 Share Posted December 31, 2005 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.