Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

Automatic processing of orders: Exception when sending email (template processing)
 
salsasepp
Member
 
Avatar
Total Posts:  32
Joined:  2008-03-21
Saarlouis, Germany
 

My dear fellow mages,

I would like your help, please.

I am setting up some automation in our order processing (I am generating invoices and shipments automatically). I would also like to send customer email notifications, but that crashes with some ”Zend_Controller_Response_Exception”. Here is the smallest code fragment that will reproduce the error when run as standalone script on the shop server:

// Get all orders from store and send an email with a comment to each customer.
require_once '<somewhere>/app/Mage.php';

Mage::app("default");

$orders Mage::getModel('sales/order')->getResourceCollection();
foreach (
$orders as $order)
{
    $order
->sendOrderUpdateEmail(TRUE$comment="Testing...");
}

Fatal error: Uncaught exception ‘Zend_Controller_Response_Exception’ with message ‘Cannot send headers; headers already sent in <path>\magento\app\code\core\Mage\Core\functions.php, line 191’ in <path>\magento\lib\Zend\Controller\Response\Abstract.php:281

I have traced this to line 253 in Mage/Core/Model/Email/Template.php where the email template gets processed (i.e. the “{{whatever}}” things are being replaced by their actual values):

$processedResult $processor->filter($this->getTemplateText());
Three or four macros get replaced ok, but as soon as the filter tries to replace {{store url="customer/account/"}} the error happens. This is the actual line throwing the exception (lib/Varien/Filter/Template.php:121):
$replacedValue call_user_func($callback$construction);

I am using magento-1.0 with php-5.2.5 (cli). No core code changes. I DO have two stores with my website, may that be of significance?
Any light you can shed on this will surely burn forever in my head.

Thank you,
Stefan.

 
Magento Community Magento Community
Magento Community
Magento Community
 
salsasepp
Member
 
Avatar
Total Posts:  32
Joined:  2008-03-21
Saarlouis, Germany
 

To whom it may concern (mainly myself it seems) wink

Upgrading from version 1.0 to 1.0.19700 has “magically” fixed the above problem. I can now send emails from orders, invoices, shipments without hitch. Thanks magento!

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top