0

How to add custom field (Account Number) on cash on delivery payment check with it's additional data saved?

I have referred this link http://www.ibnab.com/en/blog/magento-2/save-payment-method-with-additional-data-show-custom-field-on-payment-check

as the above link saves data for bank transfer payment and i have replaced it with cash on delivery payment method.. i have applied the module but no changes.. Could someone guide me on this Any help would be appreciated

2
  • Have you run setup:upgrade and content deployment command after apply module ?
    – user55548
    Commented Oct 29, 2018 at 8:16
  • Yup, i have run the commands
    – Amy
    Commented Oct 29, 2018 at 9:00

2 Answers 2

0

In your given link code is written for Bank transfer method. Try to check for bank transfer method. If you want to use this code for COD then need to change need to change in COD related file. Also need to change following condition

<?php if ($method == Banktransfer::PAYMENT_METHOD_BANKTRANSFER_CODE) :?>
<div class="admin__page-section-item-content">
    <strong><?php echo __('Account Name:') ?></strong>
    <span class="price"><?php echo $payment->getData('bankowner'); ?></span>                        
</div>
<?php endif; ?>

Here you need to replace Banktransfer::PAYMENT_METHOD_BANKTRANSFER_CODE to your COD related code.

10
  • I have replaced it with Cash on delivery but no effect at.. i don't know where i made mistake..
    – Amy
    Commented Oct 29, 2018 at 10:59
  • In which file you have replaced ?
    – user55548
    Commented Oct 29, 2018 at 11:30
  • Check out my file path TemplateMonster/Cashondeliveries/view/adminhtml/templates/info/cashondeliveryinfo.phtml
    – Amy
    Commented Oct 29, 2018 at 12:12
  • In above file path i have replaced it with COD
    – Amy
    Commented Oct 29, 2018 at 12:15
  • As per your given example, need to call your cod phtml file form xml as given on that page. <referenceContainer name="payment_additional_info"> <block class="Ibnab\Additional\Block\Info\BanktransferInfo" name="ibnab_banktransfert_infos" template="Ibnab_Additional::info/banktransferinfo.phtml" /> </referenceContainer>
    – user55548
    Commented Oct 29, 2018 at 12:46
0

Take a look on my screen shot. i have applied the module for banktranfer method but no changes at all.. not even showing any errors.

enter image description here

Your Answer

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

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