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

Page 9 of 10
[SOLVED] Export orders
 
bargain
Jr. Member
 
Total Posts:  2
Joined:  2009-04-17
 

Hi Everybody,

What a fantastic script - A great solution to many labouring manual tasks!

I have been trying to figure out how to pull custom attributes through from our configurable products “associated (simple) products” / children..

As detailed previously, the way to call the SKU for the children of a configurable product is…

case "getsku"
         if (
$item->getProductType() == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE{
             
return $item->getProductOptionByCode('simple_sku');
        
else {
         
return $item->getSku();}

But I am struggling to repeat this for child custom attributes…

case "getCUSTOMATTRIBUTENAME":
         if (
$item->getProductType() == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE{
             
return '????');
        
else {
         
return $item->getCUSTOMATTRIBUTENAME();}

Any ideas would be gratefully received :o)

 
Magento Community Magento Community
Magento Community
Magento Community
 
suleymankaygisiz
Member
 
Total Posts:  55
Joined:  2010-06-30
 

Hi there,

This post is great and very easy to follow, specialicy for someone who doesn’t knows anything of php or any other coding.

I have everything worked now, but I have problems with editing the samples.php

I don’t understand a **** of this part. I have tried to edit it but keep getting errors.

Default: {
 orders
{
  order
{
    orderinfo
{
      oredid
getorderid,
      
billingnamegetbillingname,
      
billingcountrygetbillingcountry,
      
shippingnamegetshippingname,
      
shippingcountrygetshippingcountry
    }
,
    
items{
      item
!ITEM{        
        sku
getsku,
        
namegetname,
        
qtygetqtyordered,
        
pricegetprice,
        
options!CUSTOMOPTION{
            option
{
              label
getlabel,
              
valuegetvalue
            }
        }
,
        
rowtotalgetrowtotal
      }
    }
,
    
shippingamountgetshippingamount,
    
grandtotalgetgrandtotal
  }
 }
}
,

Maybe a little chance that someone can make that file for me?  red face

The data that I need to export are:

invoicenumber;
shippingname;
costumeremailadres;
shippingadres;
shippingareacode(postcode);
shippingcity;
shippingcountry
itemamount;
itemweight;
phonenumber;

Please helpm meeee smile

 
Magento Community Magento Community
Magento Community
Magento Community
 
Thucar
Jr. Member
 
Avatar
Total Posts:  10
Joined:  2009-12-20
Estonia
 

Hey, absolutely awesome piece of code! Especially the fact that you can customize the output XML freely.

However I am having some problems with the customization part. I have a strict XML layout I will have to follow but having trouble getting the XML to be created.

my sample.php is as follows:

EeDocument:{
    Header
:{
        DateIssued
:"",
        
SenderID:getstoreid,
        
ReceiverID:"Store Name"
    
},
    
Document:{
        DocumentType
:"slsrpt",
        
DocumentParties:{
            BuyerParty
:{
                PartyCode
:"ESTORECLIENT"
            
},
            
OrderParty:{
                Name
:getbillingname
            }
,
        
},
        
DocumentInfo:{
            DocumentNum
:getentityid,
            
DateInfo:{
                IssueDate
:getcreatedat
            }
,
        
},
        
DocumentSumGroup:{
            VAT
:{
                
@attributes:{"vatID":"TAX"},
                
SumBeforeVAT:getsubtotal,
                
VATSum:gettaxamount
            }
,
            
TotalSum:getgrandtotal
        }
,
        
DocumentItem:{
            ItemEntry
:{
                LineItemNum
:getitemid,
                
GTIN:getsku,
                
ItemDescriptiongetname,
                
AmountInvoiced:getqtyordered,
                
ItemPrice:getprice,
                
ItemSum:getrowtotal,
                
VAT:{
                    
@attributes:{
                        
"vatID":"TAX"
                    
},
                    
VATRate:gettaxpercent
                }
            }
        }
    }
}
,

I get no errors, but the XML that is created only has a single line in it:

<?xml version="1.0" encoding="iso-8859-1"?>
and that’s it.

I even took the original XML, converted it to json with an online converter to be sure there are no syntax errors.

I’m at loss here.

 
Magento Community Magento Community
Magento Community
Magento Community
 
brunomarshall
Guru
 
Avatar
Total Posts:  367
Joined:  2009-08-04
 
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 !

Hi,
you must move all your content to your root path i.e publichtml or you want your path to be as sub folder if so change in code

 
Magento Community Magento Community
Magento Community
Magento Community
 
elfling
Enthusiast
 
Avatar
Total Posts:  901
Joined:  2008-10-21
 

Bundled Products…

How would you get the qty ordered for each of the bundle items. Getting the qty for the whole bundle is fine, but per child is rather difficult :(

 
Magento Community Magento Community
Magento Community
Magento Community
 
alblue3799
Jr. Member
 
Total Posts:  17
Joined:  2010-12-28
 

Does anyone know if this will work in 1.4.2.
I have added the code (and modifications) and it looks like it should work, but does nothing. THanks

 
Magento Community Magento Community
Magento Community
Magento Community
 
elfling
Enthusiast
 
Avatar
Total Posts:  901
Joined:  2008-10-21
 

a) The current code can’t be run as a cron because $orders, you need to select which orders are to be exported

b) Checkout your error_log file for an indication of whats going wrong. You probably have a url problem, so its not executing the export script. Re-read through these posts, im pretty sure there is a solution for it here.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Maddis
Jr. Member
 
Total Posts:  13
Joined:  2010-08-18
 

I have the same issue like bargain!

I want to export a custom attribute called “qualitaet” with the XML.

samples.php

items{
      item
!ITEM{        
        sku
getsku,
        
namegetname,
        
qualitaetgetqualitaet,
[...]

and I tried a lot with the includes.php, but nothing worked!

Here is just one failed try:

case "getqualitaet":    
    return 
$item['qualitaet'];

I found a lot of tutorials with $product, but even that didn’t worked! I would also try a direct way via MySQL.

Help me please....

bargain - 17 September 2010 01:17 AM

Hi Everybody,

What a fantastic script - A great solution to many labouring manual tasks!

I have been trying to figure out how to pull custom attributes through from our configurable products “associated (simple) products” / children..

As detailed previously, the way to call the SKU for the children of a configurable product is…

case "getsku"
         if (
$item->getProductType() == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE{
             
return $item->getProductOptionByCode('simple_sku');
        
else {
         
return $item->getSku();}

But I am struggling to repeat this for child custom attributes…

case "getCUSTOMATTRIBUTENAME":
         if (
$item->getProductType() == Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE{
             
return '????');
        
else {
         
return $item->getCUSTOMATTRIBUTENAME();}

Any ideas would be gratefully received :o)
 
Magento Community Magento Community
Magento Community
Magento Community
 
elfling
Enthusiast
 
Avatar
Total Posts:  901
Joined:  2008-10-21
 

Something like this should do it

case "getqualitaet":
$productId $item->getProductId();
$itemdata Mage::getModel('catalog/product')->load($productId); 
$qualitaet $itemdata->getData('qualitaet');
//or
//dropdown
//$qualitaet =  $itemdata->getAttributeText('qualitaet');
return $qualitaet;
Maddis - 16 April 2011 05:45 AM

I have the same issue like bargain!

I want to export a custom attribute called “qualitaet” with the XML.

samples.php

items{
      item
!ITEM{        
        sku
getsku,
        
namegetname,
        
qualitaetgetqualitaet,
 
Magento Community Magento Community
Magento Community
Magento Community
 
point4design
Sr. Member
 
Total Posts:  104
Joined:  2008-07-31
 
elfling - 03 February 2010 09:46 AM

str_replace("_", “, “,$_GET[’orderlist’])

So after coming back to this, this is what creates the exported id’s.. how do i change this to get the increment id.. or am i going to have to figure this out for myself..


/* START - Export selected orders */
 if ($_GET['type']=="custom"{
 
if ($_GET['orderlist']!=""{
 $orderlist 
split("_",$_GET['orderlist']);  $o=0;  $forNick '';  foreach ($orderlist as $currentorder{
   $o
++;
   
$orderMag Mage::getModel('sales/order')->load($currentorder);
   
$forNick .= $orderMag->getRealOrderId().", ";
   
$xmlString.=
"<$orderTXT>".array2xml($currentsample[$ordersTXT][$orderTXT])."</$orderTXT>";
 
}

       
foreach ($orderMag->getAllItems() as $item{

      }
      
//print_r($item);
 
$msg "<div style=\"background:rgb(255249233);colorrgb(235940);text-align:center;padding:3px;\">Exported orders: ".
substr($forNick0, -2). " with ".$_GET['sample']." sample</div>";

 
saveExportsFile($_GET['sample'],"Exported orders: "substr($forNick0, -2),$filename,getLastId());  else {$msg '<div style="background:rgb(255, 249, 233);color:
rgb(235, 94, 0);text-align:center;padding:3px;">No selected order(s)</div>'
;}  }
 
/* END - Export selected orders */

Did you ever get this fixed? I’m having trouble where my exported order #’s arend matching the order ID’s so the admin is getting confused. I’m guessing it is from orders that have been deleted or something.

 
Magento Community Magento Community
Magento Community
Magento Community
 
elfling
Enthusiast
 
Avatar
Total Posts:  901
Joined:  2008-10-21
 

Hi the code you posted above actually is the fix.

Not had a problem since doing so.

 
Magento Community Magento Community
Magento Community
Magento Community
 
point4design
Sr. Member
 
Total Posts:  104
Joined:  2008-07-31
 
elfling - 07 June 2011 07:31 AM

Hi the code you posted above actually is the fix.

Not had a problem since doing so.

Ha! That’s too funny, I put that code in and it is working great! Thanks!

Now if I can just figure out what I did to mess up the ‘Export orders from last export’ function. It shows ‘Last exported orderID: 0’ but never updates and when I click on it to export I get this error ‘No new order(s) since last expor’. Any ideas?

 
Magento Community Magento Community
Magento Community
Magento Community
 
elfling
Enthusiast
 
Avatar
Total Posts:  901
Joined:  2008-10-21
 

@ point4design

I’d suggest repaste the include.php file and see if that fixes your problem.

 
Magento Community Magento Community
Magento Community
Magento Community
 
point4design
Sr. Member
 
Total Posts:  104
Joined:  2008-07-31
 

I’m having trouble when an order has a special character specifically and & in the details. Sometimes my customers enter the ship to name as name1 & name2, if they’re sending it to someone else. This & symbol breaks the export. Any idea how I can fix that?

 
Magento Community Magento Community
Magento Community
Magento Community
 
elfling
Enthusiast
 
Avatar
Total Posts:  901
Joined:  2008-10-21
 

Add this to your includes.php and look for the formatXmlString function and make it so it looks like the following.

function formatXmlString($xml{  
$xml 
preg_replace('/(&)/'"&amp;"$xml);
 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top
Page 9 of 10