Admin Panel > System > Transactional Emails

Last modified by CannyCookie on Tue, August 3, 2010 13:11
Source|Old Revisions  

This is an old revision of the document!


The System > Transactional Emails option allows you to create or customize your own email templates without editing the templates directly in the file system. Magento ships with a large number of standard templates. Any of these can be loaded into the Transactional Emails editor on this page and copied. You can then alter their layout and content to match your store, you can also include special variables in them to insert customer names, order details etc.

Once an email template is created, you also need to associate the templates with whichever events should trigger it. This association is made in System > Configuration.

Email Templates

When setting up a store you will need to either copy all the existing ones into new transactional emails, alter them to match your store then associate them with email events or edit the templates in your Magento installation files.

There are approximately 35 default email templates that need to be updated. Unfortunately you really do need to update them as these default emails are filled with ‘Demo Store’ comments and other phrases that you will not want on your live store.

You can find suggestions on the various ways to manage this process in the this forum thread

Email Variables

Following is a compiled list of variables you can use in e-mail templates. NOT VERIFIED; TEST FIRST!

Please add or edit as necessary.

- For registration:

{{var customer}} Will print out all customer information

{{var customer.ID}}

{{var customer.email}}

{{var customer.firstname}}

{{var customer.lastname}}

{{var customer.name}}

{{var customer.password}}

{{var customer.created_in}} Store Name

{{var customer.dob}} Date of Birth

{{var customer.password_hash}}

{{var customer.prefix}}

{{var customer.middlename}} Initial

{{var customer.suffix}}

{{var customer.group_id}}

{{var customer.taxvat}}

{{var customer.store.name}} What store they registered with (On Demo store this will display as ‘English’

{{var customer.store.group.name}} The actual Store’s name (not the Store View’s)

- To subscribe/unsubscribe newsletter:

{{var subscriber.getConfirmationLink()}}

{{var subscriber.getUnsubscriptionLink()}}

{{var subscriber.email}}

- Send to a friend:

{{var product_image}}

{{var name}} Recipient’s Name

{{var email}} Recipient’s Email

{{var product_name}} Product Name

{{var product_url}} Product Url

{{var message}} Message Text

{{var sender_name}} Sender’s Name

{{var sender_email}} Sender’s Email

{{var product_image}} Product Image

- Block

{{block type='core/template' area='frontend' template='email/order/shipment/track.phtml' shipment=$shipment order=$order}}

- Depend Condition

{{depend order.getIsNotVirtual()}}

{{depend salable}}

- If Condition

{{if order.getStoreId() == 2}}

{{else}}

{{/if}}

(else is optional)

- Layout

Layout “handles” contain small code blocks for reuse. Handles are stored in a different location than regular templates. This location is found in the layout configuration file for the specific module you are working on. For example, the “sales_email_order_invoice_items” handle would be found in the sales.xml configuration file found in:

/app/design/frontend/default/layout/sales.xml

You will find the element:

  <sales_email_order_items>
      <block type="sales/order_email_items" name="items" template="email/order/items.phtml">
          <action method="addItemRender"><type>default</type><block>sales/order_email_items_order_default</block><template>email/order/items/order/default.phtml</template></action>
          <action method="addItemRender"><type>grouped</type><block>sales/order_email_items_order_grouped</block><template>email/order/items/order/default.phtml</template></action>
      </block>
  </sales_email_order_items>

From there we can find where the template is being pulled from, and how it is being constructed. In this case:

/app/design/frontend/default/{your_theme}/template/email/order/items.phtml

is the parent template with the default template being used:

/app/design/frontend/default/{your_theme}/template/email/order/items/order/default.phtml

{{layout area="frontend" handle="sales_email_order_invoice_items" invoice=$invoice order=$order}}

{{layout handle="sales_email_order_items" order=$order}}

{{layout handle="sales_email_order_creditmemo_items" creditmemo=$creditmemo order=$order}}

{{layout handle="sales_email_order_shipment_items" shipment=$shipment order=$order}}

- Skin

{{skin url="'}}

- Store

{{store url=""}}

- Other

{{var addAllLink}}

{{var alertGrid}}

{{var billingAddress.format('html')}}

{{var checkoutType}}

{{var comment}}

{{var creditmemo.id}}

{{var creditmemo.increment_id}}

{{var data.comment}}

{{var data.email}}

{{var data.name}}

{{var data.telephone}}

{{var dateAndTime}}

{{var invoice.id}}

{{var invoice.increment_id}}

{{var items}}

{{var items_html}}

{{var message}}

{{var name}}

{{var order.customer_email}}

{{var order.getBillingAddress().format('html')}}

{{var order.getBillingAddress().getName()}}

{{var order.getCreatedAtFormated('long')}}

{{var order.getCustomerName()}}

{{var order.getCustomerFirstname()}}

{{var order.getCustomerLastName()}}

{{var order.getEmailCustomerNote()}} Currently unknwon how to test this variable for being set/empty

{{var order.getShippingAddress().format('html')}}

{{var order.getShippingDescription()}}

{{var order.getStatusLabel()}}

{{var order.getStoreGroupName()}}

{{var order.id}}

{{var order.increment_id}}

{{var password}}

{{var payment_html}}

{{var paymentMethod}}

{{var product_name}}

{{var product_url}}

{{var reason}} Reason for payment failure

{{var shipment.increment_id}}

{{var shippingAddress.format('html')}}

{{var shippingMethod}}

{{var total}}

{{var user.name}}

{{var viewOnSiteLink}}

{{var warnings}}

{{var billing.name}} Uses the fullname from billing information (to prevent e-mail being sent to ‘Dear Guest, etc’.




 

Magento 2 GitHub Repository

Magento Job Board - Some sort of tag line goes here

Latest Posts| View all Jobs