Jump to content
Burhan BVK

Module to Export Orders

Recommended Posts

Hello

I am new to PrestaShop, it is the best open source shopping cart I have seen. Comes with many of the features you need.
I was looking for a module to export orders in csv format. I could not find one here, so I made a simple module myself.

There were a few other people looking for something like this. I have attached the module. Just extract it and put it in your modules folder. And set the folder write permissions.

After you install it you can generate a csv file in the configure page.

Updates:
Now the page automatically redirects to download the report.
It no longer requires write permission, and does not store the order data in a file.
Tested on 1.2.

There is also a commercial pro version available with filters. You can see it here:
http://www.bvkyazilim.com/cart/prestashop-modules/19-export-orders-pro.html

 

Note! Please first test! This module is probably outdated!

exportorders.zip

exportorders_2.0.zip

Edited by Curious
probably outdated (see edit history)
  • Like 5

Share this post


Link to post
Share on other sites

Hi great work, can you add more fields as notice that the product id is not included

But still excellent work.

Are you also available for other custom modules design ?


:-)

Share this post


Link to post
Share on other sites

I tried this module on V1.1 beta3 but nothing happens when "generate report" is clicked (some or all fields checked).

Share this post


Link to post
Share on other sites
Hi great work, can you add more fields as notice that the product id is not included

But still excellent work.

Are you also available for other custom modules design ?


:-)


Thanks.

I may do some changes soon. But each order may contain multiple products, so there is not a straight way of including product id. Anyone has any good ideas?

Actually, developed this for a client, I am a full time PHP developer. You can just pm me for custom design.

Share this post


Link to post
Share on other sites
I tried this module on V1.1 beta3 but nothing happens when "generate report" is clicked (some or all fields checked).


There is also a link below the generate report button after you first click on it. The link goes to the last generated file.

Share this post


Link to post
Share on other sites

This csv includes all orders from begining of shop, is there a way to filter and have orders of a period, like a month?

Share this post


Link to post
Share on other sites

I've been working on a similar one, and came across the same issue with orders containing multiple items. It's a pity that stock control programs don't use xml....

Paul

Share this post


Link to post
Share on other sites

I also started working on a similar module, but instead of saving it I tried to send it as an attachement to the header, but I kind of got strange results.. I also want to include the possibility to export customers, products and categories in the module.

the problem with orders is as pointed out that each order may have multiple products.. so it kind of depends on the import tool that is to be used how to handle this..

maybe a look at this may help? http://www.oscommerce.com/community/contributions,4728

  • Like 1

Share this post


Link to post
Share on other sites

I installed this module successfully and it kinda works. What doesn't is the resulting CSV file.
Not sure if it's an UTF problem, but some characters come out garbled (accents and stuff like º or ª).

Also, on many cases, cell contents come out of place. I have a first part on and address in the Delivery Address field, then a 2nd half of the same address filled in Invoice address (so both Addresses are in a way wrongly displayed). Some Address parts also show up on Payment field, most everything is out of place later on and I'm not sure what went wrong.

Has anyone experienced this as well?

Also, as with many export modules, it's all nice to have an CSV export, I don't deny it, it comes in handy. But what about imports?

One limitation I find with the DB Backup under Tools is that... well... you backup everything. You're given a choice to Import different kinds of entities but you don't really have an automated way to export them, which is a shame cuz if you want to manipulate data to fix or edit some entries, you'll just end up going back to phpmyadmin and start wasting time again.

I'm not complaining, it's just an observation.


And when we import products, why does it *have* to match Product ID? If I use CSV to update info (after an export), wouldn't it make more sense to match an EAN or product reference instead? Otherwise... we'll get duplicates if we don't make sure we got the right ID.

Share this post


Link to post
Share on other sites

Hello:

I installed the module on a test server and it worked fine. I then installed the module on a production server at GoDaddy and the module will not produce a download. It does produce the file but only on the server and not as a popup that I can download. So I figured I would download the file directly via FTP. However, when I open the file in Calc (alternative to Excel) it doesn't open as it should. I've tried using different encodings to see if that was the issue but to no avail. Can someone guide me on what to do? Thank you!

Share this post


Link to post
Share on other sites

This module is not a priority for me at the moment. But I may add a date filter in the next week or so. Errors need analyzing and I can't spare the time now, I need to prioritize my clients first.

If the generated file does not open in Excel or Calc, try opening it in notepad first. There might be some characters used in product names and such that may make the file invalid.

I have also posted an update to start the file download automatically, displaying the file download popup.

Share this post


Link to post
Share on other sites

That's awesome! But where is the update? I've figured out how to modify your script for other db tables. However, I'm still unclear on making it download automatically. Thank you!

Share this post


Link to post
Share on other sites

I replaced the original file. You just need to download again.

To download automatically:

Tools::redirect('url');

Share this post


Link to post
Share on other sites

Great, thank you! I looked over the data on the csv and I can't figure out what would keep it from downloading when clicking on the button. It's ok, thank you for the help. The file does generate within the directory though. I'll figure out a way to download the file from there. Also, I've managed to change the tables and fields a bit for other purposes, like inventory. Would it be ok to post these other modules for the community to use? They are basically the same code as your module but with different parameters. Just wanted to make sure I'm not stepping on anyone's toes with regard to derivatives. Thanks!

Share this post


Link to post
Share on other sites

Hi,

Thanks a lot for your work.

I tried to install it with prestashop 1.1 and it doesn't seem to work: no csv file is generated at all.
I've looked into my apache error log and could not find anything except that the file doesn't exist when trying to download it.

Any idea ?


Thanks a lot

edit: it does work, needed to chmod folder :)
thks

Share this post


Link to post
Share on other sites

How to translate public $fieldnames=array? And there is a trouble with accents like ê, ç, ã, etc...

Share this post


Link to post
Share on other sites

Bonjour,
Effectivement problème pour les français...
Si on prends Notepad ++ afin d'ouvrir ce csv pas de problème.
Par contre si on prend Excel pour ne pas le citer, là tout ce qui est accentué, grosse galère de sigle:
chèque devient Chèque, Comptant à la livraison devient Comptant à la livraison etc....

Que faire afin d'avoir un encodage lisible par les softs commerciaux que nous connaissons?

Share this post


Link to post
Share on other sites

Thank you very much. It works wonderful for me...

Share this post


Link to post
Share on other sites

whitelighter, thanks for the module. I downloaded it and installed it with prestashop 1.1. I can generate the report and download it. But However, the output of orders in CSV are iincorrect. some data are not responding to their fields. Please check your module. I attached the orders.csv for your inspection.

Cheers

orders.csv

Share this post


Link to post
Share on other sites

hi ! up...
is there something new about this module?
tks.

Share this post


Link to post
Share on other sites

I'm looking for a such module that is able to list the orders and their contents (list of all products into the command)

Is there someone into this room to tell me more ?

Share this post


Link to post
Share on other sites

Hey there,

I'm not very handy with the programming on prestashop. I'm looking for a way to sent orders (with all details) to an other CMS system. It should be in XML not in CSV.
If there's something available I would like to know.

Thanks allot!

Share this post


Link to post
Share on other sites

Hello, i'm french, sorry if my english is bad.
i have download your module, nice work, but there is a little bug, can you help me to repare it ?
Met problem: the commas which separate fields. Can one ; in the place. Because certain customers insert commas in their address, so it's occure an error. thanks.

Share this post


Link to post
Share on other sites

Yes, i'm using it with 1.2.5 final and it works just like it should. Problem is i need to be able to pick the date.
whitelighter, is there an easy solution to this?

Share this post


Link to post
Share on other sites

Hi,
If this could be developed more this module would be great.

Date Range filter or "Filter" status would be good

Share this post


Link to post
Share on other sites

Hi,
Module looks great,

Do you have any larger photos? or a Demo?

Does it work for older versions such as Version 1.1.0.5

Share this post


Link to post
Share on other sites

I have not tested it on earlier versions. The group filter would not work, as the functionality was not added to 1.1, so you would have to comment that line. Apart from that it should work, but I don't have a 1.1.0.5 testing environment to check. And if there are any fields unavailable in 1.1.0.5, you will have to leave them unselected.

For demo:

Back Office: http://www.bvkyazilim.com/cart/demo/demo/
Admin Email: demo@demo.com
Admin Password: demodemo

There is only one order available to export, but you can see the interface.

Share this post


Link to post
Share on other sites

Hi,
On my Version 1.1.0.5
I seem to be missing above "Check the fields you would like to export." any advice?

Share this post


Link to post
Share on other sites
Hi,
On my Version 1.1.0.5
I seem to be missing above "Check the fields you would like to export." any advice?


The community version does not have the filters. The demo is the full version.

Share this post


Link to post
Share on other sites

Hi,
Im interested in developing it further, could the delivery address be put on each column?

e.g

name, 1st line, 2nd line, postcode, phone




Attached is the current output Im getting, seems to be unusual

21134_M9YZ2OrzWaw7hdWTUWjW_t

Share this post


Link to post
Share on other sites

The output is tab delimited. You should change settings to use tabs instead of comas during import.

Share this post


Link to post
Share on other sites

I changed the last few lines to the below, and working correct


        private function escape($s){
       return mysql_real_escape_string($s);
   }

   private function getcsvline($list){
       $s='';
       foreach($list as &$l){
           $l=''.addslashes($l).',';
       }

       return implode("", $list)."\r\n";
   }

}

Share this post


Link to post
Share on other sites

Is there a way to seperate the address onto new column's

e.g addressline1, addressline2, city, postcode


Also is there a way to add the "product_reference" ?


I have the following lines


                
'r'=>array(
           'n'=>'order_detail',
           'f'=>array(
               array(
                   'n'=>'product_reference',
                   'l'=>'Reference'
               )
           ),
           'w'=>'r.id_order_detail=o.id_product_reference'
       ),

Share this post


Link to post
Share on other sites

HI whitelighter, can you modify your module to export the title of the product ?

if there are many items in the order, we can at least show the first item of the list ...

is this difficult to do ? thanks

Share this post


Link to post
Share on other sites

It can be done, but my priority is my commercial projects. So don't expect an update soon.

Share this post


Link to post
Share on other sites

Excellent module! My congrats to you!

I will be trying this for a while and will evaluate buying the pro version.

Regards!

Share this post


Link to post
Share on other sites
Is there a way to seperate the address onto new column’s

e.g addressline1, addressline2, city, postcode

Also is there a way to add the “product_reference” ?

I have the following lines

'r'=>array(
           'n'=>'order_detail',
           'f'=>array(
               array(
                   'n'=>'product_reference',
                   'l'=>'Reference'
               )
           ),
           'w'=>'r.id_order_detail=o.id_product_reference'
       ),



I need this as well. Need to know the product ordered, plus need the address separated by lines. Any tips?

Share this post


Link to post
Share on other sites

great module.. thx..!
I have included products (name, qty, price):


/******** Products (name, qty, price) ******************************************/
       'r'=>array(
           'n'=>'order_detail',
           'f'=>array(
               array(
                   'n'=>'product_name',
                   'l'=>'Product name'
               ),
               array(
                   'n'=>'product_quantity',
                   'l'=>'Product Qty'
               ),
               array(
                   'n'=>'product_price',
                   'l'=>'Product Price'
               ),

           ),
           'w'=>'r.id_order=o.id_order'
       ),
/**************************************************************************/

  • Like 1

Share this post


Link to post
Share on other sites

I reviewed the ouput of the csv lines and modified it to the default php fputcsv command. The default is taken over from the fputcsv which is comma separated instead of tab separated. fputcsv normally writes to a file, however with the use of php://temp it will keep in memory.

In the module/exportorder.php replace the function getcsvline with this one:

private function getcsvline($list){
   $fp = fopen('php://temp', 'r+'); 
   fputcsv($fp, $list );
   rewind($fp);
   return fgets($fp);
 }



I hope this will contribute in a more stable csv output.

Share this post


Link to post
Share on other sites

Can't get it to work with my 1.3.1... the demo that is.

is there an update any time soon ? :)

edit:
I even tried to tarball it, upload it and it says: Module installed.
but it doesn't show up in modules..

Share this post


Link to post
Share on other sites

Hi,
I have installed the export orders module, but when I try to configure to get the csv file nothing happens, what am I doing wrong? I'm a beginner so apologies if this is very obvious. please help!

Share this post


Link to post
Share on other sites

Anyone have the latest version, how do I select only orders with status Processing ..

Thanls

Share this post


Link to post
Share on other sites
Can't get it to work with my 1.3.1... the demo that is.

is there an update any time soon ? :)

edit:
I even tried to tarball it, upload it and it says: Module installed.
but it doesn't show up in modules..


I have the same problem too,
on my p.s -1.3.1 it says module installed but it doesnt seen on the modules list.
could u please fix that bug, we all be appreciated.
thanks

Share this post


Link to post
Share on other sites

This module not installed successfully on 1.3.2.3

Share this post


Link to post
Share on other sites

successfully installed manually on PS 1.3.7. but the csv output didn't display correctly (column header and the data).

Share this post


Link to post
Share on other sites

Is it possible to all the export of this CSV file to include the "Order Statuses" detail.

eg. Order #1 .... , "Pending payment", ...

Share this post


Link to post
Share on other sites

Hi, I have downloaded v2.0 of this module, installed it on ps1.4.0.17 and although it works, the output is not clean, I am attaching it so you can see how the final CSV looks like.
Perhaps someone here could help cleaning up the code

Regards

Hugo

p.s. I am attaching too the module modified to work with ps1.4.017

pe_exportorders.zip

Share this post


Link to post
Share on other sites

Just wanted to check in here. I have installed this and I am with Exakimak - the csv that is exported is not clean. There are no true headers and the columns aren't actually separated. Is that what you were talking about as well>???

Share this post


Link to post
Share on other sites

Thanks a bunch for referring me to the proper thread!

I just installed the new version and I received this error:


Warning: Missing argument 1 for PE_ExportOrders::hookExport(), called in /home/bscdevel/public_html/hss/modules/pe_exportorders/pe_exportorders.php on line 265 and defined in /home/bscdevel/public_html/hss/modules/pe_exportorders/pe_exportorders.php on line 267

  • Like 1

Share this post


Link to post
Share on other sites

SO I uncommented the segment you had commented and got it to product a .csv file but all it did was produce a csv file that was just the same content as your admin page???

I attached the output

orders.csv

Share this post


Link to post
Share on other sites

I downloaded the same file from that post, but I had to change some lines of code to make it work in my installation (ps1.4.0.17).
The person who posted the modified version said it was for ps1.4.2.5
you should check that
regards
Hugo

SO I uncommented the segment you had commented and got it to product a .csv file but all it did was produce a csv file that was just the same content as your admin page???

I attached the output

Share this post


Link to post
Share on other sites

yep - i have the proper version.. however I also tried the previously posted files frm that thread and it generated the same garbage file which was just a repeat of the actual .php page/

Share this post


Link to post
Share on other sites

mmm this is weird, can you give a try with my version.
I am attaching it
regards
Hugo

yep - i have the proper version.. however I also tried the previously posted files frm that thread and it generated the same garbage file which was just a repeat of the actual .php page/

pe_exportorders.zip

  • Like 1

Share this post


Link to post
Share on other sites

yea i'll install it right now/

hey since you're here reading maybe you can answer a quick question... I'm trying to work on creating another module and in instructions it says to upload file to the "tabs" folder and then go to TOOLS -> TABS -> and then "add new" but i don't have a "tabs" folder there anymore. What do i do?

Share this post


Link to post
Share on other sites

look at the install function of the module discussed in here, there you will see how to add the tabs stuff
and Tabs now are in the employee tab.
regards

yea i'll install it right now/

hey since you're here reading maybe you can answer a quick question... I'm trying to work on creating another module and in instructions it says to upload file to the "tabs" folder and then go to TOOLS -> TABS -> and then "add new" but i don't have a "tabs" folder there anymore. What do i do?

Share this post


Link to post
Share on other sites

Thanks very much. Got the tabs thing sorted

I installed your files and first got this error: (same as before)

Warning: Missing argument 1 for PE_ExportOrders::hookExport(), called in /home/bscdevel/public_html/hss/modules/pe_exportorders/pe_exportorders.php on line 263 and defined in /home/bscdevel/public_html/hss/modules/pe_exportorders/pe_exportorders.php on line 265

HOWEVER when I go to generate the file I get a green button now that asks me to download.. I download the file and it looks pretty near perfect. The only thing I would like to add is the product reference number so that when I send the sheet to the drop shipper they have the numbers right there.

Thank you SOO much !!!!

Share this post


Link to post
Share on other sites

replace in pe_exportorders.php to get rid of those errors

   public function _postProcess()
   {
       $this->hookExport(array());
   }


Thanks very much. Got the tabs thing sorted

I installed your files and first got this error: (same as before)

Warning: Missing argument 1 for PE_ExportOrders::hookExport(), called in /home/bscdevel/public_html/hss/modules/pe_exportorders/pe_exportorders.php on line 263 and defined in /home/bscdevel/public_html/hss/modules/pe_exportorders/pe_exportorders.php on line 265

HOWEVER when I go to generate the file I get a green button now that asks me to download.. I download the file and it looks pretty near perfect. The only thing I would like to add is the product reference number so that when I send the sheet to the drop shipper they have the numbers right there.

Thank you SOO much !!!!

Share this post


Link to post
Share on other sites

hello

 

thank you very much for this module, it is very great !

 

It is possible to have the Total amount without tax and the total Tax paid ? ( product + shipping )

 

if someone have an idea, please give me the code to put on exportorders.php

 

 

like :

 

 

array(
 'n'=>'???',
 'l'=>'Total without tax'
),
array(
 'n'=>'???',
 'l'=>'Tax Paid'
),

 

 

thank you

Share this post


Link to post
Share on other sites

every thing ok.. i fixed the error.. now tested in 1.4.5.1 work bautiful !!!!...

Share this post


Link to post
Share on other sites

Hello

im trying to add the transport comments the variable other from ps_address on the csv file

i added this line on the code in the array tables

),
	 array(
	  'n'=>'`other` AS aiother',
	  'l'=>$this->l('Invoice Comment')
	 )

 

also i wanted to put only specific variables checked by default not all the variables

 

thanks

Share this post


Link to post
Share on other sites

was it a bug in the code ? could you share your fix here

regards

Hugo

every thing ok.. i fixed the error.. now tested in 1.4.5.1 work bautiful !!!!...

Share this post


Link to post
Share on other sites

Hi,

You could include the total_products_wt (total product without tax) attribute to the list.

Regards

Hugo

 

hello

 

thank you very much for this module, it is very great !

 

It is possible to have the Total amount without tax and the total Tax paid ? ( product + shipping )

 

if someone have an idea, please give me the code to put on exportorders.php

 

 

like :

 

 

array(
 'n'=>'???',
 'l'=>'Total without tax'
),
array(
 'n'=>'???',
 'l'=>'Tax Paid'
),

 

 

thank you

Share this post


Link to post
Share on other sites

Great module... Does anyone know how to add 'Discount/Voucher codes' to the export list..?

Share this post


Link to post
Share on other sites

mmm this is weird, can you give a try with my version.

I am attaching it

regards

Hugo

 

Lovely. Works like a charm!

Share this post


Link to post
Share on other sites

If anyone needs, I added Product reference, Tax rate and Customer message into csv export.

I use Product reference as Product code, if Product name is same for more product.

Tested on Prestashop 1.4.7.0

 

Falgener (netvianet.com - Import and free themes for PrestaShop)

 

pe_exportorders.zip

Share this post


Link to post
Share on other sites

You can add a field to select the orders for export to the state ?

Share this post


Link to post
Share on other sites

Hi all

fantastic

is there any way we can also add the phone numbers to the info?

We need them for shipping. Thanks for the great work!!!

Edited by jimmyc (see edit history)

Share this post


Link to post
Share on other sites

Work for 10 minutes, on Tuesday i will send you in PM

 

Hi all

fantastic

is there any way we can also add the phone numbers to the info?

We need them for shipping. Thanks for the great work!!!

Edited by Falgener (see edit history)
  • Like 1

Share this post


Link to post
Share on other sites

Again, thanks for this PrestaShop Newbie. Cheers

Share this post


Link to post
Share on other sites

Hello

 

In the list export, we cannot export manufacturer name and manufacturer ID.

 

How can we do ? Anyone knows ?

 

Thanks in advance,

Share this post


Link to post
Share on other sites

OK, I can make modifications, but it will not now, - there is a vacation. Question is, what are we going to export next time - the entire database is the solution :D ?

Share this post


Link to post
Share on other sites

Hi, thanks a lot, works perfect, just a small question, is there any possibility to change coding ? I have a problem displaying diacritics ( as i use it for czech environment and we use letters like ž,š,č,ř, etc.)

 

Thanks in advance..

Share this post


Link to post
Share on other sites

in my case, I never inserted the manufacturer name in the product name. When I want to export the products ordered, I need to know the name of the product manufacturer.

 

Thank you in advance if you can help me.

Best.

Share this post


Link to post
Share on other sites
Hi, thanks a lot, works perfect, just a small question, is there any possibility to change coding ? I have a problem displaying diacritics ( as i use it for czech environment and we use letters like ž,š,č,ř, etc.) Thanks in advance..

 

Yes, I know about it. As far as I know, it only makes ps_message table. IMHO a message from the customer is stored sick to DB. It is not a problem with this module.

Customer message testovací poznámečka žščř is stored in the DB as follows - testovací poznámečka žščř

 

Other fields - The export CSV is encoded in UTF-8. For example, opening in OpenOffice is not a Problem displaying diacritics, for MS Excel, you must manually set import to UTF-8.

Edited by Falgener (see edit history)

Share this post


Link to post
Share on other sites

Warning: Missing argument 1 for PE_ExportOrders::hookExport()

Share this post


Link to post
Share on other sites

Thanks will look on to it,....... Also are you planning to do some filters to export data ( from date to date )? :)

Edited by Proze (see edit history)

Share this post


Link to post
Share on other sites

Warning: Missing argument 1 for PE_ExportOrders::hookExport()

 

Does anyone else have this problem? PrestaShop version, PHP ver ?

 

Thanks will look on to it,....... Also are you planning to do some filters to export data ( from date to date )? :)

 

Yes, filter from date to date is good idea, but it is not completely accurate. Better way is filter according order status (Awaiting cheque payment,Preparation in progress,Delivered, etc ....). Your way is easier to implementation, I will think about it :rolleyes:

Share this post


Link to post
Share on other sites

nformazioni sul server

 

Versione di Prestashop: 1.4.8.2

Informazioni sul server: Linux #1 SMP Mon Jul 2 10:46:27 EDT 2012 x86_64

Versione software server: Apache/2

Versione di PHP: 5.2.17

Versione di MySQL: 5.5.14

Share this post


Link to post
Share on other sites

would still be nice if we could export to status

 

e.g. to read it at a spedition

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.