Author Topic: Sort Cart (Product Ordering on Checkoutpage, default_pricelist.php  (Read 206 times)


  • Beginner
  • *
  • Posts: 1
  • A beginner

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

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 4329
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: Sort Cart (Product Ordering on Checkoutpage, default_pricelist.php
« Reply #1 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