Author Topic: I want to sort shipping method options by price.  (Read 3356 times)

Offline Alex1

  • Newbie
  • *
  • Posts: 10
  • Karma: +3/-0
    • View Profile
I want to sort shipping method options by price.
« on: July 27, 2024, 08:15:47 PM »
I am almost done migrating a site from a different e-commerce platform to AbanteCart 1.3.4 and I am testing the checkout page and noticed that the shipping method prices are not sorted from low to high. On this site, 99% of buyers choose the lowest-price shipping options. Therefore, I would like the lowest-priced shipping option to be listed at the top of the shipping carrier options list.

I can not find a way to sort shipping method options by price in the Admin area. I am using the USPS and UPS shipping extensions that are included with AbanteCart version 1.3.4.

Is there any way to sort the shipping method options by low to high price either in Admin settings, by changing or adding to a code file, by using an extension, or???

Offline abolabo

  • core-developer
  • Administrator
  • Hero Member
  • *****
  • Posts: 2067
  • Karma: +326/-13
  • web for all, all for web!
    • View Profile
    • AbanteCart
Re: I want to sort shipping method options by price.
« Reply #1 on: July 29, 2024, 05:52:55 AM »
One shipping operator can offer different methods of delivery.
For example Fedex or UPS.
Usually shopping extension call their API and sorts response by price.
in the same time if you have a few enabled shipping extensions each of them can obtain their own list of methods.
Another words, methods grouping my brand and then shown as list ordered by sort_order (see extension settings page)

“No one is useless in this world who lightens the burdens of another.”
― Charles Dickens

Offline Alex1

  • Newbie
  • *
  • Posts: 10
  • Karma: +3/-0
    • View Profile
Re: I want to sort shipping method options by price.
« Reply #2 on: July 29, 2024, 03:40:26 PM »
Thanks for your reply. I agree it is usual for shipping methods to be sorted from low to high prices.

The USPS and UPS shipping extensions that are included with AbanteCart version 1.3.4 do not sort shipping methods by low to high prices. They appear to sort shipping methods in ascending order according to the number at the end of their label's "for" attribute.

For example, with the UPS extension, the top shipping method is UPS Next Day Air which has a "for" attribute of "default_ups01default_ups.01". The second down shipping method is UPS Second Day Air which has a "for" attribute of "default_ups01default_ups.02". The third down shipping method is UPS Ground which has a "for" attribute of "default_ups01default_ups.03". Etc.

It is the same with the USPS extension, with the shipping methods being sorted in ascending order according to the number at the end of their label's "for" attribute.

For these UPS and USPS extensions, there is no option to change the sort order in the admin area.

I attached a screenshot showing how the shipping options are sorted.
« Last Edit: August 30, 2024, 04:15:31 PM by Alex1 »

Offline Alex1

  • Newbie
  • *
  • Posts: 10
  • Karma: +3/-0
    • View Profile
Re: I want to sort shipping method options by price.
« Reply #3 on: August 04, 2024, 05:15:57 AM »
I resolved this issue of the shipping options not sorting by low to high prices.

I did not want to edit the PHP files because when upgrading the the next version of AbanteCart I thought they may be replaced and the edits could be lost. So I used JavaScript to reorder the table rows on the checkout page by low to high price after the page’s DOM is fully loaded. I also updated the table rows so the shipping company name rows have a gray background and the shipping options rows have a white background. I attached a screenshot showing all of this.

I added the JavaScript to the custom.js file at storefront/view/default/javascript/. Was this a good place to add it or will this custom.js file be replaced when upgrading to a newer version of AbanteCart?
« Last Edit: September 03, 2024, 05:56:01 AM by Alex1 »

 

Powered by SMFPacks Social Login Mod