Guest Posted May 1, 2004 Share Posted May 1, 2004 Does anyone know how to make the checkout_shipping.php page default to a particular shipping method? Quote Link to comment Share on other sites More sharing options...
Guest Posted May 3, 2004 Share Posted May 3, 2004 please, anyone? Quote Link to comment Share on other sites More sharing options...
Mark Evans Posted May 3, 2004 Share Posted May 3, 2004 The shipping page should automatically select the cheapest option as default. Quote Mark Evans osCommerce Monkey & Lead Guitarist for "Sparky + the Monkeys" (Album on sale in all good record shops) --------------------------------------- Software is like sex: It's better when it's free. (Linus Torvalds) Link to comment Share on other sites More sharing options...
Guest Posted May 7, 2004 Share Posted May 7, 2004 Does anyone know how I could give my customers the ability to manually set a default shipping method and not have the system just defaultly choose the cheapest? Quote Link to comment Share on other sites More sharing options...
Guest Posted May 15, 2004 Share Posted May 15, 2004 Anyone? This feature seems like it could be very useful for a client. Does anyone have any ideas on how to do this? Quote Link to comment Share on other sites More sharing options...
TerryK Posted May 15, 2004 Share Posted May 15, 2004 I don't know if it will work or not, but you could try commenting out this part on /catalog/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(); To comment it out, change to: /* // 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(); */ I have not tested this, so I don't know whether there may be other implications along the way to removing it, so make sure you BACK UP your file before you start... HTH, Terry Quote Terry Kluytmans Contribs Installed: Purchase Without Account (PWA); Big Images, Product Availability, Description in Product Listing, Graphical Infobox, Header Tags Controller, Login Box, Option Type Feature, plus many layout changes & other mods of my own, like: Add order total to checkout_shipment Add order total to checkout_payment Add radio buttons at checkout_shipping (for backorder options, etc.) Duplicate Table Rate Shipping Module Better Product Review Flow * If at first you don't succeed, find out if there's a prize for the loser. * Link to comment Share on other sites More sharing options...
Guest Posted June 22, 2004 Share Posted June 22, 2004 That may or not stop the 'cheapest default' option being selected; but how would it be possible to select the default, rather than having the cart select it? Quote Link to comment Share on other sites More sharing options...
Guest Posted June 22, 2004 Share Posted June 22, 2004 Sup os? I was having problems with my customers using the cheapest (default) method for all their orders. I think this is because people get in a hurry. I disabled this default option by removing some code in a couple of pages. The end result..no shipping option is selected by default, forcing the user to make a selection, thus....READ. Here ya go part 1 includes/classes/shipping.php take out these lines(it is the last function on the page)...don't forget to complete the second part of this instruction function cheapest() { if (is_array($this->modules)) { $rates = array(); reset($this->modules); while (list(, $value) = each($this->modules)) { $class = substr($value, 0, strrpos($value, '.')); if ($GLOBALS[$class]->enabled) { $quotes = $GLOBALS[$class]->quotes; for ($i=0, $n=sizeof($quotes['methods']); $i<$n; $i++) { if (isset($quotes['methods'][$i]['cost']) && tep_not_null($quotes['methods'][$i]['cost'])) { $rates[] = array('id' => $quotes['id'] . '_' . $quotes['methods'][$i]['id'], 'title' => $quotes['module'] . ' (' . $quotes['methods'][$i]['title'] . ')', 'cost' => $quotes['methods'][$i]['cost']); } } } } $cheapest = false; for ($i=0, $n=sizeof($rates); $i<$n; $i++) { if (is_array($cheapest)) { if ($rates[$i]['cost'] < $cheapest['cost']) { $cheapest = $rates[$i]; } } else { $cheapest = $rates[$i]; } } return $cheapest; } } Part 2 catalog/checkout_shipping.php take out if ( !tep_session_is_registered('shipping') || ( tep_session_is_registered('shipping') && ($shipping == false) && (tep_count_shipping_modules() > 1) ) ) $shipping = $shipping_modules->cheapest(); I hope this helps. Thanks Dr Stomp Quote Link to comment Share on other sites More sharing options...
verstege Posted September 23, 2004 Share Posted September 23, 2004 I had this "problem" too. I made the changes DRStomp said and everything was OK. Thanx Quote Link to comment Share on other sites More sharing options...
thedream Posted July 22, 2005 Share Posted July 22, 2005 (edited) Not at all, guys, it's more simple, here is the complete and simple solution: 1. Open first the payment contribution you want as set as default: 2. find the line (around line 40): $this->quotes = array('id' => $this->code, 'module' => MODULE_SHIPPING_ yours ! _TEXT_TITLE, and add this just after the above: 'checked' => 'true', so you should have: $this->quotes = array('id' => $this->code, 'module' => MODULE_SHIPPING_ yours! _TEXT_TITLE, 'checked' => 'true', 'methods' => array()); Save and upload. 3. Now open the /catalog/checkout_shipping.php file, and find the following code: $checked = (($quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id'] == $shipping['id']) ? true : false); if ( ($checked == true) || ($n == 1 && $n2 == 1) ) { change it to: //$checked = (($quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id'] == $shipping['id']) ? true : false); //if ( ($checked == true) || ($n == 1 && $n2 == 1) ) { if ( ($quotes[$i]['checked'] == 'true') || ($n == 1 && $n2 == 1) ) { Now find a few line belong: <td class="main" align="right"><?php echo tep_draw_radio_field('shipping', $quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id'], $checked); ?></td> and change it to: <td width="118" align="right" valign="middle" class="main"><?php echo tep_draw_radio_field('shipping', $quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id'], $quotes[$i]['checked']); ?></td> That's it, you are done. Save, upload, refresh and you have it ! Marc Edited July 22, 2005 by thedream Quote osCommerce 2.2 MS2 in 6 languages TVA Intracomm Numbers of visitors online Who's online Enhancement .... 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.