Difference between revisions of "Customizing Email Templates"

From AbleCommerce Wiki
Jump to: navigation, search
Line 10: Line 10:
 
<code>
 
<code>
 
<pre>
 
<pre>
Object         Type                     Available To
+
Object           Type                     Available To
 
----------------------------------------------------------------------------------------------------
 
----------------------------------------------------------------------------------------------------
  
store         CommerceBuilder.Stores.Store    All Events
+
store             CommerceBuilder.Stores.Store    All Events
  
order         CommerceBuilder.Orders.Order    OrderStatusUpdated, PaymentAuthorized,
+
order             CommerceBuilder.Orders.Order    OrderStatusUpdated, PaymentAuthorized,
                                                PaymentCaptured, PaymentCapturedPartial,
+
                                                  PaymentCaptured, PaymentCapturedPartial,
                                                PaymentAuthorizationFailed,
+
                                                  PaymentAuthorizationFailed,
                                                PaymentCaptureFailed, OrderPlaced, OrderCancelled,
+
                                                  PaymentCaptureFailed, OrderPlaced, OrderCancelled,
                                                OrderPaidPartial, OrderPaid, OrderPaidNoShipments,
+
                                                  OrderPaidPartial, OrderPaid, OrderPaidNoShipments,
                                                OrderPaidCreditBalance, ShipmentShipped,  
+
                                                  OrderPaidCreditBalance, ShipmentShipped,  
                                                OrderShipped, OrderShippedPartial,   
+
                                                  OrderShipped, OrderShippedPartial,   
                                                GiftCertificateValidated, OrderNoteAddedByCustomer
+
                                                  GiftCertificateValidated, OrderNoteAddedByCustomer
  
customer       CommerceBuilder.Users.User      OrderStatusUpdated, PaymentAuthorized,
+
customer         CommerceBuilder.Users.User      OrderStatusUpdated, PaymentAuthorized,
                                                PaymentCaptured, CustomerPasswordRequest,   
+
                                                  PaymentCaptured, CustomerPasswordRequest,   
                                                PaymentCapturedPartial, PaymentAuthorizationFailed,
+
                                                  PaymentCapturedPartial,  
                                                PaymentCaptureFailed, OrderPlaced, OrderCancelled,
+
                                                  PaymentAuthorizationFailed,
                                                OrderPaidPartial, OrderPaid, OrderPaidNoShipments,
+
                                                  PaymentCaptureFailed, OrderPlaced, OrderCancelled,
                                                OrderPaidCreditBalance, ShipmentShipped,OrderShipped,
+
                                                  OrderPaidPartial, OrderPaid, OrderPaidNoShipments,
                                                OrderShippedPartial, GiftCertificateValidated,
+
                                                  OrderPaidCreditBalance, ShipmentShipped,  
                                                OrderNoteAddedByCustomer
+
                                                  OrderShipped,OrderShippedPartial,  
 +
                                                  GiftCertificateValidated, OrderNoteAddedByCustomer
  
oldstatusname System.String                    OrderStatusUpdated
+
oldstatusname     System.String                    OrderStatusUpdated
  
products       CommerceBuilder.Products.Product LowInventoryItemPurchased
+
products         CommerceBuilder.Products.Product LowInventoryItemPurchased
 +
 
 +
payment          CommerceBuilder.Payments.Payment PaymentAuthorized, PaymentCaptured,
 +
                                                  PaymentCapturedPartial,
 +
                                                  PaymentAuthorizationFailed,
 +
                                                  PaymentCaptureFailed
 +
resetPasswordLink System.String                    CustomerPasswordRequest
 +
 
 +
shipment          CommerceBuilder.Shipping.        ShipmentShipped
 +
                  OrderShipment
 +
 
 +
giftcertificate  CommerceBuilder.Payments.        GiftCertificateValidated
 +
                  GiftCertificate
 +
 
 +
note              CommerceBuilder.Orders.OrderNote OrderNoteAddedByCustomer
  
payment        CommerceBuilder.Payments.Payment PaymentAuthorized, PaymentCaptured,
 
                                                PaymentCapturedPartial, PaymentAuthorizationFailed,
 
                                                PaymentCaptureFailed,
 
 
</pre>
 
</pre>
 
</code>
 
</code>

Revision as of 04:53, 2 September 2008

Merchants can fully customize the customer notification email. It can include plain text, static HTML, and even dynamic information with the help of the full fledged template engine.

NVelocity is used as the template engine to process the email templates. Templates are written in velocity template language (VTL), which is extremely simple and powerful.

In a velocity template, certain objects put in the velocity context, can be accessed directly in a straight forward manner. For example if a ‘Store’ object, named “store” is available in the context, then using $store.Name we will get the name of the store. Similarly any method available in the ‘Store’ object can be called directly.

While writing templates for email messages in AbleCommerce, certain objects are automatically made available to the context, depending on the type of event.

The following table illustrates the objects and their availability for different events.

Object            Type              	         Available To
----------------------------------------------------------------------------------------------------

store             CommerceBuilder.Stores.Store     All Events

order             CommerceBuilder.Orders.Order     OrderStatusUpdated, PaymentAuthorized,
                                                   PaymentCaptured, PaymentCapturedPartial,
                                                   PaymentAuthorizationFailed,
                                                   PaymentCaptureFailed, OrderPlaced, OrderCancelled,
                                                   OrderPaidPartial, OrderPaid, OrderPaidNoShipments,
                                                   OrderPaidCreditBalance, ShipmentShipped, 
                                                   OrderShipped, OrderShippedPartial,  
                                                   GiftCertificateValidated, OrderNoteAddedByCustomer

customer          CommerceBuilder.Users.User       OrderStatusUpdated, PaymentAuthorized,
                                                   PaymentCaptured, CustomerPasswordRequest,  
                                                   PaymentCapturedPartial, 
                                                   PaymentAuthorizationFailed,
                                                   PaymentCaptureFailed, OrderPlaced, OrderCancelled,
                                                   OrderPaidPartial, OrderPaid, OrderPaidNoShipments,
                                                   OrderPaidCreditBalance, ShipmentShipped, 
                                                   OrderShipped,OrderShippedPartial, 
                                                   GiftCertificateValidated, OrderNoteAddedByCustomer

oldstatusname     System.String                    OrderStatusUpdated

products          CommerceBuilder.Products.Product LowInventoryItemPurchased

payment           CommerceBuilder.Payments.Payment PaymentAuthorized, PaymentCaptured,
                                                   PaymentCapturedPartial, 
                                                   PaymentAuthorizationFailed,
                                                   PaymentCaptureFailed
resetPasswordLink System.String                    CustomerPasswordRequest

shipment          CommerceBuilder.Shipping.        ShipmentShipped
                  OrderShipment

giftcertificate   CommerceBuilder.Payments.        GiftCertificateValidated 
                  GiftCertificate

note              CommerceBuilder.Orders.OrderNote OrderNoteAddedByCustomer