tc0nn Posted August 1, 2006 Share Posted August 1, 2006 Don't know if this has been discussed or fixed, but I had items over $40 ship free, but when the shipping methods appeared, the first non-$0 method would be selected by default. to fix: Line 100 in catalog/includes/shipping.php... if (isset($quotes['methods'][$i]['cost']) && tep_not_null($quotes['methods'][$i]['cost'])) { simply change to: if (isset($quotes['methods'][$i]['cost'])){ Quote Link to comment Share on other sites More sharing options...
n2advnture Posted August 15, 2006 Share Posted August 15, 2006 there doesn't appear to be a "shipping.php" under catalog/includes... Quote Link to comment Share on other sites More sharing options...
designgroop Posted October 15, 2006 Share Posted October 15, 2006 Many thanks for this quick fix - it had been a little above my PHP abilities to track this down. The correct location for the file to change is: catalog/includes/classes/shipping.php For other users trying to find this fix, some keywords: Cheapest function problem issue fix oscommerce lowest price first free shipping postage shipping.php ship in cart Quote Link to comment Share on other sites More sharing options...
one71 Posted January 31, 2008 Share Posted January 31, 2008 Hi, I use an older version of oscommerce and am also trying to get it so that the "Pickup $0" option is not the default shipping method. I have copied below my shipping.php file. Any help would be hugely appreciated. Cheers. <?php class shipping { var $modules; // class constructor function shipping() { global $shipping_count, $language; $shipping_count = 0; if (MODULE_SHIPPING_INSTALLED) { $this->modules = explode(';', MODULE_SHIPPING_INSTALLED); // get array of accepted modules reset($this->modules); while (list(, $value) = each($this->modules)) { include(DIR_WS_LANGUAGES . $language . '/modules/shipping/' . $value); include(DIR_WS_SHIPPING_MODULES . $value); $class = substr($value, 0, strrpos($value, '.')); $GLOBALS[$class] = new $class; } } } // class methods function selection() { $selection_string = ''; if (MODULE_SHIPPING_INSTALLED) { reset($this->modules); while (list(, $value) = each($this->modules)) { $class = substr($value, 0, strrpos($value, '.')); if ($GLOBALS[$class]->enabled) { $selection_string .= $GLOBALS[$class]->selection(); } } $selection_string .= tep_draw_hidden_field('shipping_quote_all', '0'); } return $selection_string; } function quote() { global $total_weight, $shipping_weight, $shipping_quoted, $shipping_num_boxes; if (MODULE_SHIPPING_INSTALLED) { $shipping_quoted = ''; $shipping_num_boxes = 1; $shipping_weight = $total_weight; if ($total_weight > SHIPPING_MAX_WEIGHT) { // Split into many boxes $shipping_num_boxes = ceil($total_weight/SHIPPING_MAX_WEIGHT); $shipping_weight = $total_weight/$shipping_num_boxes; } if ($shipping_weight < SHIPPING_BOX_WEIGHT*SHIPPING_BOX_PADDING) { $shipping_weight = $shipping_weight+SHIPPING_BOX_WEIGHT; } else { $shipping_weight = $shipping_weight + ($shipping_weight*SHIPPING_BOX_PADDING/100); } reset($this->modules); while (list(, $value) = each($this->modules)) { $class = substr($value, 0, strrpos($value, '.')); if ($GLOBALS[$class]->enabled) { $GLOBALS[$class]->quote(); } } } } function cheapest() { if (MODULE_SHIPPING_INSTALLED) { reset($this->modules); while (list(, $value) = each($this->modules)) { $class = substr($value, 0, strrpos($value, '.')); if ($GLOBALS[$class]->enabled) { $GLOBALS[$class]->cheapest(); } } } } function display() { $display_string = ''; if (MODULE_SHIPPING_INSTALLED) { reset($this->modules); while (list(, $value) = each($this->modules)) { $class = substr($value, 0, strrpos($value, '.')); if ($GLOBALS[$class]->enabled) { $display_string .= $GLOBALS[$class]->display(); } } } return $display_string; } function confirm() { global $shipping_cost, $shipping_method; if (MODULE_SHIPPING_INSTALLED) { $confirm_string .= '<input type="hidden" name="shipping_cost" value="' . $shipping_cost . '">' . '<input type="hidden" name="shipping_method" value="' . $shipping_method . '">'; reset($this->modules); while (list(, $value) = each($this->modules)) { $class = substr($value, 0, strrpos($value, '.')); if ($GLOBALS[$class]->enabled) { $confirm_string .= $GLOBALS[$class]->confirm(); } } return $confirm_string; } } } ?> Quote Link to comment Share on other sites More sharing options...
one71 Posted February 2, 2008 Share Posted February 2, 2008 Anyone? Quote Link to comment Share on other sites More sharing options...
one71 Posted March 9, 2008 Share Posted March 9, 2008 Bump Quote Link to comment Share on other sites More sharing options...
satish Posted March 12, 2008 Share Posted March 12, 2008 $GLOBALS[$class]->cheapest(); This is responsible. Satish Quote 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 More sharing options...
itskashi Posted March 13, 2008 Share Posted March 13, 2008 Hi,I use an older version of oscommerce and am also trying to get it so that the "Pickup $0" option is not the default shipping method. I have copied below my shipping.php file. Any help would be hugely appreciated. Cheers. <?php class shipping { var $modules; // class constructor function shipping() { global $shipping_count, $language; $shipping_count = 0; if (MODULE_SHIPPING_INSTALLED) { $this->modules = explode(';', MODULE_SHIPPING_INSTALLED); // get array of accepted modules reset($this->modules); while (list(, $value) = each($this->modules)) { include(DIR_WS_LANGUAGES . $language . '/modules/shipping/' . $value); include(DIR_WS_SHIPPING_MODULES . $value); $class = substr($value, 0, strrpos($value, '.')); $GLOBALS[$class] = new $class; } } } // class methods function selection() { $selection_string = ''; if (MODULE_SHIPPING_INSTALLED) { reset($this->modules); while (list(, $value) = each($this->modules)) { $class = substr($value, 0, strrpos($value, '.')); if ($GLOBALS[$class]->enabled) { $selection_string .= $GLOBALS[$class]->selection(); } } $selection_string .= tep_draw_hidden_field('shipping_quote_all', '0'); } return $selection_string; } function quote() { global $total_weight, $shipping_weight, $shipping_quoted, $shipping_num_boxes; if (MODULE_SHIPPING_INSTALLED) { $shipping_quoted = ''; $shipping_num_boxes = 1; $shipping_weight = $total_weight; if ($total_weight > SHIPPING_MAX_WEIGHT) { // Split into many boxes $shipping_num_boxes = ceil($total_weight/SHIPPING_MAX_WEIGHT); $shipping_weight = $total_weight/$shipping_num_boxes; } if ($shipping_weight < SHIPPING_BOX_WEIGHT*SHIPPING_BOX_PADDING) { $shipping_weight = $shipping_weight+SHIPPING_BOX_WEIGHT; } else { $shipping_weight = $shipping_weight + ($shipping_weight*SHIPPING_BOX_PADDING/100); } reset($this->modules); while (list(, $value) = each($this->modules)) { $class = substr($value, 0, strrpos($value, '.')); if ($GLOBALS[$class]->enabled) { $GLOBALS[$class]->quote(); } } } } function cheapest() { if (MODULE_SHIPPING_INSTALLED) { reset($this->modules); while (list(, $value) = each($this->modules)) { $class = substr($value, 0, strrpos($value, '.')); if ($GLOBALS[$class]->enabled) { $GLOBALS[$class]->cheapest(); } } } } function display() { $display_string = ''; if (MODULE_SHIPPING_INSTALLED) { reset($this->modules); while (list(, $value) = each($this->modules)) { $class = substr($value, 0, strrpos($value, '.')); if ($GLOBALS[$class]->enabled) { $display_string .= $GLOBALS[$class]->display(); } } } return $display_string; } function confirm() { global $shipping_cost, $shipping_method; if (MODULE_SHIPPING_INSTALLED) { $confirm_string .= '<input type="hidden" name="shipping_cost" value="' . $shipping_cost . '">' . '<input type="hidden" name="shipping_method" value="' . $shipping_method . '">'; reset($this->modules); while (list(, $value) = each($this->modules)) { $class = substr($value, 0, strrpos($value, '.')); if ($GLOBALS[$class]->enabled) { $confirm_string .= $GLOBALS[$class]->confirm(); } } return $confirm_string; } } } ?> Hi- Oops, you are using quite old version of Oscommerce. In newer version you would edit the shipping.php class file, but the version you are using. You would edit the modules/shipping/item.php. Just make the cheapest() return $shipping_cheapest = 'item'; That shall work for any shipping methods that you want to make default selected. Go to the corresponding module file and modify the cheapest(). _ Thanks kashif Quote Link to comment Share on other sites More sharing options...
krdito Posted March 1, 2016 Share Posted March 1, 2016 (edited) 10 years after this original thread, I made the code change recommended in the top post by tc0nn, and it worked! My situation - my site is set up to default to the cheapest of two shipping methods, Priority Mail and Express Mail. Today, I decided to offer free Priority Mail shipping, but in making it free, the site now defaulted to Express Mail (certainly not the cheapest). After reading many, many threads on this topic, I stumbled upon this one, and my problem was solved! Thank you!! Edited March 1, 2016 by krdito 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.