{{var items_html}}
but, I can't find any reference to get/set ItemsHtml() in the code. What I find in the layout XML isn't very promising.
So, I setup a small bootstrap script to get ready to send these emails to myself and then I can get into the code and dissect what's going on.
chdir('../../../../../');
require_once 'app/Mage.php';
umask(0);
Mage::app('default');
$mailTemplate = Mage::getModel('core/email_template');
$recipient = array();
$recipient['email'] = 'me@example.com';
$recipient['name'] = 'me';
$order = Mage::getModel('sales/order')->load(4);
$mailTemplate->setDesignConfig(array('area'=>'frontend', 'store'=>0))
->sendTransactional(
'sales_email_order_template',
array('name'=>'me', 'email'=>'me@example.com'),
$recipient['email'],
$recipient['name'],
array(
'order' => $order,
'billing' => $order->getBillingAddress(),
'payment_html' => 'payment html',
)
);
It looks okay, I should be able to at least trigger the transactional emails and trace through the code with var_dump() until I can find where items_html is set or used.
There's only one problem. The $order relies on using blocks to format its own "createdat" property, and the blocks don't always work unless you have a front controller and an action. Why? ... because the output templates are tied into the request action.. ?
// from Sales/Model/Order.php
public function getCreatedAtFormated($format)
{
return Mage::getBlockSingleton('core/text')->formatDate($this->getCreatedAt(), $format);
}
//from Mage.php
public static function getBlockSingleton($type)
{
$action = Mage::app()->getFrontController()->getAction();
return $action ? $action->getLayout()->getBlockSingleton($type) : false;
}
Why, oh why, can't I just send a transactional email without having to simulate an entire request?
No comments:
Post a Comment