eCommerce construction > How-to questions

Sort items in cart according to price

(1/1)

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.

Navigation

[0] Message Index

Go to full version
Powered by SMFPacks Social Login Mod