AddressField Dropdown

Events happening in the community are now at Drupal community events on www.drupal.org.
mastermindg's picture

I've been racking my brain trying to figure this out....

I have a content type (Retailer) that has multiple addresses (as you would hope one would have :)) that are defined by Addressfield. The idea here is to relate the AddressField to a Product content type where (when creating a new Product) a drop-down box would be available to choose which address the Product is at.

I know that I can create a separate content type named Address and put the addresses there and use Node Reference to associate these; however, the difficulty here is that I want the addresses to be associated with Retailer...I would prefer to keep the addresses with the Retailer content type as this seems a much more logical configuration.

Any help would be AweSome! Thanks!

Comments

Address field consists of

Sinan Erdem's picture

Address field consists of multiple fields (City, Country etc), so i dont think you can directly connect an address to a Product easily. Why dont you just keep address entities to store different addresses of a Retailer?

Or maybe you can use OG. Then each retailer would be a group, and a product would be a group content? That way, it would be easier to organize things.

I'm not sure, but I think

JSCSJSCS's picture

I'm not sure, but I think what you are saying is that you have products that are available from a vendor, but only at some of that vendors' locations?

I would split the content types up into vendors, locations (addressfield) and of course products.

Associate products with locations that have addressfields, and locations to vendors.

Then if a product is available from more than one location, it might also be available from more than one vendor and using views, you could point that out any way you see fit.

You could create rules that break those associations when a vendor or location is removed, etc.

James Sinkiewicz
Drupal Site Builder and Generalist
http://MyDrupalJourney.com

Limiting view

mastermindg's picture

James, thanks for the help! My only concern is in limiting the number of locations that come up when adding a product. Since the content type Locations would be shared it might become more cumbersome to select. Would there be a way to limit the Locations?

In the View. You can select

JSCSJSCS's picture

In the View. You can select how many to show or add a pager for all of them or even do a geo-lookup of the closest ones with a couple of extra modules, etc.

James Sinkiewicz
Drupal Site Builder and Generalist
http://MyDrupalJourney.com

Thanks!

mastermindg's picture

This makes a lot of sense. I think I've finally wrapped my head around this. Thanks so much!

Best videos on Views on the net!

James Sinkiewicz
Drupal Site Builder and Generalist
http://MyDrupalJourney.com

Location and Mapping

Group organizers

Group categories

Wiki type

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: