How to change default ordering in the export

This tutorial is only for Professional version of component!

Feature is available since version 4.2

Good feature is debug mode open your export in the browser (nonsef version of export URL) and add the code: &debug=1
at the end of this URL. Final URL should look like:


You can see there tha main (last) SQL query, which is called for the product list.

Open the setting for VirtueMart and go to the tab "UserSQL query". There is the field named "You can modify current SQL query to your needs using php code."

You can enter here any PHP code, but it make sense just to modify the SQL query in the variable $query.

Put there just one line like that:

$query=str_replace('GROUP BY','GROUP BY ORDER BY ASC', $query);

This code replace last part of the query - add the clause ORDER BY ASC
modify this part as you need... change ASC to DESC, change to p.code, or whatever else

Screenshot of the setting is:



Cart empty