Needs work
Project:
Commerce Addressbook
Version:
7.x-2.x-dev
Component:
User interface
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
26 Jan 2012 at 17:25 UTC
Updated:
11 Dec 2015 at 19:44 UTC
Jump to comment: Most recent, Most recent file
Comments
Comment #1
bojanz commentedMoving to 7.x-2.x
This is not on my roadmap. Patches welcome.
Comment #2
drvdt commented+1
Comment #3
drvdt commentedAny solution?
Comment #4
gantenx commentedsubscribing
Comment #5
smazHi there,
We needed this functionality for a company project, so I've created a patch:
Please note that in order to use the ajax user lookup field, a user will also need the 'administer users' permission. It also will not raise the order in the selected users name - I think that's out of scope for this module.
Testing & feedback welcome!
Comment #6
vasikei re-worked the previous patch:
- move the altering code to helper function so it could be used in other cases (#1717234: As an administrator adding a shipping address to an order, I want the ability to search for existing accounts / addresses)
- use existing "administer commerce_customer_profile entities" permission instead of having new permission (ex. 'use any address').
- Order edit form implementation started - #1717234: As an administrator adding a shipping address to an order, I want the ability to search for existing accounts / addresses
I think it requires at least some testing. thank you
Issues:
- Order edit form : i have no success to populate the profile form with data from selected one.
- probably others from tests
Comment #7
stewart.adam commentedI've just tested this and can confirm that the user search and address book functionality works very well. With address population, this would be perfect for setting up customer orders from the admin interface.
Comment #8
bendiy commentedThe patch in #6 works for me. I did get an error for a basic user because global $user wasn't included in commerce_addressbook_profile_field_form_alter(). I've attached a patch that fixes this.
I think this is good as is, but I'd like to see some support for someone between an admin and a basic user to do this. Like a Sales Rep. The 'administer commerce_customer_profile entities' permission may be a little to open for that type of user. I may need to add in support for some new hooks to work in my use case. I'll keep kicking the tires on this patch and see if there's other changes that need to be made.
Comment #9
dobe commentedI have applied patch in #8 however when I choose the address it does not populate the fields below the selection therefore it never gets saved. I am looking into it at this point.
I have been digging in this for a bit. I cannot seem to find where the issue is. When I choose an address on the checkout form all works fine for both being logged in as user 1 as well as getting the current user's address.
The functionality fails without error though on the "admin/commerce/orders/add" page.
-Jesse
Comment #10
Ramirez commentedExperiencing exactly as #9
Comment #11
tonylegrone commentedI'm finding that #9 creates empty profiles every time I try to select an existing one :(
Comment #12
dobe commentedOk I have managed to fix the issue I have experienced please test and confirm. I have just added to #8's patch.
-Jesse
Comment #13
dobe commentedComment #14
dobe commentedWoops This one is better. Accidentally forgot one thing.
Comment #15
xurizaemon(-.-)
Comment #16
xurizaemonAs above, but fixes "Unsupported operand types in commerce_addressbook.module on line 306", which I was seeing as authenticated user with limited role.
If $form_addressbook never gets set then commerce_addressbook_profile_field_form_alter() returns the uninitialized variable, which can't be += to an array in commerce_addressbook_form_alter().
Comment #17
sin commentedHi!
I tried 16 but it is not working and I also got error #2309625: Undefined index: #field_name.
Here is fixed variant based on 16. The form structure is different in my case and I fixed form keys in commerce_addressbook_profile_addressbook_user_validate() and commerce_addressbook_profile_field_form_alter().
It is still not working on order admin add/edit page, works for regular cart checkout only. The admin form structure is different, all $form_state['values'][$profile_element][..] fields are $form_state['values'][...] fields now, so all profiles have their fields mixed. I'm unsure why it is so and what to do next.
Comment #18
b_otho commentedI managed to get it to work in the admin interface with #14.
Comment #19
millenniumtreeRe-rolled #14 with some if()s around the commerce_customer_profile_load_multiple() calls.
Our site has a TON of anonymous customer profiles, so if $account->uid or $user->uid are 0, it crushes the server.
Comment #20
xurizaemonIs it others expectation that this patch should leave the order belonging to the account which owns the selected address, or belonging to the admin which created it and with the address profile populated with the chosen details?
I think the former makes more sense. Basically, Masquerade for checkout.
Comment #21
WillsCreative commentedI've applied #19 and it works perfect when admins create manual orders, however now when customers that don't have anything in their address book try to goto the checkout page, they get a blank white screen. The error log shows this:
Notice: Undefined variable: form_addressbook in commerce_addressbook_profile_field_form_alter() (line 677 of ... commerce_addressbook.module
Comment #22
mglamanBased on comment from #2309625: Undefined index: #field_name marking this as needs work. Also comment from #21.
Comment #23
xurizaemonThe #field_name property is only set in commerce_addressbook_form_alter() when on form commerce_order_ui_order_form, so this triggers a warning on form commerce_checkout_form_checkout from commerce_addressbook_profile_field_form_alter() which uses that variable.