Versions Compared

Key

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

Requirement

...

Implementation

Email Template

Give the template a name, subject, and format.

Create the html.  An example below is provided with heavy comments.

...

Code Block
true
themeDJango
languagehtml/xml
linenumberscollapsetrue
#* @vtlvariable name="formatHelper" type="com.bpsinfo.ultracart.catalog.tobjects.FormatHelper" *#
#* @vtlvariable name="group" type="com.bpsinfo.ultracart.catalog.tobjects.GroupImpl" *#
#* @vtlvariable name="customer" type="com.bpsinfo.ultracart.autoresponder.tobjects.Customer" *#
## You may ignore the comments above.  They're editor hints for Intellij, an amazing editor
 

<!DOCTYPE html>
<html>
<body>
Hey. Please take a minute and review each item in your recent purchase. Thanks!
<table>
 

## the enrollment order had better exist if this email is being called in a campaign.
  #set($order = $customer.getEnrollmentOrder())
  #foreach($orderItem in $order.items)
  ## notice that orderItem and item are different.  orderItem contains a skeleton item and order-specific information
  ## item retrieved from the $group object has the full array of item information, like the view url, etc.
  ## $group is a provided variable.  It's named 'group' because it's also used in the store catalogs for group pages (pages that display a group of items)
    #set($item = $group.getItem($orderItem.getItemId()))
    #set($reviewed = $customer.hasReviewedItem($item.getMerchantItemID()))
    <tr>
      <td>
        <a target="_blank" href="$item.getViewURL()">$item.getDescription()</a>
      </td>
      <td>

        #if($reviewed)
          Reviewed. Thank you!
        #else
          ## the url below is secure.ultracart.com.  just leave it like that.  The url will do a redirect if you're using a custom SSL.
          ## This should be the starting pointing for review links.
          <a target="_blank"
             href="https://secure.ultracart.com/cgi-bin/UCReviewItem?merchantId=${customer.getMerchantId()}&itemId=${orderItem.getItemId()}">Write
            Review</a>
        #end ##if-reviewed

      </td>
    </tr>
  #end ##foreach-item in order
 

</table>
*|OPT_OUT|*
</body>
</html>

...