I was in a situation where the name of the shipping method contained the number at the end with all other naming exactly the same, so if it was shipping_method_9 and shipping_method_10 then shipping_method_10 is sorted before shipping_method_9 so I am updating the js to sort the shipping methods by rate. Will attach code once issue is created

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

robbiethegeek’s picture

patch code

longwave’s picture

Category: bug » feature
longwave’s picture

http://drupal.org/project/uc_checkout_tweaks can do this but it could be useful to merge that into Ubercart core.

robbiethegeek’s picture

Here is better logic and actually working code :)

robbiethegeek’s picture

If nothing else this seems like a much more sensible default.

longwave’s picture

Wouldn't it be easier to sort them server-side?

TR’s picture

Status: Active » Needs review

The shipping methods that use an external API, i.e. UPS, USPS, FedEx, Canada Post, already return rates sorted by price. If you have all these methods enabled, you will see them grouped by carrier then sorted from low price to high price within that carrier. I think this is how is should be - I think it would be bad to interleave UPS, USPS, and FedEx quotes, for instance.

The OP's issue seems to be that the flatrate and weightquote methods *don't* have this sorting, so if for example you have several flatrates they will not necessarily appear sorted by price. I think that sorting should be added to uc_flatrate and uc_weightquote - it should *not* be done in uc_quote as that would result in the interleaving I mentioned above. And as #6 said, this should not be done in JavaScript either, it should be done on the server side just as it's done by uc_ups and uc_usps in core.

TR’s picture

Status: Needs review » Needs work

Wrong status.

EDIT: Actually, now that I think about it, you can't sort in uc_flatrate or uc_weightquote because these don't return multiple quotes like for example uc_usps does. Each user-defined flatrate or weightquote returns one and only one number. Because of this, I think the way to sort would be to assign the desired "list position" to each user-defined method. This can be done through the Ubercart user interface (admin/store/settings/quotes/methods/edit), so I don't see that any change is needed here.

longwave’s picture

Title: Shipping Quotes should be ordered by Rate » Shipping Quotes should be ordered by rate or name
Version: 6.x-2.2 » 6.x-2.x-dev

#1091768: Arrange shipping methods requested ordering them another way, so perhaps this needs to be a configuration option.

TR’s picture

Version: 6.x-2.x-dev » 7.x-3.x-dev
Status: Needs work » Postponed

Actually, I think #1091768: Arrange shipping methods is essentially the same as #624692: Improve theme-ability of shipping quotes EVEN MORE and can be handled in that issue.

The only issue left for consideration is whether we should enable intermingling of quotes from different carriers when sorting by rate. I personally don't think so, but if someone feels strongly enough about this to write a patch that works for 7.x-3.x, passes the test cases, adds an admin option for this new sort order to make it optional (and off by default to be backwards compatible), and deals properly with the changes proposed in #624692: Improve theme-ability of shipping quotes EVEN MORE (which I *do* think should be added), then we can put this into Ubercart. New features like this should go into 7.x-3.x first.

SilviuChingaru’s picture

Assigned: Unassigned » SilviuChingaru
TR’s picture

@fiftyz - you assigned this to yourself, is this something you're working on?

SilviuChingaru’s picture

Assigned: SilviuChingaru » Unassigned
Issue summary: View changes
TR’s picture

Status: Postponed » Closed (won't fix)

Three years later, my opinion from #11 hasn't changed and no one seems to want this, so I'm closing it.