Is it possible to edit transactional e-mail template so that some data will be included in an admin copy only? If not just by simple in-file expression, how can I achieve that? I want to insert an own-created layout handle in the message to admin.
- Adminarea / System / Transactional emails ?zhartaunik– zhartaunik2015-07-30 13:31:18 +00:00Commented Jul 30, 2015 at 13:31
- Ok, but I asked if there is a solution to include something only in copy of the email sent to adminmisiu9091909– misiu90919092015-07-30 13:50:42 +00:00Commented Jul 30, 2015 at 13:50
2 Answers
Magento has two methods in sending copies to a specified email address in the backend: Bcc and Copy.
With Bcc there is definitely no way to have separate email content since the email is sent to both recipients in one email.
With the copy method a separate email is sent. However there is no way to specify a different template. Thus you have to modify/override Magento either to change that you can have multiple templates or add some variable to be used in the email.
The switch is implemented here: loveknitting/public/app/code/core/Mage/Sales/Model/Order.php:1321
You cannot do that in the template alone. You need to find where the email is being dispatched, then you can add your own custom text/html as a variable. See:
Mage_Core_Model_Email_Template::send($email, $name = null, array $variables = array()) For example, you can define your own variable admin_text based on an arbitrary isAdmin() check:
Mage::getModel('core/email_template') ->loadDefault('some_email_template') ->send( '[email protected]', 'John Doe', array( 'admin_text' => $this->isAdmin() ? 'Admin only text' : '' ) ); Then in the some_email_template email template, add your variable with {{var admin_text}}