Use the following code to get a mail templates content by its id:
|
1 2 3 |
$mailTemplate = Mage::getModel('core/email_template'); $template = $mailTemplate->load($templateId); $text = $template->getData('template_text'); |
Use the following code to get a mail templates content by its id:
|
1 2 3 |
$mailTemplate = Mage::getModel('core/email_template'); $template = $mailTemplate->load($templateId); $text = $template->getData('template_text'); |
If you want to show the Magento messages (success, error, …) in your template file, add the following code the top of your template:
|
1 |
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?> |
To add and run a Magento cron job in your module, add the following XML to your modules config.xml:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
<config> <crontab> <jobs> <some_unique_job_code> <schedule> <!-- every minute for example --> <cron_expr>*/1 * * * *</cron_expr> </schedule> <run> <model>module/observer::functionToRun</model> </run> </some_unique_job_code> </jobs> </crontab> </config> |
Thats the first step. Once that was done, you have to manually or automatically run cron.php. Its in your stores…
To change the content of a Magento mail template by its id, use the following code:
|
1 2 3 4 |
$mailTemplate = Mage::getModel('core/email_template'); $feedbackTemplate = $mailTemplate->load($templateId); $feedbackTemplate->setData('template_text', 'new text goes here'); $feedbackTemplate->save(); |