Order Notes in email template

For general questions and discussions specific to the AbleCommerce GOLD ASP.Net shopping cart software.
Post Reply
fiddycent
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 45
Joined: Tue Sep 03, 2013 12:30 pm

Order Notes in email template

Post by fiddycent » Wed Jul 27, 2016 10:56 am

Customer can add Order Notes on the Checkout Page. Is it possible to add these notes to the Order Confirmation email? If so, what would I need to add to the template?

User avatar
mazhar
Master Yoda
Master Yoda
Posts: 5084
Joined: Wed Jul 09, 2008 8:21 am
Contact:

Re: Order Notes in email template

Post by mazhar » Wed Jul 27, 2016 11:12 pm

You can try following code and place it just above the </body> tag of your Customer Order Notification Email template contents.

Code: Select all

#foreach ($note in $order.Notes)
    #beforeall
    <table class="Email">
        <tr>
            <th class="Email">Order Notes</th>
        </tr>
    </table>
    <table class="Email">
        <tr>
            <td style="background:#cccccc; color:#00000; text-align: center;"><strong>Author</strong></td>
            <td style="background:#cccccc; color:#00000; text-align: center;"><strong>Note</strong></td>
        </tr>
        #each
        #if(!($note.IsSystem || $note.IsPrivate))
        <tr class="Email">
            <td class="Email" style="text-align: left;">
                $note.User.UserName
            </td>
            <td class="Email" style="text-align: left;">
                $note.Comment
            </td>
        </tr>
        #end
        #afterall
    </table>
    #end
This will print all the public notes from that order at the very end of Email.

fiddycent
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 45
Joined: Tue Sep 03, 2013 12:30 pm

Re: Order Notes in email template

Post by fiddycent » Thu Jul 28, 2016 9:07 am

Thanks! One more quick question - the header is showing up even if I don't have any Notes. I tried wrapping the following around your code but it doesn't seem to work. What did I do wrong?

Code: Select all

#if ($order.Notes.Count > 0)

     your code

#end

fiddycent
Lieutenant, Jr. Grade (LT JG)
Lieutenant, Jr. Grade (LT JG)
Posts: 45
Joined: Tue Sep 03, 2013 12:30 pm

Re: Order Notes in email template

Post by fiddycent » Thu Jul 28, 2016 9:40 am

I guess I need to check to see if the Count of Public notes is greater than 0, nevermind

Post Reply