NeroAdvents Posted November 17, 2020 Share Posted November 17, 2020 Hello, actually I have some issues with the csv format from the admin order controller export button (change it for xlsx format). I would like to know how can I override this action from the Admin order controller in back office. Thanks. Link to comment Share on other sites More sharing options...
Guest Posted November 18, 2020 Share Posted November 18, 2020 (edited) To export to XLSX, you need to have extra libraries installed on your server or added to Prestashop. So it's a rather complicated matter and there are no simple instructions. I don't understand why you want to export in a format other than CSV? After all, every Excel and OpenOfiice can open a CSV file! https://addons.prestashop.com/en/data-import-export/42545-orders-export-pro-excel-csv-pdf-email-ftp.html Edited November 18, 2020 by Guest (see edit history) Link to comment Share on other sites More sharing options...
NeroAdvents Posted November 18, 2020 Author Share Posted November 18, 2020 The purpose of my demand is not why I want to do that but where is the file I can edit to change the file extension. I did manage to do this process for the request SQL controller and it works fine, but I do not find the file managing the panel heading toolbar actions. If you can tell me where to find it, it would be helpful. Thanks. Link to comment Share on other sites More sharing options...
Guest Posted November 18, 2020 Share Posted November 18, 2020 It's nice how you react and how smart you are, but you also forgot to write what version of Prestashop you have. If you are really good, you also need to know that there are big differences in Prestashop versions. If you think that changing the file extension will solve everything, then you are wrong! Good luck. Link to comment Share on other sites More sharing options...
NeroAdvents Posted November 18, 2020 Author Share Posted November 18, 2020 Well sorry if I offended you, this was not the purpose. Actually I'm using Prestashop 1.7.4. I don't claim that I'm smart or what ever, I just want to know where can I modify the export action to get a correct file with special characters included. Thanks Link to comment Share on other sites More sharing options...
Guest Posted November 18, 2020 Share Posted November 18, 2020 (edited) So you need to get the output in UTF-8 encoding. ./controllers/admin/AdminRequestSqlController.php function processExport or generateExport change: header('Content-Length: ' . $filesize); to: if ($charset == 'utf-8' || $charset == 1) { header('Content-Length: '.($filesize+3)); echo "\xEF\xBB\xBF"; } else { header('Content-Length: '.$filesize); } Edited November 23, 2020 by Guest (see edit history) Link to comment Share on other sites More sharing options...
NeroAdvents Posted November 23, 2020 Author Share Posted November 23, 2020 Hi, Thank you for the answer ! Do you know why when I set the delimiter as a semicolon in my CSV file it is not delimiting the file with semicolon but with comma ? fputcsv($fd, $content, ';', '"'); Thanks Link to comment Share on other sites More sharing options...
EvaF Posted November 23, 2020 Share Posted November 23, 2020 I am sorry whether i write the known things.. Export is processed via public function processExport($text_delimiter = '"') in classes/controller/AdminController.php here is set as fixed delimiter ';' if you see comma, then check if someone don't override it ( either directly in classes/controller/AdminController.php or in override/classes/controller/AdminController.php) Link to comment Share on other sites More sharing options...
NeroAdvents Posted November 24, 2020 Author Share Posted November 24, 2020 Hi, Yeah, actually it was inside the AdminController.php. It is set as ';' for the delimiter, but when I open the generated file in Excel, it does not delimit as it should. I found out that when the region is set to US, the delimiter is comma as default. Then I change for my location, and now it works. But I wanted to know if there was a way to change it directly in the processExport function or somewhere else. Thanks. Link to comment Share on other sites More sharing options...
EvaF Posted November 24, 2020 Share Posted November 24, 2020 did you check directly the csv file ( it is text file)? Which delimiter is in this file?? Which way do you open csv file? (by standard way, using Excel association of csv files?? if so, imho the safer (and with full controll) is to load csv into blank sheet (using tabsheet "data"->from text/csv) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now