News:

AbanteCart v1.4.2 is released.

Main Menu
support

Sort items in cart according to price

Started by potangina, March 06, 2018, 11:03:21 AM

Previous topic - Next topic

potangina

Hello! how can i sort items in the cart according to price?

abantecart

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

potangina

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.

Forum Rules Code of conduct
AbanteCart.com 2010 -