Index: branches/5.2.x/units/helpers/order_helper.php =================================================================== diff -u -N -r14813 -r14827 --- branches/5.2.x/units/helpers/order_helper.php (.../order_helper.php) (revision 14813) +++ branches/5.2.x/units/helpers/order_helper.php (.../order_helper.php) (revision 14827) @@ -195,4 +195,36 @@ return false; } + + /** + * Extracts fields, used to created user from order + * + * @param OrdersItem $order + * @param string $field_prefix + * @return Array + * @access public + */ + public function getUserFields(&$order, $field_prefix = 'Billing') + { + $fields_hash = Array (); + $names = explode(' ', $order->GetDBField($field_prefix . 'To'), 2); + + $fields_hash['FirstName'] = (string)getArrayValue($names, 0); + $fields_hash['LastName'] = (string)getArrayValue($names, 1); + + $order_fields = Array ( + 'Company', 'Phone', 'Fax', 'Email', 'Address1' => 'Street', + 'Address2' => 'Street2', 'City', 'State', 'Zip', 'Country' + ); + + foreach ($order_fields as $src_field => $dst_field) { + if ( is_numeric($src_field) ) { + $src_field = $dst_field; + } + + $fields_hash[$dst_field] = $order->GetDBField($field_prefix . $src_field); + } + + return $fields_hash; + } }