I have added custom emails template it is working fine preview and in admin side transnational email section after loading code.But i need to implement preview section in front-end so when i load email template code

$emailTemplate = Mage::getModel('core/email_template')->loadByCode($templateId);

It's printing array as output.

Customer able to see preview before sending email.


1 Answer 1

$template = Mage::getModel('core/email_template')->loadDefault($templateId);
    $templateProcessed = $template->getProcessedTemplate($vars, true);
    return $templateProcessed;

In $vars place need to pass variables array which you have added in template file for example i have below variable i am passing like the below

$vars = array('name' => $toname,
        'personal_message' => str_replace(array("\r\n","\r"),"<br>",$data['presonal_message']),
                  'custom_logo' => $custom_logo,

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.