Currently in creating Admin Users we collect:
Username, First Name, Last Name, Email, Password, Password Confirmation
I would also be interested in adding Address as a field but am not sure how to do so without manually adding it to the database which would take like 10 seconds but I'm pretty sure that's not the intended way by Magento.
Could someone please walk me through the steps and what files I need to create to add this attribute to Admin Users? I've successfully created custom attributes for customers before using the following 3 files:
app/code/local/Sean/CustomerAddCustomAttr/etc/config app/code/local/Sean/CustomerAddCustomAttr/Model/Resource/Eav/Mysql4/Setup.php app/code/local/Sean/CustomerAddCustomAttr/sql/CustomerAddCustomAttr_setup/mysql4-install-0.1.0.php
So I'm familiar with how this should be done but not entirely sure how different it is from adding attributes to customers, because they have an EAV attribute table yet Admin Users don't.
Thank for reading! Hopefully you can help me out. Please leave any further questions if im unclear on anything and I'll update the question or follow up your question with a comment.
1 Answer 1
You are going to need to create a module which creates a new table for a simple address. If you really wanted to you could make it an EAV style table group but I think it would be overkill.
Then just add a layout update for the admin user edit which creates a new tab for the address and an observer which listens to the save event of an admin user and adds/updates the address accordingly.
-
How would I create a table called "admin_address" then link it with the "admin_user" table? I'm not sure that I would want to make it EAV style, I think a simple address would workCodingMageSheen– CodingMageSheen2017年03月24日 18:15:39 +00:00Commented Mar 24, 2017 at 18:15
-
In your module's SQL setup folder you create the install (or upgrade) script to create a table of the fields you want plus a
user_idcolumn is the same data type and length of theadmin_usertable columnuser_id. IIRC it'sINT(8) UNSIGNED NOT NULL. Then in your table you'd create a foreign key between youruser_idfield and theadmin_usertable'suser_idfield. Then in an observer, you could listen to theload_afterevent for theadmin_usermodel and add your custom data to user object.Brett– Brett2017年03月24日 18:19:50 +00:00Commented Mar 24, 2017 at 18:19
Explore related questions
See similar questions with these tags.