private function fillResponseItem($xml, $item) { parent::fillSimpleXmlResponseItem($xml, $item); $userFieldNames = array('userGroupID', 'email', 'firstName', 'lastName', 'companyName', 'isEnabled'); $addressFieldNames = array('stateID', 'phone', 'firstName', 'lastName', 'companyName', 'phone', 'address1', 'address2', 'city', 'stateName', 'postalCode', 'countryID', 'countryName', 'fullName', 'compact'); $cartItemFieldNames = array('name', 'ID', 'productID', 'customerOrderID', 'shipmentID', 'price', 'count', 'reservedProductCount', 'dateAdded', 'isSavedForLater'); // User if (array_key_exists('User', $item)) { foreach ($userFieldNames as $fieldName) { $xml->addChild('User_' . $fieldName, isset($item['User'][$fieldName]) ? $item['User'][$fieldName] : ''); } } // Shipping and billing addresses foreach (array('ShippingAddress', 'BillingAddress') as $addressType) { if (array_key_exists($addressType, $item)) { foreach ($addressFieldNames as $fieldName) { $xml->addChild($addressType . '_' . $fieldName, isset($item[$addressType], $item[$addressType][$fieldName]) ? $item[$addressType][$fieldName] : ''); } } } // cart itmes if (array_key_exists('cartItems', $item)) { $xmlProducts = $xml->addChild('Products'); foreach ($item['cartItems'] as $cartItem) { $ci = $xmlProducts->addChild('Product'); $ci->addChild('sku', isset($cartItem['nameData'], $cartItem['nameData']['sku']) ? $cartItem['nameData']['sku'] : ''); foreach ($cartItemFieldNames as $fieldName) { $ci->addChild($fieldName, isset($cartItem[$fieldName]) ? $cartItem[$fieldName] : ''); } } } // more? }