News:

Support the VirtueMart project and become a member

Main Menu

Sort Cart (Product Ordering on Checkoutpage, default_pricelist.php

Started by baeo, January 30, 2020, 08:27:34 AM

Previous topic - Next topic

baeo

Hi

I want to sort the Products on the ckeckoutpage by GTIN.

I think i must implement it on the default_pricelist.php page bevor "foreach ($this->cart->products as $pkey => $prow) { ?>"

I used different approaches like "$this->cart->products = ' GROUP BY `virtuemart_product_id` ORDER BY product_gtin';" or sortscript but i found no solution.
Can anybody help me? Its for a study in a Highschool project.

Thanks Nicolas


I use Joomla! 3.9.14 / Virtuemart 3.6.8

Studio 42

Create a new array from the current price list and use gtin as KEY and sort using PHP ksort
Not that you can have a problem because the original order is sued as delete key, so you have t find a solution to add this before sort in the original item(product) object