CSV Export improvements

Details of modifications which users can incorporate within Enuuk Auction Platform free of charge
Post Reply
RWAP
Site Admin
Posts: 748
Joined: Fri Jan 08, 2010 2:23 am
Location: Stoke-on-Trent
Contact:

CSV Export improvements

Post by RWAP » Wed Aug 28, 2013 8:30 am

The standard Enuuk uses the tab character to differentiate between columns in the CSV export files.

However, I have noticed that for some reason, Microsoft Excel doesn't understand this (I am sure it did in the past...) and therefore all the data ends up in the first column.

To overcome this and ensure that columns are not split by odd characters, the simplest change would seem to be to change it to export with commas and quote marks around each field:

In themes\admin\offersCSV.php

Find:

Code: Select all

$colSplit = "\t";
Change this to:

Code: Select all

$colSplit = ",";
Find:

Code: Select all

    //print rows
    foreach ($offers as $offer){
        foreach($headers as $k=>$v){ //columns
Add below this:

Code: Select all

        	echo '"';
Find:

Code: Select all

                    echo $offer[$k];
Change this to:

Code: Select all

                    echo str_replace('"',"'",$offer[$k]);
Find:

Code: Select all

            echo $colSplit;
Change this to:

Code: Select all

            echo '"';
            echo $colSplit;
You then need to do similar to themes\admin\userListCSV.php, except

Code: Select all

                    echo $user[$k];
becomes:

Code: Select all

                    echo str_replace('"',"'",$user[$k]);

bamse
Posts: 220
Joined: Mon Feb 06, 2012 12:05 pm
Contact:

Re: CSV Export improvements

Post by bamse » Sun Sep 08, 2013 6:19 am

Not sure if this is relevant here, but wanted to share my own struggles with Excel:

For some reason Excel required the file to have extension csv and would not read the same file if it had extension tsv for instance.

The free Excel (Starter) would not read csv files at all.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest