Is there any way to use this address data to create user maps?

I need to create a "find a Doctor" locator that will be based on customers of a certain role. The role based on their purchases. But I cannot see how to get this data out for that purpose.

Or can the default billing address be used to populate the standard address fields?

Hope that makes sense.

Comments

MegaChriz’s picture

Status: Active » Fixed

I suppose Geomap, Geolocator and Openlayers you mention, are modules? I don't know anything about these modules, so I can't say if you can easily "transfer" the address data from this module to the other. Anyway, Ubercart Addresses doesn't support anything geo related out of the box. It only stores addresses and it modifies the Ubercart checkout process so these addresses can be selected at checkout.

I think you should find the solution in creating a custom module. You can get the default billing address via the API this way:

$address = UcAddressesAddressBook::get($uid)->getDefaultAddress('billing');

The returned address will be an instance of UcAddressesAddress or NULL, if the user has no default billing address (which can happen if the user never entered an address).

The raw values of the address can then be get by calling the method getRawFieldData():

$address_values = $address->getRawFieldData();

See also Setting and getting address fields.

Does this answer your question? If not, feel free to set the status back to "active".

samgreco’s picture

Status: Fixed » Active

It makes sense. Although I can't code my way out of a paper bag.

Is there a way to make the Ubercart Address field available to the User profile?

MegaChriz’s picture

Is there a way to make the Ubercart Address field available to the User profile?

Do you mean you like to have an address edit form on the user edit page (user/3/edit or user/3/edit/profile)? That's not possible at the moment without custom code. A similar issue about this: #711764: uc_addresses CCK Field

If you want to display address values instead, that could possible be done with Views (create a block and set this block to be only shown on the user profile page).

samgreco’s picture

It's hard to describe, I guess.

I am trying to use GeoField which takes location data from the Address Field to create a Geocode that Openlayers can use to place those items on a map. But I need to have both fields (GeoField and AddressField) in the same place (User profile). Since I cannot get the UC_AddressField in user profile, Geofield can't extrat that info to pass on, etc.

The only answer I can find thusfar is to have my users register using the address field attached to the standard user registration and then fill out the standard Ubercart address info as well. It means having them enter the same info twice, but it's the only way I can see it working for me.

MegaChriz’s picture

As I read the Geocoder project page, it sounds like that it wouldn't be too hard to write some code that would connect Ubercart Addresses with the Geocoder module. Maybe I can make some time free this weekend to take a look at how much effort it would take to add support for the Geocoder module. On the other hand, fixing bugs in Ubercart Addresses has my main priority at the moment, so I can't make any promises.

samgreco’s picture

No worries. I appreciate your even considering it :)

And I know that bugs are more important.

MegaChriz’s picture

Category: support » feature
Status: Active » Postponed

I've watched the video that was noted at the Geocoder project page. While this video matched perfectly with how you described the issue, it didn't match with my view/expectations about how easy it was to add support for the Geocoder module in the Ubercart Addresses module.
Ubercart Addresses does not integrate with the core field API at the moment, so adding support can't be easily done in a way it's presented in the video (both fields in the same place). Probably there are other ways, but I don't seeing my self exploring that in the nearby future if I look on my list of things left to do. But you never know, sometimes I'm stuck on things needed to be done and then I suddenly have time free for "experiments" :).

If you'd like to have this feature quickly, then you can better hire a developer. For now, I postpone this issue, but with the intention to return to it.

samgreco’s picture

Thanks for going the extra step here. I think i found a way to get what I need by using Geofield Maps and forcing the users to enter their Practice's address through the normal user registration when the buy something. So their "business address" get's entered into a normal address field. Ubercart Addresses still deals with billing and shipping addresses. So it's double entry in most cases, but it's working for my needs.