Sort Shipping Modules by cost

By | March 20, 2012

Sorting the shipping modules is simple in osCommerce – just amend the sort order in the admin area. This is fine to do and works well.

I was recently approached to come up with an idea to sort the shipping modules based on the cost of shipping. This is much more difficult if the shipping modules are dynamic (eg, zones.php, table.php and so on).

With some lateral thinking I managed to come up with an idea and got some code that works;

This simple setting sorts the shipping modules by cost!

If the setting is “False”, then the modules look like this:

And if “True”, then this:

Conclusion

The main issue is that it is impossible to sort based on any type of sort_order via the admin IF the shipping module produces a dynamic price, that is a price that changes based on the value/weight of the order.

Leave a Reply

Your email address will not be published. Required fields are marked *