If this is your first visit, check our documentation. To post, register or login.
Forums / General Questions / General Questions / How to change the sort order of the cart contents?

How to change the sort order of the cart contents?

Started by eric_chen on 3 Jan 2014, 3:07 PM · Views: 760

Results 1 to 2 of 2
3 Jan 2014, 3:07 PM
#1
eric_chen avatar

eric_chen

New Zenner

Join Date:
May 2012
Posts:
39
Plugin Contributions:
0

Post #1 by eric_chen

Does anyone know how to change the sort order of the shopping cart dsiplay so that the products in the shopping cart will order by product ID number. By default, the new products added will go onto the top of the list, or the bottom of list.

3 Jan 2014, 8:43 PM
#2
twitchtoo avatar

twitchtoo

Totally Zenned

Join Date:
Apr 2007
Location:
Ontario, Canada
Posts:
1,733
Plugin Contributions:
14

Post #2 by twitchtoo

Have a look at how the data is managed and displayed in these files...

The list is compiled here:
includes/classes/shopping_cart.php

function get_products

Modify the output:
includes/modules/pages/shopping_cart/header_php.php

$products = $_SESSION['cart']->get_products();

Sidebox display contents in a list:
includes/templates/YOUR_TEMPLATE/sideboxes/tpl_shopping_cart.php

Shopping cart display contents in a list:
includes/templates/YOUR_TEMPLATE/templates/tpl_shopping_cart.php

Loops through all products.

You could filter the output loops to display ordered by product_id... or filter the original product array.

Twitch.
https://www.twitchtoo.com Do you work for free? Please donate.
June 7.2026 - NOW AVAILABLE - Twitch Base8 - Obsidian