Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Method Name

Signature

Returns

Example

getReturnLink

#set($myReturnLink = $cart.getReturnLink())

a bitly url useful for directing a customer back to their checkout.

#if("$!{cart}" != "") ## <-- this is a better way to check for nulls instead of #if($cart)
Please complete your order! Here's a 20% off coupon that is good for the next 48 hours!
#set($cCode = $coupon.generateCode('MY_20_OFF', '48'))
$cart.addUniqueCouponCode($cCode)
#set($returnLink = $cart.getReturnLink())
<a href="${returnLink}">Your Order</a>
#end

getReturnLink

getReturnLink(String returnUrl, String tokenParameter)

#set($myReturnLink = $cart.getReturnLink("www.myjavascriptcheckout.com/checkout.html", "returnCode")

a bitly url useful for directing a customer back to their custom checkout.#if("$!{cart}" != "") ## <-- this is a better way to check for nulls instead of #if($cart)
Please complete your order! Here's a 20% off coupon that is good for the next 48 hours!
 #set($cCode = $coupon.generateCode('MY_20_OFF', '48'))
 $cart.addUniqueCouponCode($cCode)
 #set($returnLink = $cart.getReturnLink("www.myjavascriptcheckout.com/checkout.html", "returnCode"))
<a href="${returnLink}">Your Order</a>
 #end

addUniqueCouponCode

$cart.addUniqueCouponCode($code)

true if successful, else false. If false, $cart.getErrors() will contain a list of errors.

see getReturnLink for example

setReturnUrl 
alternative way to use custom return linkif you setReturnUrl and setTokenParameterName, then the getReturnLink() with empty parameters will also return a custom link. This is mainly going to be used with External Integrations such as Lyris. If you're not using Lyris, then getReturnLink(returnUrl, tokenName) is simpler and preferred.
setTokenParameterName 
alternative way to use custom return link 

The above example uses the return link, and tacks on a coupon to the url, which will automatically apply it to the customer's cart.

...

Method Name

Signature

Returns

Example

getCampaignHistory

$customer.getCampaignHistory()

a list of the recipient's history in this campaign

#set($history = $customer.getCampaignHistory())

getCountOfPurchasesInLastDays

$customer.getCountOfPurchasesInLastDays(days),
$customer.getCountOfPurchasesInLastDays(itemId, days)

a count of purchases made

#set($numberOfPurchases = $customer.getCountOfPurchasesInLastDays('BLACK_SHIRT', 30))

getCountOfShipmentsInLastDays

$customer.getCountOfShipmentsInLastDays(days),
$customer.getCountOfShipmentsInLastDays(itemId, days)

a count of shipments made

#set($numberOfShipments = $customer.getCountOfShipmentsInLastDays('BLACK_SHIRT', 30))

getDisplayName

$customer.getDisplayName()

the name of the recipient, or if that wasn't collected, their email address

Welcome $customer.getDisplayName(), here's a coupon...

getDisplayFirstName$customer.getDisplayFirstName()the first name of the recipient, or if that wasn't collect an empty stringWelcome $customer.getDisplayFirstName(), here's a coupon...
getDisplayLastName$customer.getDisplayLastName()the last name of the recipient, or if that wasn't collect an empty string 

getEmail

$customer.getEmail()

them email address of the recipient

This email was address to: $customer.getEmail()... blah blah blah

getEnrollmentDts#set($timestamp = $customer.getEnrollmentDts())this returns back a Java Timestamp object. 
getEnrollmentOrder #set($enrollmentOrder = $customer.getEnrollmentOrder()returns the order that triggered enrollment. If enrollment was not based on a purchase, this will be a null value.  
getEnrollmentOrderId#set($orderId = $customer.getEnrollmentOrderId())  

getEnrollmentSource#set($source = $customer.getEnrollmentSource())

returns a string showing what the enrollment source is. Possible values:

Abandon Cart
Auto Order - Decline
Goto Step
Mail List
Manual
Purchased Product
Return Email

 

getLastOrder

$customer.getLastOrder()

Retrieves the last order the customer made. You may wish to check if they've ordered anything first (hasPurchasedEver, etc)

#set($lastOrder = $customer.getLastOrder())

getOrderId #set($orderId = $customer.getOrderId())returns the order id that triggered enrollment.  If enrollment was not based on a purchase, this will be a null value. 

getOrders

$customergetOrders()

Retrieves a list of orders for the customer.

#if($customer.getOrders().size() > 5)
Wow, you're a great customer!
#end

getRecurringInformation

#set($recurringInfo = $customer.getRecurringInfomation())

returns the customer's meta information related to the recurring order (also known as 'auto order' or trial order). Always call isRecurring first to ensure you're dealing with a trial order. If there is no recurring information, this method returns null. Be sure to check for a null value before using the object. This method returns a RecurringInformation object.

#if($customer.isRecurring())
#set($recurringInfo = $customer.getRecurringInfomation())
#end

getTotalForAllOrders

$customer.getTotalForAllOrders()

Total dollars the customer has ever spent. Useful to check for spending thresholds

This returns a BigDecimal object.

Tip
Note! the total is a BigDecimal object. use longValue() to get a primative number.

#if($customer.getTotalForAllOrders().longValue() > 1000)
You've spent over $1000! Here's a coupon!
#end

getTotalForAllPurchasesInLastDays

$customer.getTotalForAllPurchasesInLastDays(days)

Same as above, but filters on purchases within the last XX days.

This returns a BigDecimal object.

#if($customer.getTotalForAllPurchasesInLastDays(60) > 1000)
You've spent over $1000 in the last 2 months! Here's a coupon!
#end

getTotalForAllShipmentsInLastDays

$customer.getTotalForAllShipmentsInLastDays(days)

Same as above, but filters on shipments within the last XX days.

This returns a BigDecimal object.

#if($customer.getTotalForAllShipmentsInLastDays(60) > 1000)
We've shipped you over $1000 in the last 60 days! Here's a coupon!
#end

hasPricingTier$customer.hasPricingTier("Wholesale")returns true if the customer has an established customer profile in the UltraCart system and has the specified pricing tier.

## do not send a coupon to any customers who are wholesale dealers of ours

## if they are members of the Wholesale pricing tier, exit them from the campaign.

#if($customer.hasPricingTier("Wholesale"))

#set($result = '_ENDCAMPAIGN_')

#end

hasPurchasedEver

$customer.hasPurchasedEver(itemId)

return true if the customer has ever purchased the item.

#if($customer.hasEverPurchased('BLACK_SHIRT'))
Congratulations, you are eligible for the Green Shirt!
#end

hasPurchasedEver

$customer.hasPurchasedEver([itemId1, itemId2, itemId3])

Same as above, but with a list.

#if($customer.hasEverPurchased(['BLACK_SHIRT','BLUE_SHIRT','GREEN_SHIRT']))
Wow, you've bought at least one of our really great shirts!
#end

hasPurchasedInLastDays

$customer.hasPurchasedInLastDays(itemId, days)

Same as above, but with a days argument.

#if($customer.hasPurchasedInLastDays('BLACK_SHIRT', 90))
Congratulations, you are bought a black shirt within the last 3 months (90 days). Go for the Green Shirt with this coupon!
#end

hasPurchasedInLastDays

hasPurchasedInLastDays[itemId1, itemId2, itemId3], days)

Same as above, but with a days argument.

#if($customer.hasPurchasedInLastDays(['BLACK_SHIRT','BLUE_SHIRT','GREEN_SHIRT'], 90))
Congratulations, you are bought at least one of three shirts within the last 3 months (90 days). Here's a special coupon!
#end

hasReviewedItem

hasReviewedItem(itemId1)

returns true if the customer has already completed a review for the specified item.

#if($customer.hasReviewedItem('BLACK_SHIRT')

exit the 'please review this item campaign.

#else

send the customer to an step sending them a reminder email

#end

hasShipmentInLastDays

$customer.hasShipmentInLastDays(days)

see similar 'purchased' method. Some merchants prefer shipment dates over purchase dates.

#if($customer.hasShipmentInLastDays('BLACK_SHIRT', 90))
Congratulations, you are bought a black shirt within the last 3 months (90 days). Go for the Green Shirt with this coupon!
#end

hasShipmentInLastDays

$customer.hasShipmentInLastDays(itemId, days)

see similar 'purchased' method. Some merchants prefer shipment dates over purchase dates.

#if($customer.hasShipmentInLastDays(90))
Congratulations, you made a purchase within the last 3 months (90 days). Thanks!
#end

hasShipmentInLastDays

$customer.hasShipmentInLastDays([itemId1, itemId2, itemId3], days)

see similar 'purchased' method. Some merchants prefer shipment dates over purchase dates.

#if($customer.hasShipmentInLastDays(['BLACK_SHIRT','BLUE_SHIRT','GREEN_SHIRT'], 90))
Congratulations, you are bought at least one of three shirts within the last 3 months (90 days). Here's a special coupon!
#end

isRecurring

$customer.isRecurring()

returns true if the customer's underlying order was a recurring order (also known as 'auto order' or trial order). If this is true, then you may call getRecurringInformation for additional information

#if($customer.isRecurring())
#set($recurringInfo = $customer.getRecurringInfomation())
#end

lastOrderContains

$customer.lastOrderContains(itemId)

checks to see if the last order contained a specific item.

#if($customer.lastOrderContains('BLACK_SHIRT'))
Thanks for buying our best selling item!
#end

lastOrderContains

$customer.lastOrderContains([itemId1, itemId2, itemId3])

checks to see if the last order contains one of the items in the list

#if($customer.lastOrderContains(['BLACK_SHIRT','BLUE_SHIRT','GREEN_SHIRT']))
Congratulations, you are bought at least one of three shirts in your last order. Here's a special coupon!
#end

...