3

I would like to add a field in the checkout page for a custom payment method.

Actually because my method extends CC the form is automatically generated (I have no layout set) look at -> Mage_Checkout_Block_Onepage_Payment_Methods with getPaymentMethodFormHtml() function:

    public function getPaymentMethodFormHtml(Mage_Payment_Model_Method_Abstract $method)
{
     return $this->getChildHtml('payment.method.' . $method->getCode());
}

This is good however I would like to add a comment form ( only for this payment method ) using a custom layout: keep the current form and add an extra block with an text input field.

4

In your payment model, you should set protected $_formBlockType = 'foo/form'; class that derives from Mage_Payment_Model_Method_Cc and create a template/foo/form.phtml file. This allows you to write your own form file.

Then you need to override assignData($data) function (payment model) in order to save this extra field value in the $paymentInfo obj.

In case you will need to show that field in info as well you can do the same as above with $_infoBlockType variable.

|improve this answer|||||
  • right :) I just did it – Fra Feb 6 '13 at 16:11
0

Refer the following link

for doing it using a module created for it

this is the link

|improve this answer|||||
  • 2
    Welcome to magento.se and Thanks for the answer! To be sure, that this information is still available in a few months or years, please copy (rewrite) the most important informations from the blogpost here. – Fabian Blechschmidt May 10 '13 at 13:02
  • the link will stay, hopefully some more years to come. that's a lengthy process, which is why I provided the link. – Shathish May 11 '13 at 5:29

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.