Email Variables for Magento

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}}

{{depend salable}}

{{/depend}}

- If Condition

{{if order.getIsNotVirtual()}}

{{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=""}}

name

- New order : Shipping Address

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

Items of the shipping address :

{{var order.getShippingAddress().getName()}} Get the first and last name

{{var order.getShippingAddress().getPrefix()}}

{{var order.getShippingAddress().getFirstName()}}

{{var order.getShippingAddress().getMiddleName()}}

{{var order.getShippingAddress().getLastName()}}

{{var order.getShippingAddress().getSuffix()}}

{{var order.getShippingAddress().getStreet1()}}

{{var order.getShippingAddress().getStreet2()}}

{{var order.getShippingAddress().getCity()}}

{{var order.getShippingAddress().getRegion()}}

{{var order.getShippingAddress().getPostcode()}}

{{var order.getShippingAddress().getCountry()}} Get the country’s ID

{{var order.getShippingAddress().getCountryModel().getName()}} Get the country’s full name

{{var order.getShippingAddress().getRegion()}}

{{var order.getShippingAddress().getTelephone()}}

- 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 invoice.created_at}}

{{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.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’.

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}}

{{depend salable}}

{{/depend}}

- If Condition

{{if order.getIsNotVirtual()}}

{{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=""}}

name

- New order : Shipping Address

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

Items of the shipping address :

{{var order.getShippingAddress().getName()}} Get the first and last name

{{var order.getShippingAddress().getPrefix()}}

{{var order.getShippingAddress().getFirstName()}}

{{var order.getShippingAddress().getMiddleName()}}

{{var order.getShippingAddress().getLastName()}}

{{var order.getShippingAddress().getSuffix()}}

{{var order.getShippingAddress().getStreet1()}}

{{var order.getShippingAddress().getStreet2()}}

{{var order.getShippingAddress().getCity()}}

{{var order.getShippingAddress().getRegion()}}

{{var order.getShippingAddress().getPostcode()}}

{{var order.getShippingAddress().getCountry()}} Get the country’s ID

{{var order.getShippingAddress().getCountryModel().getName()}} Get the country’s full name

{{var order.getShippingAddress().getRegion()}}

{{var order.getShippingAddress().getTelephone()}}

- 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 invoice.created_at}}

{{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.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’.

Site Search

Contact Us

 
 
 
Parent Technology Inc.
1535 Rosalind Rd Se
East Grand Rapids, MI 49506, USA
 
 

This email address is being protected from spambots. You need JavaScript enabled to view it.