2

I am trying to save custom form filed value from payment form during place order. I have added custom field in payment form with id method_payment_profile_id

 <div id="selectstore" style="width: 180px;">
        <select name="payment[method]" class="select input-text required-entry" 
                            data-bind="
                                attr: {id: getCode()+'_payment_profile_id'},
                                event:{ change: getSelectedValuecc()},
                                options: getCardList(),
                                optionsValue: 'value',
                                optionsText: 'type',
                                optionsCaption: $t('--Select Store--'),
                                ">
         </select>
     </div>

add bellow code in js file

 getData: function() {
                return {
                    'method': this.item.method,
                    'additional_data': {
                        'bankowner': $('#paytm_payment_profile_id').val()
                    }
                };
            },
            /**
             * Get value of instruction field.
             * @returns {String}
             */
            getInstructions: function () {
                return window.checkoutConfig.payment.instructions[this.item.method];
            }

By event trying to get value of custom form field

observer code

public function execute(EventObserver $observer) {
        $inputParams = $this->_inputParamsResolver->resolve();
        if($this->_state->getAreaCode() != \Magento\Framework\App\Area::AREA_ADMINHTML){
        foreach ($inputParams as $inputParam) {
            if ($inputParam instanceof \Magento\Quote\Model\Quote\Payment) {
                $paymentData = $inputParam->getData('additional_data');
}
}
}
}

i am getting error on this line $inputParams = $this->_inputParamsResolver->resolve();

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.