Closed (fixed)
Project:
Commerce Core
Version:
7.x-1.x-dev
Component:
Customer
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Issue tags:
Reporter:
Created:
4 Feb 2012 at 14:03 UTC
Updated:
4 Jan 2014 at 01:39 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
bojanz commentedSimple patch.
Might want to use wrapper instead (for code style), since this is the first usage of field_get_items() in commerce code ;)
Comment #2
rszrama commentedWe'll need a fallback in the event that a customer profile type does not have an address field. Perhaps we can implement this callback as an abstraction layer between a per customer profile type callback. The default callback can check for an addressfield and use its label and fallback to the profile ID if no addressfield is found. Then of course any other module can implement an alternate callback.
Comment #3
bojanz commentedSo perhaps in the "bundle" array have a "bundle label callback" key, and have our label callback call the "bundle label callback" function if it exists, and if not, just return the profile_id. A bundle-level label callback always knows which data it has and what it should use.
Not sure if it's perhaps a bit overcomplicated.
Comment #4
googletorp commentedI tried to implement what Ryan said in #2.
So what did I do?
* I set the default callback on the profile type on generation (but it can be deleted through alter)
* I created a label callback that will try to get the label callback from the profile type and fallback to a default callback.
* Created the default callback that will try to get the street from the address field, if empty of the addressfield doesn't exist, it returns the profile id instead.
Tested with all cases I could image, (no address field, addressfield with no address and addressfield with address) and works great.
Comment #5
rszrama commentedTagging.
Comment #6
helior commentedThis is pretty straight forward and looks ready to commit to me. I tried to break it, but I couldn't :P
Comment #7
rszrama commentedI added docs for this to commerce_customer.api.php, and I don't see any reason not to go with name_line for the label. It may be open to collisions, but it's at least more useful than the street address. Committed! Thanks all.
Comment #8.0
(not verified) commentedClarify sentence.