0

I'm writing custom checkout section and I'm trying to overwrite payment information section of Magento and use existing methods defined in Mage_Payment_Block_Form_Container.

What I'm doing? config.xml contains

  <blocks>
        <zigycheckout>
            <class>Medex_ZigyCheckout_Block</class>
        </zigycheckout>
        <payment>
            <rewrite><form_container>Medex_ZigyCheckout_Block_Form_Container</form_container>
            </rewrite>
        </payment>
    </blocks>

Block class is defined as class Medex_ZigyCheckout_Block_Form_Container extends Mage_Payment_Block_Form_Container

which contains methods which as already defined in Mage_Payment_Block_Form_Container like

  public function getMethodTitle(Mage_Payment_Model_Method_Abstract $method)
    {
        $form = $this->getChild('payment.method.' . $method->getCode());
        if ($form && $form->hasMethodTitle()) {
            return $form->getMethodTitle();
        }
        return $method->getTitle();
    }

but when I call following function in my phtml I'm not getting any return from my function. I think my block is not properly overwritten due to which it's not hitting my block method?

<?php echo $this->escapeHtml($this->getMethodTitle($_method)) ?>

Even the calls like $method = $this->getMethod() is not working.

Do I need to overwrite Payment information related Models also so that these functions should work properly?

  • Have you checked if any other extension is overwriting that block? Check this link. – Adarsh Khatri Jun 15 '15 at 6:06
  • only one block is overwriting [payment/form_container] => Array ( [0] => Medex_ZigyCheckout_Block_Form_Container ) – amitshree Jun 15 '15 at 6:13
  • Did you clean the cache inbetween? Did you check if your block is used? You could enable template hints incl. block names to see if your block is present. How/where do you set the method payment code and title that should be used for return? Maybe you can update your answer with some more details. – Anna Völkl Jun 15 '15 at 10:36
  • Thanks Anna. Issue was with using block type. I was calling another template in my present template keeping the block type same as for current template due to which my block functions were not loading. – amitshree Jun 15 '15 at 11:44

Your Answer

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

Browse other questions tagged or ask your own question.