cancel
Showing results for 
Search instead for 
Did you mean: 

Posting Custom Customer Registration Values to Database

Posting Custom Customer Registration Values to Database

Hi,

I have one custom attribute (called 'skype') on my customer registration page, achieved through installing magento's customer attributes extension on my admin panel.I also have this attribute on my database under the table called (customer_entity).But on saving the customer's details, i have noticed that there is no value saved on my 'skype' field but the rest are okay.

skype.PNG

I have done some research and i'm aware that function execute on CreatePost Controller does action create,so my question is how can i include my skype value to be saved alongside the other registration details in that function ('execute')?

 

5 REPLIES 5

Re: Posting Custom Customer Registration Values to Database

Hi @mary_ondire 

 

As I can understand you are adding a new field in Magento registration field and facing an issue with saving field value in database. Here I have a tutorial video for this. OR this link can help you.

 

I hope above video and answer link will help you.

 

Thanks
--
If my answer is useful, please Accept as Solution & give Kudos

Re: Posting Custom Customer Registration Values to Database

Hello @mary_ondire 

 

basically while create attribute you need to specify on which form do you want to show that attribute

 

$attribute = $customerSetup->getEavConfig()->getAttribute(Customer::ENTITY, 'mobile_number')
              ->addData([
                  'attribute_set_id' => $attributeSetId,
                  'attribute_group_id' => $attributeGroupId,
                  'used_in_forms' => ['adminhtml_customer', 'customer_account_create'],
              ]);

hope it will work for you.


Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer

Re: Posting Custom Customer Registration Values to Database

Hi @PankajS_Magento 

 

Thanks, your method works.When i edit a cutomer's profile on the admin panel it does fetch the skype value. I did add a column on my customer_entity table called 'skype' but it seems like the skype value is not being saved there. So a quick question, in which table is the skype value being stored?

Re: Posting Custom Customer Registration Values to Database

Hi @Sunil Patel 

Indeed that creates the attribute on various customer tables which is okay. Question is, how can we save the attribute's value in the customer_entity table when a customer registers?

 

Regards.

Re: Posting Custom Customer Registration Values to Database

Hello @mary_ondire 

 

I am a little bit confused why you created column into customer_entity.

 

If you are creating attribute using customer_entity then you need to create static attribute.


Problem solved? Click Kudos & Accept as Solution!
Sunil Patel
Magento 2 Certified Professional Developer & Frontend Developer