Pergunta

Im experiencing a problem with a Payment module (librepag) witch follows:

The module has 2 template "info blocks" (that block with the payment details):

  1. used on the backend (app/design/adminhtml/base/default/template/librepag/info/cartao.phtml) - it has some action buttons that the customer shouldn't see
  2. used on the e-mail template (app/design/frontend/base/default/template/librepag/info/cartao.phtml)

When the customer make an order, the correct template (#2) is sent. But when we are at backend order view and click on Send Email button, the #1 is sent instead.

I noticed that in the module Model has the

protected $_formBlockType = 'librepag/form_cartao';
protected $_infoBlockType = 'librepag/info_cartao';

witch corresponds to this particular block

class Weblibre_Librepag_Block_Info_Cartao extends Mage_Payment_Block_Info_Ccsave
{
protected function _construct()
{
    parent::_construct();
    $this->setTemplate('librepag/info/cartao.phtml');
}
...

Why the system is sending different info blocks for the same sendNewOrderEmail method? I saw a similar thread, but didn't figured out how to simply specify another info block on email templates on this module.

Any help is appreciated.

Foi útil?

Solução

When you're in the backend an choose the send mail function the area of every action is admin not frontend, as it's in the shop frontend.

That's why the relative path librepag/info/cartao.phtml is interpreted as adminhtml/default/default/librepag/info/cartao.phtml

To solve this you can call $this->setArea('frontend'); before setTemplate() in the constructor.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top