Jump to content

Admin controller override export sql request


NeroAdvents

Recommended Posts

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 by Guest (see edit history)
Link to comment
Share on other sites

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

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

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 by Guest (see edit history)
Link to comment
Share on other sites

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

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

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

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...