Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

[SOLVED] Export orders
 
szotyi
Sr. Member
 
Total Posts:  153
Joined:  2008-11-29
 

yes, you can if you write the script for it....
if you do not know how I can recommend:

http://www.sebastian-enzinger.de/magento-order-export-module/

 
Magento Community Magento Community
Magento Community
Magento Community
 
gagachaga
Jr. Member
 
Total Posts:  11
Joined:  2009-02-02
 

many of the fulfillment companies accept only tab delimited files that they can run in their systems (bastards don’t want to update their systems to new standards)
whats funny is that magento’s export of products has tab delimited option, if we can get your export script to export pr to be converted automatically to tab delimited many people will use magento just for this reason cuz many go to x-cart just because it has the option for order export separated by tabs so the fulfillment companies recommend it just for that, mine said buy X-cart but i was able to get the client to like magento, we were all happy by it until we realized that the product export does not include an order export option, so when we found your script we were very happy, so now we just need it to be able to export in tab delimited files and we will be set
very thankful for your help

 
Magento Community Magento Community
Magento Community
Magento Community
 
gagachaga
Jr. Member
 
Total Posts:  11
Joined:  2009-02-02
 

ok i started working on it, i am making the export custom option right now to be all under each other, than will use the parser to see what it makes, tx so much will be posting result in the next hour, hopefully this won’t take long

 
Magento Community Magento Community
Magento Community
Magento Community
 
Pierre SII
Jr. Member
 
Total Posts:  25
Joined:  2008-12-19
Nice, France
 

Hi,

Thanks for this time saving code.

It is a very good start for my own dev (even more !).

I started to dev some improvment to integrate it as much as possible to magento.

Please found here my suggestion:

1) I moved the includes.php, export.php, samples.php files to magento/lib/export. So the include call will be

<?php include('export/export.php'); ?>.

To me its a better way as long as the path magento/lib is set as include path within the default magento conf (.htacces file)

2) I made a module to make the export path configurable thru the admin panel:

2.1) Create folders:
* app/local/MyCompany/ExtraConfig
* app/local/MyCompany/ExtraConfig/etc
2.2) Create files:
* app/local/MyCompany/ExtraConfig/etc/config.xml
* app/local/MyCompany/ExtraConfig/etc/system.xml
2.3) Content of config.xml:

<?xml version="1.0"?>
<config>
        <
modules>
            <
MyCompany_ExtraConfig>
                <
version>1.0.0</version>
                <
depends>
                    <!-- 
no dependencies -->
                </
depends>
            </
MyCompany_ExtraConfig>
        </
modules>
        <global>
            <
models />
            <
resources />
            <
extraconfig />
            <
blocks />
        </global>
</
config>
2.4) Content of system.xml:
<?xml version="1.0"?>
<config>
    <
sections>
        <
system>
            <
groups>
                <
orderExport translate="label">
                    <
label>Orders Export</label>
                    <
frontend_type>text</frontend_type>
                    <
sort_order>50</sort_order>
                    <
show_in_default>1</show_in_default>
                    <
show_in_website>0</show_in_website>
                    <
show_in_store>0</show_in_store>
                    <
fields>
                        <
export_path translate="label">
                            <
label>
                                
Export Path
                            
</label>
                            <
frontend_type>text</frontend_type>
                            <
sort_order>50</sort_order>
                            <
show_in_default>1</show_in_default>
                            <
show_in_website>0</show_in_website>
                            <
show_in_store>0</show_in_store>
                        </
export_path>
                    </
fields>
                </
orderExport>
            </
groups>
        </
system>
    </
sections>
</
config>
2.5) add the following line at the begining of the file magento/lib/export/includes.php :
define("ORDER_EXPORT_PATH",Mage::getStoreConfig('system/orderExport/export_path'));
2.6) search all references to the export path in the files includes.php and replace them with constant ORDER_EXPORT_PATH

3) Go to admin>System>configuration>advanced>system

3.1) Select one of your website

3.2) Into the Orders Export tab, set the field Export Path to your export path (i.e. var/export)

4) You are done

ps: This a good example to start with configuration. All hard coded config data used into the this excellent export system can be set using the same process.

Cheers,

Pierre

 
Magento Community Magento Community
Magento Community
Magento Community
 
Pierre SII
Jr. Member
 
Total Posts:  25
Joined:  2008-12-19
Nice, France
 
titi88888888 - 15 January 2009 11:37 AM

I have a 404 error because my magento shop is in a subfolder : www.yourdomaine.com/shop


Then, when I click on “Export”, it doesn’t take into account my /shop/ folder

http://www.MyDomain.com/index.php/admin/sales_order/?export=true&type;=custom&sample;=Default&orderlist;=

Instead of http://www.MyDomain.com/shop/index.php/admin/sales_order/?export=true&type;=custom&sample;=Default&orderlist;=

Could you please explain us HOW TO MODIFY the catual scripts for people having their shops in a subfolder ?

Thank you !

To solve this probleme you can replace the export ahref line with:

<a href="<?php echo Mage::getBaseUrl()?>admin/sales_order/?export=true&type;=fromlast" onclick="this.href += '&sample;='+getValueSelected(getElementById('sz_type1'));" id="sz_export1">Export</a>

Pierre

 
Magento Community Magento Community
Magento Community
Magento Community
 
IAG Design
Jr. Member
 
Total Posts:  15
Joined:  2008-05-06
 

Outstanding contribution. Has anyone been able to export credit card info using this method?

 
Magento Community Magento Community
Magento Community
Magento Community
 
NylonAdmiral
Jr. Member
 
Total Posts:  9
Joined:  2009-02-04
 

First of all, a big thank you to szotyi!

This works fine for me but I have two issues, has anybody had any luck with exporting the orders as a .CSV file rather than as XML?  My other question is that when I “export orders since last export” I’d really like to be able to export each order as an individual file rather than as several orders in a single file.

I wondered if anybody else had tried this who might have got anywhere with it?

Any help would be greatly appreciated!

 
Magento Community Magento Community
Magento Community
Magento Community
 
szotyi
Sr. Member
 
Total Posts:  153
Joined:  2008-11-29
 

first request: good luck with it smile

your second request:

export.php:
find:

/* START - Export orders from last export */

insert the following lines:

$xmlStringHack "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?><$ordersTXT>"."<$orderTXT>".array2xml($currentsample[$ordersTXT][$orderTXT])."</$orderTXT>""</$ordersTXT>";
  
$myFile "export/orderid_".$orderMag->getId();
  
$fh fopen($myFile'w');
  
fwrite($fhformatXmlString(removeEmptyTags(removeEmptyTags($xmlStringHack))));
  
fclose($fh);
after that line:
$xmlString.= "<$orderTXT>".array2xml($currentsample[$ordersTXT][$orderTXT])."</$orderTXT>";
 
Magento Community Magento Community
Magento Community
Magento Community
 
NylonAdmiral
Jr. Member
 
Total Posts:  9
Joined:  2009-02-04
 

Thank you so much szotyi, you are a genius!

 
Magento Community Magento Community
Magento Community
Magento Community
 
bclark@dinovite.com
Jr. Member
 
Total Posts:  17
Joined:  2009-01-27
 

i’m really struggling to get the region and postcode to show in the resulting file.  Can someone post a working example of the code snippet to add billingregion and/or billingzip to samples and includes file.  I know that I’m making a dumb mistake but I can’t seem to get those 2 very vital bits of info into the xml file.

Thanks,
bc

 
Magento Community Magento Community
Magento Community
Magento Community
 
szotyi
Sr. Member
 
Total Posts:  153
Joined:  2008-11-29
 

includes.php:
getvalue function:

case “getbillingpostcode”:
return $orderMag->getBillingAddress()->getPostcode();
case “getbillingregion”:
return $orderMag->getBillingAddress()->getRegion();

sample.php
yourtagnameforpsocode: getbillingpostcode,
yourtagnameforregio: getbillingregion

 
Magento Community Magento Community
Magento Community
Magento Community
 
bclark@dinovite.com
Jr. Member
 
Total Posts:  17
Joined:  2009-01-27
 

Thank you, that worked!!!! I see what I was doing.  I was changing the getAddress to getRegion as well.

Thanks!
bc

 
Magento Community Magento Community
Magento Community
Magento Community
 
bclark@dinovite.com
Jr. Member
 
Total Posts:  17
Joined:  2009-01-27
 

alright, two big questions: order weight doesn’t seem to come over:

includes:
case “getorderweight”:
return $orderMag->getWeight();

sample:
orderweight: getorderweight

Also, noticed that that I didn’t get subitems for bundled products. How do I do that?

Thanks in advance!
bc

 
Magento Community Magento Community
Magento Community
Magento Community
 
szotyi
Sr. Member
 
Total Posts:  153
Joined:  2008-11-29
 

sorry no clue for the first question, try to search in the local files for getweight and maybe you will find the magic word for it.

im not using bundled products at all so I do not know the syntax of it.. sorry..

 
Magento Community Magento Community
Magento Community
Magento Community
 
bclark@dinovite.com
Jr. Member
 
Total Posts:  17
Joined:  2009-01-27
 

:( well it was in the list.txt file so....  where are these local files?

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top