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
 
bclark@dinovite.com
Jr. Member
 
Total Posts:  17
Joined:  2009-01-27
 

sorry, Order Weight was in the list.txt file so ....
Do you know where these local files are?

Thanks,
bc

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

I do not know why it is not working,maybe try with the $orderMag->getshippingaddress()->getWeight() or something like that.

I meant the magento store files in the app folder

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

alright, Got item weight working which will suffice for now.
Still working on the bundled products.  Noticed that when a
product is bundled, the sku looks like this skuMaster-skuChild

Any idea how to get the following to repeat per sku from hypenated getSku result:

case “getname”:
return $item->getName();

case “getqtyordered”:
return $item->getQtyOrdered();

case “getprice”:
return $item->getPrice();

case “getitemweight”:
return $item->getWeight();

case “getrowtotal”:
return $item->getRowTotal();

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

okay, this is where I don’t know enough php:  In the includes.php file this snippet of code seems to be what gets the items:

$check = split("!",$key);
if ($check[1]=="ITEM") {
foreach ($orderMag->getAllItems() as $item) {
if (!$item->getParentItem()) {
$xmlTEXT.="<$check[0]>";
arraytransform($value,$item,$option);
$xmlTEXT.="</$check[0]>";
}
}

The only difference between a child of a bundle item and a regular item is that it has a parent_id value in the database linking it to the sales_flat_order_item record of the bundle master item.  The snippet of code does pick up multiple items (as long as they are not child items of a bundle).  suggestions?
bc

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

nothing like answering my own post:

Commenting out the if then statement where it says if !$item->getParentId();

made it work.  Still testing for unforeseen consequences.

thanks,
bc

 
Magento Community Magento Community
Magento Community
Magento Community
 
Emma86
Sr. Member
 
Total Posts:  110
Joined:  2009-03-03
 

Hi szotyi

thanks for all your wonderful hard work!!

I have a problem though.. I went through your steps.. ran my first export and got a message back saying it exported 10 orders… and open the file and the file it created called znpg.xml has orders...all it has in is: <?xml version="1.0" encoding="iso-8859-1"?> .. nothing else at all

there is another file called exports.xml and that shows that my export went ok and that 1 orders were exported

do you have any idea?

many thanks:)

Emmas

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

hey,

export.php
find:
/* START - Write XML to file */
below few lines:
$xmlString = “<?xml version=\"1.0\" encoding=\"iso-8859-1\"?><$ordersTXT>".$xmlString. “</$ordersTXT>”;
replace to
echo $xmlString = “<?xml version=\"1.0\" encoding=\"iso-8859-1\"?><$ordersTXT>".$xmlString. “</$ordersTXT>”;

no it will print out to the page the xml.. view source code of the page and lets see what u have got there.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Emma86
Sr. Member
 
Total Posts:  110
Joined:  2009-03-03
 

Wow thanks for your fast reply..

I tried what you have their and i get this on sales page:

Parse error: syntax error, unexpected T_STRING in /mypah***/app/design/adminhtml/default/default/template/widget/grid/export.php on line 97

:O whoops hhe.. any ideaa?

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

then
//$xmlString = “<?xml version=\"1.0\" encoding=\"iso-8859-1\"?><$ordersTXT>".$xmlString. “</$ordersTXT>”;
echo $xmlString;

 
Magento Community Magento Community
Magento Community
Magento Community
 
Emma86
Sr. Member
 
Total Posts:  110
Joined:  2009-03-03
 

It outputted the orders to the screen.. it also outputted them to the file this time haha strange sorry for wasting your time smile and thanks massivly for all your help

:D your a star

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

no problem.. but we only solved the problem partly, now there is no beginning and ending of the xml file so…
its better to find the real problem…

did u change the sample?
echo $ordersTXT

what do you get for this?

 
Magento Community Magento Community
Magento Community
Magento Community
 
Emma86
Sr. Member
 
Total Posts:  110
Joined:  2009-03-03
 

it putted each order and all its variables to the screen just above the order export box.. the xml file it created is 100% correct though… it shows all the order details, the xml and everything.. no worries smile

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

Hi szotyi, sorry to bother you again!

I’m pretty close to having a simple CSV export working that produces a very similar output to your XML files.  There are one or two things I am stuck on though!

Basically my CSV export just writes variables to a file and inserts a comma after each variable, for example:

fwrite($fp, $orderMag->getBillingAddress()->getlastname().’,’);

My problem comes when I try to export the SKU’s or quantities of individual items.

Obviously

fwrite($fp, $item->getSku().’,’); wont work so I was wondering if you knew how I could get the equivalent of:

fwrite($fp, $item1->getSku().’,’);
fwrite($fp, $item2->getSku().’,’);

I noticed you have previously posted something about “splitting SKU’s” but I couldnt figure it out.

When I’ve got this working I’ll post it here, hopefully anyone struggling with tab delimited files should be able to modify it slightly for there own requirements too.

Thanks again!

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

I think you are towardsing to the wrong direction.
the main function u have to change is the arraytransform in the includes..

find

$xmlTEXT .= "<$key>".getValue($value$item$option)."</$key>";
change to:
$xmlTEXT .= getValue($value$item$option).";";
find
$xmlTEXT.="<$check[0]>"
arraytransform($value,$item,$option); 
$xmlTEXT.="</$check[0]>";
change to:
arraytransform($value,$item,$option); 
$xmlTEXT.=";";

and do the same with the rest of the $xmlTEXT.=.... within the function

then in the export.php
find (twice!)

$xmlString.= "<$orderTXT>".array2xml($currentsample[$ordersTXT][$orderTXT])."</$orderTXT>";
replace to:
$xmlString.= array2xml($currentsample[$ordersTXT][$orderTXT])."\n";

find:

$xmlString "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?><$ordersTXT>".$xmlString"</$ordersTXT>";
  
$myFile "export/".$filename;
  
$fh fopen($myFile'w');
  
fwrite($fhformatXmlString(removeEmptyTags(removeEmptyTags($xmlString))));
  
fclose($fh);
replace to:
$myFile "export/".$filename;
  
$fh fopen($myFile'w');
  
fwrite($fh$xmlString);
  
fclose($fh);

this is only the part of the work (a big part smile)
i hope u understand the idea…

other idea:
or if u no more about the preg_replace.. u do not change anything only at the last step before u write to file
(fwrite($fh, formatXmlString(removeEmptyTags(removeEmptyTags($xmlString))));)
u just replace the
“</$orderTXT>” to \n
and
<...> to ;
etc etc etc

it is only playing with the string nothing else smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
Emma86
Sr. Member
 
Total Posts:  110
Joined:  2009-03-03
 

Hi szotyi

I hope you dont mind me bothering you again…

I have a quetsion… in includes.php I cant find any refernece to the zip or postal code for shipping ... can you tell me where i can find the zip/postal code?I need to export it along with the address. thanks smile

thanks again friend

Emmas

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