how to save custom form fields data in admin in magento 2?How to add additional field to checkout payment...

How would one buy a used TIE Fighter or X-Wing?

Recrystallisation of dibenzylideneacetone

Getting a UK passport renewed when you have dual nationality and a different name in your second country?

Is there a better way to make this?

The vanishing of sum of coefficients: symmetric polynomials

Quenching swords in dragon blood; why?

How did the original light saber work?

What do you call a fact that doesn't match the settings?

Can I become debt free or should I file for bankruptcy? How do I manage my debt and finances?

Rear brake cable temporary fix possible?

How to generate a matrix with certain conditions

How to acknowledge an embarrassing job interview, now that I work directly with the interviewer?

Why zero tolerance on nudity in space?

If I delete my router's history can my ISP still provide it to my parents?

Eww, those bytes are gross

Tikzing a circled star

How should I handle players who ignore the session zero agreement?

How can I improve my fireworks photography?

Avoiding morning and evening handshakes

Why do neural networks need so many training examples to perform?

What is this metal M-shaped device for?

Closed form for these polynomials?

Does my logo design convey the right feelings for a University Student's Council?

What to do if authors don't respond to my serious concerns about their paper?



how to save custom form fields data in admin in magento 2?


How to add additional field to checkout payment (Magento 2)Add form fields to Checkout -> Payment&Review stepHow to add custom checkout fields and save them in db?Magento 2 : How to add additional fields to newsletterHow to save the custom field data in payment section magento 2 to payment related table?Custom Checkout Step Fields not in Post DataHow to add a custom form in a custom payment methodCan't save checkout custom fields in databaseCheckout Page Custom Field data is not saved in Magento 2Magento2 checkout page add custom text fieldMagento 2 : How to get Additional Information in payment info for custom payment method?













0















I have created three custom form fields in checkout payment section.



I have followed this link to create form fields (How to add additional field to checkout payment (Magento 2)).



Now want to know how to save these fields data in the database.



Thanks










share|improve this question
















bumped to the homepage by Community 10 mins ago


This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.




















    0















    I have created three custom form fields in checkout payment section.



    I have followed this link to create form fields (How to add additional field to checkout payment (Magento 2)).



    Now want to know how to save these fields data in the database.



    Thanks










    share|improve this question
















    bumped to the homepage by Community 10 mins ago


    This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.


















      0












      0








      0


      1






      I have created three custom form fields in checkout payment section.



      I have followed this link to create form fields (How to add additional field to checkout payment (Magento 2)).



      Now want to know how to save these fields data in the database.



      Thanks










      share|improve this question
















      I have created three custom form fields in checkout payment section.



      I have followed this link to create form fields (How to add additional field to checkout payment (Magento 2)).



      Now want to know how to save these fields data in the database.



      Thanks







      magento2 checkout






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Jun 1 '17 at 7:21









      diazwatson

      1,52011424




      1,52011424










      asked Sep 23 '16 at 9:58









      user3493165user3493165

      111




      111





      bumped to the homepage by Community 10 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.







      bumped to the homepage by Community 10 mins ago


      This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
























          1 Answer
          1






          active

          oldest

          votes


















          0














          You can add getData method in your js file:



          getData: function() {
          return {
          'method': "methodcode",
          'additional_data': {
          'customfield1': $('#'+this.getCode()+'_customfield1').val(),
          'customfield2': $('#'+this.getCode()+'_customfield2').val(),
          }
          };
          },


          then you can get these fields in additional data param in your payment model:



          namespace NamespaceModuleNameModel;

          class Payment extends MagentoPaymentModelMethodCc
          {
          public function assignData()
          {
          $post = $data->getData()['additional_data'];
          // write your custom code
          }
          }





          share|improve this answer























            Your Answer








            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "479"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: false,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f137812%2fhow-to-save-custom-form-fields-data-in-admin-in-magento-2%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            0














            You can add getData method in your js file:



            getData: function() {
            return {
            'method': "methodcode",
            'additional_data': {
            'customfield1': $('#'+this.getCode()+'_customfield1').val(),
            'customfield2': $('#'+this.getCode()+'_customfield2').val(),
            }
            };
            },


            then you can get these fields in additional data param in your payment model:



            namespace NamespaceModuleNameModel;

            class Payment extends MagentoPaymentModelMethodCc
            {
            public function assignData()
            {
            $post = $data->getData()['additional_data'];
            // write your custom code
            }
            }





            share|improve this answer




























              0














              You can add getData method in your js file:



              getData: function() {
              return {
              'method': "methodcode",
              'additional_data': {
              'customfield1': $('#'+this.getCode()+'_customfield1').val(),
              'customfield2': $('#'+this.getCode()+'_customfield2').val(),
              }
              };
              },


              then you can get these fields in additional data param in your payment model:



              namespace NamespaceModuleNameModel;

              class Payment extends MagentoPaymentModelMethodCc
              {
              public function assignData()
              {
              $post = $data->getData()['additional_data'];
              // write your custom code
              }
              }





              share|improve this answer


























                0












                0








                0







                You can add getData method in your js file:



                getData: function() {
                return {
                'method': "methodcode",
                'additional_data': {
                'customfield1': $('#'+this.getCode()+'_customfield1').val(),
                'customfield2': $('#'+this.getCode()+'_customfield2').val(),
                }
                };
                },


                then you can get these fields in additional data param in your payment model:



                namespace NamespaceModuleNameModel;

                class Payment extends MagentoPaymentModelMethodCc
                {
                public function assignData()
                {
                $post = $data->getData()['additional_data'];
                // write your custom code
                }
                }





                share|improve this answer













                You can add getData method in your js file:



                getData: function() {
                return {
                'method': "methodcode",
                'additional_data': {
                'customfield1': $('#'+this.getCode()+'_customfield1').val(),
                'customfield2': $('#'+this.getCode()+'_customfield2').val(),
                }
                };
                },


                then you can get these fields in additional data param in your payment model:



                namespace NamespaceModuleNameModel;

                class Payment extends MagentoPaymentModelMethodCc
                {
                public function assignData()
                {
                $post = $data->getData()['additional_data'];
                // write your custom code
                }
                }






                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Sep 26 '16 at 5:02









                Yogesh KarodiyaYogesh Karodiya

                1,92321235




                1,92321235






























                    draft saved

                    draft discarded




















































                    Thanks for contributing an answer to Magento Stack Exchange!


                    • Please be sure to answer the question. Provide details and share your research!

                    But avoid



                    • Asking for help, clarification, or responding to other answers.

                    • Making statements based on opinion; back them up with references or personal experience.


                    To learn more, see our tips on writing great answers.




                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f137812%2fhow-to-save-custom-form-fields-data-in-admin-in-magento-2%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    迭戈·戈丁...

                    A phrase ”follow into" in a context The 2019 Stack Overflow Developer Survey Results Are...

                    1960s short story making fun of James Bond-style spy fiction The 2019 Stack Overflow Developer...