OpenCart orders and options Excel export tool

Introduction

This script should work in all OpenCart 2.x installations and maybe in OpenCart 3.x because it extracts the data directly from the OpenCart Database and does not rely on any OpenCart directory files. No VQMod, OCMod, theme or permissions required!

The script just dumps readable order data in an Excel file, you may later use Excel functions to auto-format the data according to your needs.

Inside the package

There are two versions of the script within the ZIP package. The first one exports the contents directly to the Excel format and should work in most of the installations if your computer/database/server uses English/Latin character sets.

If the exported XLS appears with strange characters you should use the UTF-8 TXT version of the script. It allows conversion of different database charsets to UTF-8 and then exports it to a semicolon delimited .TXT file that can later be imported into Excel.

Instructions

1. Edit the script in any text editor. Set the configurations of your database and set an access password. The password will protect the script from outside access and should be different than the DB password.

2. Place the modified script in any accessible (but safe) folder in your server, for example, the OpenCart /admin directory.

3. Access the script by using the following URL. Remember to replace YOURPASSWORD with the password you set in the configuration file.

URL: https://www.yourserver.com/yourfolder/admin/order_export.php?pw=YOURPASSWORD

4. If everything is OK you will be prompted to download the Excel file.

5. Each line of the Excel file represents one order item or item option. You may group options for the same item by using the column product_item.

6. In case of errors, the file will be downloaded in the PHP format. Just edit it to see what's wrong.

7. If the characters are not displaying correctly consider the UTF-8 TXT version of the script. This requires an additional configuration of the source database charset.

License

MIT. Do whatever you want with it.

Files
Version
2.0
Supported platforms
OpenCart 2.x
Download size
8 KB
Screenshots

Post Categories

Comments

Submitted by Paul on Mon, 06/05/2017 Permalink

Hi.

Your script opencart2.xorderxlsexport works is fine. But my data on Russian lang. And script Saved data with Question marks.

I search the code on stackoverflow:

header('Content-Encoding: UTF-8');
header('Content-type: text/csv; charset=UTF-8');
header("Content-disposition: attachment; filename=filename.csv");
header("Pragma: public");
header("Expires: 0");
echo "\xEF\xBB\xBF"; // UTF-8 BOM

but this not work too.

Please help me ;)

Hello Paul,

The version 2 comes with an additional script that exports the data to a UTF-8 TXT file that later can be imported into Excel.

This version requires an additional configuration for the source database charset. Most of the databases should be UTF-8 but yours could be configured to ISO-8859-5 (Russian) so you need to check this information.

To open it, open the TXT file from Excel and then select the option "Delimited fields" and then set the delimiter to "semicolon" (;).