Magento – Variables for transaction emails

Once again came the question of different variables in Magento transactional email, Here is a brief overview, I made the Magento Wiki have taken.

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

{{was SENDER_NAME}} Sender's Name

{{was SENDER_EMAIL}} Sender's e-mail

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

– Other

{{var addAllLink}}

{{var alertGrid}}

{{was billingAddress.format(‘html’)}}

{{var checkoutType}}

{{var how}}

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

{{was order.getBillingAddress().format(‘html’)}}

{{was 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()}}

{{was 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 view site link}}

{{var warnings}}

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

Published by Covos

Since 2009 I have been working intensively with Magento. I started with the creation and operation of B2C stores. This was extended through my work in the logistics sector. This resulted first specialized B2E systems. Today I work day-a day with exciting B2C, B2B- and B2E projects and reports in this blog about challenges and give insider tips.

18 comments on “Magento – Variables for transaction emails”

  1. Hallo,
    very good list – I've noticed the same times as a bookmark.
    I have just the problem with a multi-store in connection with the transaction e-mails. It is somehow always uses the default image and not from the skin of the store – You know it maybe. a solution (except that you create for each store own transaction e-mails must).

    Greeting
    Christian

    1. Hi!

      If the “Standardbild” The logo of the respective shops meant? If so, can this> in System> Configuration> Sales Invoice- design and delivery can be adjusted. There is the “Logo for HTML Print (including e-mail templates)”

      VG!

      1. Hallo,
        is the standard image for the template “New Order” used and grown according to the Store View? According to my tests: no!

        Please note this is a, what is possibly because. must change.

        1. As far as I've tried so far: Ja. Otherwise, visit (Today I had the case), that mglw. Link to the standard picture is not correct. For me, this e.g..

          <td valign="top"></td>

          Here, then made reference to logo_email.gif This must therefore be properly.

  2. Hi, I searched for quite a while and hope for a hint here: We would like the custom comments in the transactional email (Order / Order guest) make visible. Have already {{var how}} and {{was order.comment}} tries, but it does not. Does anyone have any idea? Magneto 1.7 (Onepage checkout IWD)

      1. Thanks for the reply, The developers have not yet reported, probably, because the extension is provided free of charge. The comment field is indeed from the Magento, so I thought we could achieve something with variables… We further test…

  3. Do anyone know how can i show a product image in the “Send a friend” template?

    So if i need {{var product_image}} it shows only the link to the product.

    Thank you,

    Jan

  4. Hallo,

    I'll while some year late, but this issue is still relevant for me 🙂

    What is the e-mail notification for the Variable ANREDE ? I want to display them in the email, but unfortunately I find this out of nowhere 🙁

      1. Hallo,

        sorry, had expressed myself wrong. I ask from the sex and then use this as a form of address. So 🙂 How do I get the GENDER in the email ?

        Thank 😉

  5. How do I install the client's e-mail address in the order confirmation email? I did it with already {{var order.getcustomer.email()}} tried, Unfortunately does not work.

    About an answer I would be very happy!

    VG

  6. Hallo,
    I have to take up the issue also again. I've been trying to get a whole lot the tax and shipping charges to the order confirmation and invoice. Unfortunately that does not work.

    Would be very nice, if you could help.

    Thanks in advance

    1. Moin!
      When it comes to e-mails, this should not be a variable from above, but over a Magento-block, of about {{layout handle=”sales_email_order_items” order=$order}} loading. This is back (partly) in connection with the sales.xml of your own templates (appdesignfrontendEigenes ThemeThemelayout). Furthermore, here also play the totals and items (app\design\frontend\Eigenes Theme\Theme\template\email\order\) an important role.
      yesterday we had a case where an extension of a few o.g. Files has overwritten and therefore suddenly Totals block from the mail was gone.
      Hopefully this helps a little?!
      VG

      1. Hallo,
        many thanks for the answer. The files I had a look yesterday and compared with an old backup, wherein the updates i.O. are. The files have the same content, as in the backup. Is there another place, where are generated mails?

  7. In general, it also runs here along the lines of:

    Base> Default> Theme or.
    Base> Theme or.
    Theme (although this would be unusual).

    In the e-generation is in 99% of cases, therefore, first in their own / Theme looked used for the required files. Is there anything, it goes one step further down etc.
    So I would try this:
    1. Das Template des Shops, which is used for the emails, trial basis on “base” adjust.
    2. Clear cache
    3. Send e-mail
    4. Thus, one can exclude, that it is on own Theme. Is there the error still, the problem is already in the base-level.
    5. Now you can watch, whether it possibly. is an extension, has any influence (partly it is sufficient not only the extension to disable – we found just)
    6. Otherwise you have to try the original template files – evtl. copy as a separate test theme on the server (“base2” z.B.)

Leave a Reply

Your email address will not be published. Required fields are marked *