Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Need help with the code choosing which shipping method be be checked


Fredrik.r

Recommended Posts

It seems like the cheapest shipping method is checked by default in checkout_shipping.php. So far so good, that's fair. But, when offering free shipping ($0) and express shipping ($10) it keeps check the express method.. It doesnt seem it can compare these if one of them are zero. I want it to check the free shipping, otherwise customers might just click forward to checkout payment.

 

I believe the function is below somewhere but I do not understand it;

 

		  for ($j=0, $n2=sizeof($quotes[$i]['methods']); $j<$n2; $j++) {
// set the radio button to be checked if it is the method chosen
		$checked = (($quotes[$i]['id'] . '_' . $quotes[$i]['methods'][$j]['id'] == $shipping['id']) ? true : false);

		if ( ($checked == true) || ($n == 1 && $n2 == 1) ) {
		  echo '				  <tr id="defaultSelected" class="moduleRowSelected" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n";
		} else {
		  echo '				  <tr class="moduleRow" onmouseover="rowOverEffect(this)" onmouseout="rowOutEffect(this)" onclick="selectRowEffect(this, ' . $radio_buttons . ')">' . "\n";
		}
?>
					  <td class="main" width="75%"><?php echo $quotes[$i]['methods'][$j]['title']; ?></td>
					  <?php
		if ( ($n > 1) || ($n2 > 1) ) {
?>

Edited by Fredrik.r
Link to comment
Share on other sites

Any ideas about this? Some customers just click forward and pays for express shipping when they actually can choose free shipping.

Edited by Fredrik.r
Link to comment
Share on other sites

  • 3 weeks later...
  • 3 weeks later...
The code above may not be the right one, it may be in includes/classes/shipping.php

 

Let's hope someone knows how to fix this :)

That code has nothing to do with your problem. The sorting is done in PHP, not HTML, in shipping.php, i think. If you are still interested in this problem drop me a line.

Link to comment
Share on other sites

  • 3 weeks later...

Got the same problem. I had the multitable contribution installed before and now I got the multizones multi tables contrib up and running. I modified it a bit to reflect my way of calculating the shipping cost and that's working fine. Only thing is that with the contrib used before and with this one the second option is selected by default. The first option is always zero but somehow the cheapest() in classes/shipping.php ignores this. Any idea what I need to change?

 

abra

The First Law of E-Commerce: If the user can't find the product, the user can't buy the product.

 

Feedback and suggestions on my shop welcome.

 

Note: My advice is based on my own experience or on something I read in these forums. No guarantee it'll work for you! Make sure that you always BACKUP the database and the files you are going to change so that you can rollback to a working version if things go wrong.

Link to comment
Share on other sites

You are using the free shipping option as I understand. Disable free shipping. Then install another shipping module that performs the role of free shipping, ie if the order is over a specific amount you activate the module to return 0, otherwise you disable it (or whatever the conditions are for free shipping for your store). Then the cheapest will default to the cheapest method.

Link to comment
Share on other sites

Sorry, if I wasn't clear enough. I'm using the MultiGeoZone MultiTable Shipping contribution. I have 3 zones with 4 tables each (economy pickup, express pickup, economy courier and express courier). Economy pickup is always free so the table entry is 0:0. Economy courier is a flat rate per 30 kg packet so the table entry is 0:7, 30:14, 60:21 etc. The express pickup and courier charges depend on the weight, the table is something like this: 0:19, 8: 24, 18: 28 etc.

 

During checkout all four table rates for the zone are displayed correctly but the economy pickup is never preselected as the cheapest. It's always the second table rate.

 

I checked the shipping.php but couldn't figure out why it wouldn't set the first table rate to be the cheapest.

 

abra

The First Law of E-Commerce: If the user can't find the product, the user can't buy the product.

 

Feedback and suggestions on my shop welcome.

 

Note: My advice is based on my own experience or on something I read in these forums. No guarantee it'll work for you! Make sure that you always BACKUP the database and the files you are going to change so that you can rollback to a working version if things go wrong.

Link to comment
Share on other sites

Thanks, enigma1!

 

I guessed it's this bit and I thought I had modified it correctly... It was obviously too late last night to do it properly.

 

abra

The First Law of E-Commerce: If the user can't find the product, the user can't buy the product.

 

Feedback and suggestions on my shop welcome.

 

Note: My advice is based on my own experience or on something I read in these forums. No guarantee it'll work for you! Make sure that you always BACKUP the database and the files you are going to change so that you can rollback to a working version if things go wrong.

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