Author Topic: Sort items in cart according to price  (Read 3018 times)

Offline potangina

  • Newbie
  • *
  • Posts: 10
  • Karma: +0/-0
    • View Profile
Sort items in cart according to price
« on: March 06, 2018, 11:03:21 AM »
Hello! how can i sort items in the cart according to price?
"Death is like a wind, always by my side"
- Cancer

Offline abantecart

  • Administrator
  • Hero Member
  • *****
  • Posts: 4358
  • Karma: +298/-10
    • View Profile
    • Ideal Open Source Ecommerce Solution
Re: Sort items in cart according to price
« Reply #1 on: March 06, 2018, 06:40:45 PM »
A little more details would be helpful.

I assume you refer to shopping cart page.
Are you looking to sort the display permanently or offer option to sort product in the shopping cart page?

In case of sorting permanently you can use PHP sorting in this file (before line 270):
https://github.com/abantecart/abantecart-src/blob/master/public_html/storefront/controller/pages/checkout/cart.php#L270

Sort array $cart_products by key 'price'. If you need to sort including tax, you would need to add tax calculation prior to sorting
Please  rate your experience or leave your review
We need your help to build better free open source ecommerce platform for everyone. See how you can help

Offline potangina

  • Newbie
  • *
  • Posts: 10
  • Karma: +0/-0
    • View Profile
Re: Sort items in cart according to price
« Reply #2 on: March 06, 2018, 10:13:39 PM »
thanks for the quick response and sorry for the inadequate info i provided, yes, i was referring to the shopping cart page as well as the cart that appears when you hover over the "ITEMS" button at the storefront homepage.
"Death is like a wind, always by my side"
- Cancer

 

Powered by SMFPacks Social Login Mod