News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Export XML on order

Started by miles_holt, July 01, 2012, 20:26:06 PM

Previous topic - Next topic

miles_holt

I'm trying to action an export xml when the customer is notified of a new order. I've hacked administrator>virtuemart>modules>orders.php. In the function "notifyCustomer" the xml is actioned and I have managed to get the order details written using $order['details']['BT']->virtuemart_order_id;  and would think the same would work for the items while looping through them but nothing is coming up and can't figure out why?

Here is my code:



$string .= $order['details']['BT']->virtuemart_order_id;
$string2 .= $order['items']->order_item_name;
$string3 .=  $order['details']['BT']->first_name;
$string4 .= $order['details']['BT']->last_name;
$string5 .= $order['details']['BT']->email;


$xml_output .= "<channel>\n";
        $xml_output .= "<item>\n";
       
        $xml_output .= "<order_id>" . $string. "</order_id>\n";
$xml_output .= "<recipient>" . $string3.  $string4. "</recipient>\n";
$xml_output .= "<email>" . $string5. "</email>\n";

foreach($string2 as $item){
$xml_output .= "<product_name>" . $item. "</product_name>\n";
}

        $xml_output .= "</item>\n\n";
$xml_output .= "</channel>";


$file= fopen("output.xml", "w");
fwrite($file, $xml_output);
fclose($file);

echo "xml exported";


Any help appreciated