EricK Posted February 4, 2004 Share Posted February 4, 2004 Hi, Can cheapest shipping = $0.00? Looks like the cheapest method is set starting line 147, in checkout_shipping.php: // if no shipping method has been selected, automatically select the cheapest method. // if the modules status was changed when none were available, to save on implementing // a javascript force-selection method, also automatically select the cheapest shipping // method if more than one module is now enabled if ( !tep_session_is_registered('shipping') || ( tep_session_is_registered('shipping') && ($shipping == false) && ( tep_count_shipping_modules() > 1) ) ) $shipping = $shipping_modules->cheapest(); This sets the cheapest method > $0; how can we include cheapest method=$0? Thank you, EricK :unsure: Link to comment Share on other sites More sharing options...
EricK Posted February 4, 2004 Author Share Posted February 4, 2004 I see the function "cheapest()" gets defined at: /includes/classes/shipping.php -> line 89 89 function cheapest() { 90 if (is_array($this->modules)) { 91 $rates = array(); 92 93 reset($this->modules); 94 while (list(, $value) = each($this->modules)) { 95 $class = substr($value, 0, strrpos($value, '.')); 96 if ($GLOBALS[$class]->enabled) { 97 $quotes = $GLOBALS[$class]->quotes; 98 for ($i=0, $n=sizeof($quotes['methods']); $i<$n; $i++) { 99 if (isset($quotes['methods'][$i]['cost']) && tep_not_null($quotes['methods'][$i]['cost'])) { 100 $rates[] = array('id' => $quotes['id'] . '_' . $quotes['methods'][$i]['id'], 101 'title' => $quotes['module'] . ' (' . $quotes['methods'][$i]['title'] . ')', 102 'cost' => $quotes['methods'][$i]['cost']); 103 } 104 } 105 } 106 } 107 108 $cheapest = false; 109 for ($i=0, $n=sizeof($rates); $i<$n; $i++) { 110 if (is_array($cheapest)) { 111 if ($rates[$i]['cost'] < $cheapest['cost']) { 112 $cheapest = $rates[$i]; 113 } 114 } else { 115 $cheapest = $rates[$i]; 116 } 117 } 118 119 return $cheapest; 120 } 121 } 122 } 123 ?> =========================== Would a PHP guru be so kind as to let me know how "cheapest" can also = $0 Thanks, EricK Link to comment Share on other sites More sharing options...
EricK Posted February 6, 2004 Author Share Posted February 6, 2004 Here is the answer :P - if you want default shipping to include $0.00 Free Shipping, edit catalog/includes/classes/shipping.php, line 99 to remove the "tep_not_null" function. this line: if (isset($quotes['methods'][$i]['cost']) && tep_not_null($quotes['methods'][$i]['cost'])) { to this: if (isset($quotes['methods'][$i]['cost'])) { I'm using 2.2 MS2 cheers, EricK Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.