I've mentioned this problem before - but just thought I'd take another crack at trying to give it some attention.
When CSV Export is used on a table containing joined data, on a list that is configured to not allow 'Front end options', it provides different results than when it is set to allow Front end options.
To detail the problem... When configured to not show 'Front end options', any columns from the joined table are always put at the end - in the last columns. This is contrary to any settings that might already exist in the 'Show in list' option set in the Menu (or the List configuration itself? I haven't tested that).
It works as expected so long as the 'Front end options' is set to Yes.
Here's how to duplicate the problem...
Why, in csvexport.php, there are 2 different routines being run - based on that configuration option, has always baffled me. Why not run the same routine (the one that works correctly, i.e. the one that is run when options are selectable) - if for no other reason than to assure consistency in the results (not to mention losing the need for duplicating code) - and simply not show the options if the list configuration is set to not show the Front end options???
When CSV Export is used on a table containing joined data, on a list that is configured to not allow 'Front end options', it provides different results than when it is set to allow Front end options.
To detail the problem... When configured to not show 'Front end options', any columns from the joined table are always put at the end - in the last columns. This is contrary to any settings that might already exist in the 'Show in list' option set in the Menu (or the List configuration itself? I haven't tested that).
It works as expected so long as the 'Front end options' is set to Yes.
Here's how to duplicate the problem...
- Create or use a list that has a joined table and edit the list configuration.
- In the Publishing - CSV tab, set 'Front end options' to No.
- Add the list as a menu item and in the menu configuration, set 'Show in List' to include one of the columns from the joined table - but put it as the 2nd or 3rd column in the list (somewhere other than the last element in the 'Show in list' list).
- Now open the list via that menu option on the front end and Export as CSV.
- Note how the element from the joined table it always added as the last column despite the 'Show in list' order specified in the menu configuration?
- Now edit the list configuration and set 'Front end options' to Yes and repeat the export on the front end.
- Note that the element from the joined table is now shown in the correct column as configured in the menu?
Why, in csvexport.php, there are 2 different routines being run - based on that configuration option, has always baffled me. Why not run the same routine (the one that works correctly, i.e. the one that is run when options are selectable) - if for no other reason than to assure consistency in the results (not to mention losing the need for duplicating code) - and simply not show the options if the list configuration is set to not show the Front end options???