Jump to content
Latest News: (loading..)
Sign in to follow this  
Fredrik.r

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

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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites
I'm sure someone knows how to fix this.. please.. :)

 

I wish I could help, but I too am experiencing this problem and don't know how to fix. Anyone out there have an answer?

Edited by golfman2006

Share this post


Link to post
Share on other sites

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 :)

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×