Hello,
Does anyone know how the sort order is determined for the USPS shipping options when you get to the checkout? In a store I am putting together, I have only Priority and Express options available to customers. By default, the Express option is listed first and also checked. I would like to have the Priority option listed first and checked.
I've already managed to get the Priority option selected by default by modifying line 374 of uspsv4.php from
$checked = ((urlencode(@$d["shipping_rate_id"]) == $shipping_rate_id) || ($i==0)) ? "checked=\"checked\"" : "";
to:
$checked = "Priority+Mail" ? "checked=\"checked\"" : "";
However, I'm unable to get the Priority option to show first. I even went so far as to switch USPS_SHIP3 with USPS_SHIP6 thinking that the checkout page was putting the order together based on the numbers. Thanks for any help!
I too am trying to do exactly what you're trying and am finding no success. I was also trying the same default switch you tried but it gave me a different option instead(from Express Mail to Media Mail). I changed the same line;
$checked = ((urlencode(@$d["shipping_rate_id"]) == $shipping_rate_id) || ($i==0)) ? "checked=\"checked\"" : "";
I changed the variable $i ==0 to $i==1 which was the next item in the array that I wanted to be the default. I hop this helps others. And I still long to find out how to change the order in which they are displayed.
Hi,
I believe they're ordered by class of service or price. The simplest solution is to reverse the order of the arrays like this:
//Sort rates low to high
$ship_service = array_reverse($ship_service);
$ship_postage = array_reverse($ship_postage);
$ship_commit = array_reverse($ship_commit);
$ship_commit = array_reverse($ship_weight);
prior to the "Finally, write out shipping options" comment.
Carlos