Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Shipping Module Error


Buddy0802

Recommended Posts

I need help determining why my checkout function isn't working. It was working before and I haven't changed anything, now it doesn't work. (The only reason I know it doesn't work is that a customer sent an email saying they can't check out.) I get the following error message:

-------------------------------------------

 

"Warning: Division by zero in /hsphere/local/home/home/---/---..com/catalog/includes/classes/shipping.php on line 61

 

Warning: Division by zero in /hsphere/local/home/home/---/---..com/catalog/includes/classes/shipping.php on line 62

 

Warning: Cannot modify header information - headers already sent by (output started at /hsphere/local/home/---/---.com/catalog/includes/classes/shipping.php:61) in /hsphere/local/home/home/---/---.com/catalog/includes/functions/general.php on line 33"

 

-------------------------------------------

 

[This warning was generated when I used my dummy customer and "purchased" the same products as my real customer said they were trying to purchase.]

 

 

This is how the code reads in shipping.php:

------------------------------------

44 function quote($method = '', $module = '') {

45 global $total_weight, $shipping_weight, $shipping_quoted, $shipping_num_boxes;

46

47 $quotes_array = array();

48

49 if (is_array($this->modules)) {

50 $shipping_quoted = '';

51 $shipping_num_boxes = 1;

52 $shipping_weight = $total_weight;

53

54 if (SHIPPING_BOX_WEIGHT >= $shipping_weight*SHIPPING_BOX_PADDING/100) {

55 $shipping_weight = $shipping_weight+SHIPPING_BOX_WEIGHT;

56 } else {

57 $shipping_weight = $shipping_weight + ($shipping_weight*SHIPPING_BOX_PADDING/100);

58 }

59

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

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

62 $shipping_weight = $shipping_weight/$shipping_num_boxes;

63 }

64

65 $include_quotes = array();

66

67 reset($this->modules);

68 while (list(, $value) = each($this->modules)) {

69 $class = substr($value, 0, strrpos($value, '.'));

70 if (tep_not_null($module)) {

71 if ( ($module == $class) && ($GLOBALS[$class]->enabled) ) {

72 $include_quotes[] = $class;

73 }

74 } elseif ($GLOBALS[$class]->enabled) {

75 $include_quotes[] = $class;

76 }

77 }

78

79 $size = sizeof($include_quotes);

80 for ($i=0; $i<$size; $i++) {

81 $quotes = $GLOBALS[$include_quotes[$i]]->quote($method);

82 if (is_array($quotes)) $quotes_array[] = $quotes;

83 }

84 }

85

86 return $quotes_array;

87 } }

 

---------------------------------

 

this is how the code reads in general.php:

 

---------------------------------

21 // Redirect to another page or site

22 function tep_redirect($url) {

23 if ( (strstr($url, "\n") != false) || (strstr($url, "\r") != false) ) {

24 tep_redirect(tep_href_link(FILENAME_DEFAULT, '', 'NONSSL', false));

25 }

26

27 if ( (ENABLE_SSL == true) && (getenv('HTTPS') == 'on') ) { // We are loading an SSL page

28 if (substr($url, 0, strlen(HTTP_SERVER)) == HTTP_SERVER) { // NONSSL url

29 $url = HTTPS_SERVER . substr($url, strlen(HTTP_SERVER)); // Change it to SSL

30 }

31 }

32

33 header('Location: ' . $url);

34

35 tep_exit();

36 }

37

38 ////

 

----------------------------------

 

I have various types of products (Qty of 1 only of each product) all of which vary in weight from less than 1 oz to 5 pounds. I need to be able to adjust the shipping costs according to the individual weight of each product, or if multiple products are purchased, on the combination of weights.

1 - First of all, I do not see any way to enter a weight of less than 1 lb on each product, so that is the amount I have entered.

2 - Secondly, I do not understand how to enter the appropriate corresponding information into the Table Rate.

3 - Currently I have my shipping set to Flat Rate of $5

I do not understand what is triggering this error message, how to fix it, nor how to set the shipping to behave the way I want it to.

 

Does anyone have any helpful hints for me please? I am pretty much a php novice ande I am desperate to get this resolved and soon! My store is totally useless at the moment!

Link to comment
Share on other sites

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

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

62 $shipping_weight = $shipping_weight/$shipping_num_boxes;

63 }

 

replace by

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

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

if( $shipping_num_boxes <= 0)

$shipping_num_boxes=1;

62 $shipping_weight = $shipping_weight/$shipping_num_boxes;

63 }

 

the other way is to make sure no product has 0 weight.

 

Satish

Ask/Skype for Free osCommerce value addon/SEO suggestion tips for your site.

 

Check My About US For who am I and what My company does.

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...