0

I created three custom field in customer account edit page and same field created in admin panel inside customer edit form.

But now, how to save data? I tried to override the editPost.php file and use this $customer->setCustomAttribute('abc',$this->getRequest()->getParam('ABC'));

This is not help in saving data and show undefine variable "customer" error.

Notice: Undefined variable: customer in /opt/lampp/htdocs/magento/app/code/xxx/xxx/Controller/Account/EditPost.php on line 140
  • create fields using custom attribute , so these value will save by model – BornCoder Feb 7 '17 at 11:33
  • how to create field by custom attribute in frontend. and i am using community edition, so there is no feature of creating customer attribute in admin panel. i created that attribute by installdata.php – sam Feb 7 '17 at 11:36
  • @sam: did you understood how to save additional data? I'm experiencing the same trouble. Thanks, Ale – Ale Jun 5 '17 at 15:40
  • @Ale, yes i understood. please see my answer. – sam Jun 6 '17 at 9:13
0

Create customer attribute in installer script by following this link.

These will help you in creating attribute for frontend.

| improve this answer | |
  • i created custom attribute like this only. and data is saved also in admin panel, my question is , on fronted , customer account information page, i created field, from there how to save the data? – sam Feb 7 '17 at 12:19
  • you don't need to create fields in frontend , they will come with this code: 'used_in_forms' => ['customer_account_create','adminhtml_checkout','adminhtml_customer'], – BornCoder Feb 7 '17 at 13:25
  • No it is not coming. by this code it is coming only in admin panel – sam Feb 7 '17 at 13:34
0

I created some custom field in customer account edit page, and i saved their value in database by editing editpost.php file.

  1. Please don't change the default file, so first overide that file in your custom module

  2. then in execute function , under try, put these code

suppose that i created one field "myname" on frontend in edit form, and one field "name" in admin panel edit form. in database, the column name is also should be "name" then the code will be;

$customerCandidateDataObject->setCustomAttribute('name',$this->getRequest()->getParam('myname'));
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.