<?php
$row = array(
'entity_id' =>
"14",
'entity_type_id' =>
"1",
'attribute_set_id' =>
"0",
'website_id' =>
"1",
'email' =>
"office@solarpower-augsburg.de",
'group_id' =>
"1",
'increment_id' =>
"000000011",
'store_id' =>
"0",
'created_at' =>
"2013-10-22 10:28:59",
'updated_at' =>
"2013-10-22 10:51:50",
'is_active' =>
"1",
'disable_auto_group_change' =>
"0",
'prefix' =>
"Herr",
'firstname' =>
"Gabriele ",
'middlename' =>
NULL,
'lastname' =>
"Ament",
'suffix' =>
"Solarpower Energy for Life",
'name' =>
"Herr Gabriele Ament Solarpower Energy for Life",
'is_partner' =>
"1",
'default_billing' =>
"16",
'billing_firstname' =>
"Gabriele ",
'billing_lastname' =>
"Ament",
'billing_postcode' =>
"86199",
'billing_city' =>
"Augsburg",
'billing_telephone' =>
"0821·90732-50",
'billing_country_id' =>
"DE",
'billing_street' =>
"Zum Fuggerschloß 38",
'billing_region' =>
"Bayern",
'billing_company' =>
"Solarpower Energy for Life Gabriele Ament e.K.",
'tom_geo_latitude' =>
"48.3237705",
'tom_geo_longitude' =>
"10.8221745",
);
$dom = new DOMDocument("1.0","UTF-8");
$node = $dom->createElement("Markers");
$parnode = $dom->appendChild($node);
foreach ($row as $key => $value) {
$address = $value['billing_street'] .','. $value['billing_country_id'] .'-'. $value['billing_postcode'] .' '. $value['billing_city'];
$distance = 6371 * acos( cos( deg2rad($qryVal[0]) ) * cos( deg2rad( $value['tom_geo_latitude'] ) ) * cos( deg2rad( $value['tom_geo_longitude'] ) - deg2rad($qryVal[1]) ) + sin( deg2rad($qryVal[0]) ) * sin(deg2rad( $value['tom_geo_latitude'] ) ) );
$contactPerson = $value['billing_firstname'] .' '. $value['billing_lastname'];
// ADD TO XML DOCUMENT NODE
$marker = $dom->createElement("Marker");
$newnode = $parnode->appendChild($marker);
$newnode->setAttribute("StoreId", $value['store_id']);
$newnode->setAttribute("Lat", $value['tom_geo_latitude']);
$newnode->setAttribute("Lng", $value['tom_geo_longitude']);
$newnode->setAttribute("Distance", $distance);
$newnode->setAttribute("ImgUrl", $key['ImgUrl']);
$newnode->setAttribute("CategoryIcon", '/skin/frontend/default/solarinvert/tom/dealer/default.png');
$newnode->setAttribute("Contactperson", $contactPerson);
$newnode->setAttribute("Phone", $value['billing_telephone']);
$newnode->setAttribute("Logo", $value['logo']);
/*
$newnode->setAttribute("Country", $value['billing_country_id']);
$newnode->setAttribute("Fax", $value['billing_fax']);
$newnode->setAttribute("Address", $address);
$newnode->setAttribute("Type", $value['Type']);
$newnode->setAttribute("Email", $value['email']);
$newnode->setAttribute("Website", $value['Website']);
$newnode->setAttribute("State", $value['billing_region']);
$newnode->setAttribute("City", $value['billing_city']);
$newnode->setAttribute("Name", $value['billing_company']);
*/
// $newnode->setAttribute("LabelId", $key['LabelId']);
// $newnode->setAttribute("LabelText", $key['LabelText']);
// $newnode->setAttribute("Google", $key['Google']);
// $newnode->setAttribute("Facebook", $key['Facebook']);
// $newnode->setAttribute("Twitter", $key['Twitter']);
// $newnode->setAttribute("Printrest", $key['Printrest']);
// $newnode->setAttribute("Gallery", $row['Gallery']);
// $newnode->setAttribute("Info", $row['Info']);
// $newnode->setAttribute("Working", $row['Working']);
// $newnode->setAttribute("Video", $row['Video']);
// $newnode->setAttribute("Direction", $row['Direction']);
}
echo $dom->saveXML();
preferences:
34.28 ms | 402 KiB | 5 Q