• TBird92
  • NEWBIE
  • 0 Points
  • Member since 2010

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
I'm merging in product line items into a visualforce template and I'd like the products to sort the same way they are in the Opportunity. Does anyone know how to do this? Here is my code..

Thanks, Chris
Code:
<messaging:emailTemplate subject="Product Quote" recipientType="Contact" relatedToType="Opportunity">
<messaging:htmlEmailBody >       
<html>
        <body>
         <STYLE type="text/css">
               Body {font-size: 11px; font-face: verdana } 
               TH {font-size: 11px; font-face: arial;background: #CCCCCC; border-width: 1;  text-align: center } 
               TD  {font-size: 11px; font-face: verdana } 
               TABLE {border: solid #CCCCCC; border-width: 1}
               TR {border: solid #CCCCCC; border-width: 1}
         </STYLE>
             <font face="arial" size="2">
 <p>Dear {!recipient.name},</p>
         <table border="0" >
                 <tr > 
                     <th>Product Name</th><th>Quantity</th><th>Total Price</th><th>Monthly Fee</th>
                  </tr>
  <apex:repeat var="oli" value="{!relatedTo.OpportunityLineItems}">
       <tr>
           <td>{!oli.PricebookEntry.Product2.Name}</td>
           <td>{!oli.Quantity}</td>
           <td>${!oli.TotalPrice}</td>
           <td>${!oli.Extended_Monthly_Fee__c}</td>
       </tr>
 </apex:repeat> 


    </table>
    <p>
<apex:repeat var="opp" value="{!relatedTo}">
<p>
Total Subscription fees: ${!opp.X1St_Yr_ACV_Subscript__c}<br>
Total Services fees: ${!opp.Professional_Services__c}<br>
</p>
 </apex:repeat>     
    
    <p>
        Please contact me with any questions,
<apex:repeat var="o" value="{!relatedTo.Owner}">
<p>
{!o.Name}<br>
{!o.CompanyName}<br>
{!o.Phone}<br>
<a href="mailto:{!o.Email}">{!o.Email}</a><br>
</p>
 </apex:repeat> 
       <p />
 </font>
        </body>
    </html>


</messaging:htmlEmailBody>       
</messaging:emailTemplate>