0

I'm trying to display <?php echo $this->escapeHtml($this->getMethod()->getPayableTo()) ?> outside of checkmo.phtml - and in ccsave.phtml, but simply pasting the code doesn't render a result.

I've tried several ways to get this to render, to no avail.

Here's what I'm working with:

<?php $payableto = Mage::getStoreConfig('payment/checkmo'); echo $this->__('Payments will be processed by: ') . $payableto; ?>

This returns Payments will be processed by: Array.

Adding <?php $payableto = Mage::getStoreConfig('payment/checkmo')->getPayableTo();?> renders html up to the point of the code. Everthing before renders, everything after does not.

How do I access this information outside of checkmo.phtml?

Edit 1: Trying @AmitBera's code throws and error and report with the following contents:

a:5:{i:0;s:46:"Cannot retrieve the payment info model object.";i:1;s:6172:"#0 /var/www/html/dev.site/app/code/core/Mage/Payment/Block/Info.php(55): Mage::throwException('Cannot retrieve...')
/var/www/html/dev.site/app/code/core/Mage/Payment/Block/Info/Checkmo.php(73): Mage_Payment_Block_Info->getInfo()
/var/www/html/dev.site/app/code/core/Mage/Payment/Block/Info/Checkmo.php(48): Mage_Payment_Block_Info_Checkmo->_convertAdditionalData()
/var/www/html/dev.site/app/design/frontend/site/default/template/payment/form/ccsave.phtml(136): Mage_Payment_Block_Info_Checkmo->getPayableTo()
/var/www/html/dev.site/app/code/core/Mage/Core/Block/Template.php(241): include('/var/www/html/d...')
/var/www/html/dev.site/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('frontend/site/de...')
/var/www/html/dev.site/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
/var/www/html/dev.site/app/code/core/Mage/Payment/Block/Form/Cc.php(157): Mage_Core_Block_Template->_toHtml()
/var/www/html/dev.site/app/code/core/Mage/Core/Block/Abstract.php(919): Mage_Payment_Block_Form_Cc->_toHtml()
/var/www/html/dev.site/app/code/core/Mage/Core/Block/Abstract.php(637): Mage_Core_Block_Abstract->toHtml()
/var/www/html/dev.site/app/code/core/Mage/Core/Block/Abstract.php(581): Mage_Core_Block_Abstract->_getChildHtml('payment.method....', true)
/var/www/html/dev.site/app/code/core/Mage/Checkout/Block/Onepage/Payment/Methods.php(72): Mage_Core_Block_Abstract->getChildHtml('payment.method....')
/var/www/html/dev.site/app/design/frontend/site/default/template/checkout/onepage/payment/methods.phtml(59): Mage_Checkout_Block_Onepage_Payment_Methods->getPaymentMethodFormHtml(Object(Mage_Payment_Model_Method_Ccsave))
/var/www/html/dev.site/app/code/core/Mage/Core/Block/Template.php(241): include('/var/www/html/d...')
/var/www/html/dev.site/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('frontend/site/de...')
/var/www/html/dev.site/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
/var/www/html/dev.site/app/code/core/Mage/Core/Block/Abstract.php(919): Mage_Core_Block_Template->_toHtml()
/var/www/html/dev.site/app/code/core/Mage/Core/Block/Abstract.php(637): Mage_Core_Block_Abstract->toHtml()
/var/www/html/dev.site/app/code/core/Mage/Core/Block/Abstract.php(581): Mage_Core_Block_Abstract->_getChildHtml('methods', true)
/var/www/html/dev.site/app/design/frontend/site/default/template/checkout/onepage/payment.phtml(37): Mage_Core_Block_Abstract->getChildHtml('methods')
/var/www/html/dev.site/app/code/core/Mage/Core/Block/Template.php(241): include('/var/www/html/d...')
/var/www/html/dev.site/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('frontend/site/de...')
/var/www/html/dev.site/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
/var/www/html/dev.site/app/code/core/Mage/Core/Block/Abstract.php(919): Mage_Core_Block_Template->_toHtml()
/var/www/html/dev.site/app/code/core/Mage/Core/Block/Abstract.php(637): Mage_Core_Block_Abstract->toHtml()
/var/www/html/dev.site/app/code/core/Mage/Core/Block/Abstract.php(581): Mage_Core_Block_Abstract->_getChildHtml('payment', true)
/var/www/html/dev.site/app/design/frontend/site/default/template/checkout/onepage.phtml(39): Mage_Core_Block_Abstract->getChildHtml('payment')
/var/www/html/dev.site/app/code/core/Mage/Core/Block/Template.php(241): include('/var/www/html/d...')
/var/www/html/dev.site/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('frontend/site/de...')
/var/www/html/dev.site/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
/var/www/html/dev.site/app/code/core/Mage/Core/Block/Abstract.php(919): Mage_Core_Block_Template->_toHtml()
/var/www/html/dev.site/app/code/core/Mage/Core/Block/Text/List.php(43): Mage_Core_Block_Abstract->toHtml()
/var/www/html/dev.site/app/code/core/Mage/Core/Block/Abstract.php(919): Mage_Core_Block_Text_List->_toHtml()
/var/www/html/dev.site/app/code/core/Mage/Core/Block/Abstract.php(637): Mage_Core_Block_Abstract->toHtml()
/var/www/html/dev.site/app/code/core/Mage/Core/Block/Abstract.php(581): Mage_Core_Block_Abstract->_getChildHtml('content', true)
/var/www/html/dev.site/app/design/frontend/site/default/template/page/2columns-right.phtml(49): Mage_Core_Block_Abstract->getChildHtml('content')
/var/www/html/dev.site/app/code/core/Mage/Core/Block/Template.php(241): include('/var/www/html/d...')
/var/www/html/dev.site/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('frontend/site/de...')
/var/www/html/dev.site/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
/var/www/html/dev.site/app/code/core/Mage/Core/Block/Abstract.php(919): Mage_Core_Block_Template->_toHtml()
/var/www/html/dev.site/app/code/core/Mage/Core/Model/Layout.php(555): Mage_Core_Block_Abstract->toHtml()
/var/www/html/dev.site/app/code/core/Mage/Core/Controller/Varien/Action.php(390): Mage_Core_Model_Layout->getOutput()
/var/www/html/dev.site/app/code/core/Mage/Checkout/controllers/OnepageController.php(215): Mage_Core_Controller_Varien_Action->renderLayout()
/var/www/html/dev.site/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Checkout_OnepageController->indexAction()
/var/www/html/dev.site/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('index')
/var/www/html/dev.site/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
/var/www/html/dev.site/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
/var/www/html/dev.site/app/Mage.php(684): Mage_Core_Model_App->run(Array)
/var/www/html/dev.site/index.php(87): Mage::run('dev_site_com', 'website')
{main}";s:3:"url";s:18:"/checkout/onepage/";s:11:"script_name";s:10:"/index.php";s:4:"skin";s:10:"dev_site_en";}

Edit 2: Trying @DavidManners' code renders the same results as my original code; html before the code renders, but after does not.

3
  • Check your logs and add the error to your question please. Commented Nov 11, 2014 at 23:32
  • $this->getLayout()->createBlock('payment/info_checkmo')->getPayableTo();
    – Amit Bera
    Commented Nov 12, 2014 at 1:59
  • I realize that I wasn't as clear as I should have been.. When I said in my initial post that adding the code "breaks the site" - what I should have said is that the html renders to the point of that code - then stops. So everything above that code renders. Now, trying the code above from @AmitBera does actually BREAK the site. Here is the top line from the report: a:5:{i:0;s:46:"Cannot retrieve the payment info model object.";i:1;s:6172:"#0 /var/www/html/dev.website/app/code/core/Mage/Payment/Block/Info.php(55): Mage::throwException('Cannot retrieve...')
    – DomainSoil
    Commented Nov 12, 2014 at 16:18

1 Answer 1

1

What you need to do is to get the correct model for the checkmo.

/** @var Mage_Payment_Model_Method_Checkmo $info */
$info = Mage::getModel('payment/method_checkmo');
$info->getPayableTo();

Now you are able to get the payable to information from the model itself.

2
  • Thanks for your answer @davidmanners, however I'm facing the same result that I began with. HTML renders before the code, but does not after the code.
    – DomainSoil
    Commented Nov 12, 2014 at 20:08
  • @DomainSoil sorry I do not understand what you mean about html rendering before the code but not after? Commented Feb 21, 2015 at 19:57

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.