Home » Headline, Magento

Export Order Hack for Magento

14 July 2009 1,475 views One Comment

I think most of you are not surprise when I say that Magento doesn’t have a built-in export module.

(”Gimme a break~..” -”No it’s true.”)

I’ve locked myself trying to find a way to export my orders for my Magento 1.1.1 set up. And then I found it, szotyi from the Magento Forums posted this great solution to export orders for Magento.

Features includes:

  • A simple interface on the Sales -> Order page
  • Orders are exported in XML files
  • You can export all or only selected orders
  • Configurable/Customizable XML output

I have made some changes myself on szotyi’s code, and got some ideas from the others who also contributed posts on the thread.

How to do it:

Step 1:

in the “app/design/adminhtml/default/default/template/widget/grid/massaction.phtml”

between the first two lines insert:

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

so you’ll get:

<div id="<?php echo $this->getHtmlId() ?>">
<?php include('export.php'); ?>
<table cellspacing="0" cellpadding="0" class="massaction">
 

Step 2:

copy the files ‘samples.php’, ‘includes.php’, ‘export.php’ files to “app/design/adminhtml/default/default/template/widget/grid/” (get files here)

Step 3:

create a folder named ‘export’ in your Magento root folder

Step 4:

to check if you got it right. Go to your admin of your store,  Sales -> Order page.

Notes:

the XML output files are customizable. To configure its XML format, you need to edit the sample.php, this is where the XML format are stored. In szotyi’s original file you can find 4 different samples (Default, Advanced, Simple, Custom).

The string before the ‘:’ means the tagname that will be shown in the xml.. you can change that to whatever you wish.

The string after the ‘:’ refers to the value (the value is located in the includes.php function getValue…)

PS:

If you want to add another value on the XML file.

Step 1:

Let say we want to add another value: the quantity how much has invoiced.  szotyi provided a list (get it here)where you can find all the attributes of the order information.

Go to the includes.php file to getValue() the quantity how much has invoiced.

...
case "examplegetqtyinvoiced":

return $item->getQtyInvoiced();
...

Step 2:

then add the below code for the sample.php so you can reach the value:

...
invoiced: examplegetqtyinvoiced,
...

I am waiting for your comments guys.

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading ... Loading ...

One Comment »

  • arryt said:

    this codes SUCKS!!!

Leave your response!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.