VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: baeo on January 30, 2020, 08:27:34 AM

Title: Sort Cart (Product Ordering on Checkoutpage, default_pricelist.php
Post by: baeo on January 30, 2020, 08:27:34 AM
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
Title: Re: Sort Cart (Product Ordering on Checkoutpage, default_pricelist.php
Post by: Studio 42 on January 30, 2020, 08:40:12 AM
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