Created
April 23, 2019 10:42
-
-
Save dupadhyay3/cb60da99213156930189e80fc879e682 to your computer and use it in GitHub Desktop.
Magento 1 Order Email Template Preview
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
require_once 'app/Mage.php'; | |
Mage::app(); | |
ini_set('display_errors', 1); | |
// loads the proper email template | |
$emailTemplate = Mage::getModel('core/email_template') | |
->load(7); | |
// All variables your error log tells you that are missing can be placed like this: | |
$emailTemplateVars = array(); | |
$emailTemplateVars['order'] = Mage::getModel('sales/order')->load(14513); | |
$order = $emailTemplateVars['order']; | |
$emailTemplateVars['usermessage'] = "blub"; | |
$emailTemplateVars['store'] = Mage::app()->getStore(); | |
$emailTemplateVars['sendername'] = 'noissue'; | |
$emailTemplateVars['receivername'] = $order->getCustomerName(); | |
$paymentBlock = Mage::helper('payment')->getInfoBlock($order->getPayment()) | |
->setIsSecureMode(true); | |
$paymentBlock->getMethod()->setStore(Mage::app()->getStore()); | |
$emailTemplateVars['payment_html'] = $paymentBlock->toHtml(); | |
//displays the rendered email template | |
echo $emailTemplate->getProcessedTemplate($emailTemplateVars); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this file into magento root folder
Replace order id and email template id with your id