Page 1 of 1

Show OrderNote in order confirmation Email?

Posted: Tue Nov 11, 2008 2:59 pm
by pbhavsar
Hello,

I am wondering whether OrderNote info can be displayed in the order confirmation Email? Does anybody know which object/file is responsible for sending order confirmation emails?

Thanks.

Re: Show OrderNote in order confirmation Email?

Posted: Tue Nov 11, 2008 3:20 pm
by jmestep
You would have to see if you can add it to the Order confirmation email template which is located at Configure-->Email-->Templates. You can probably get the code from the Note added by Customer template which can be generated when there is an order note added. It would be something like this, but you would probably need to put code on it to get the first note added.
On ${note.CreatedDate}, a new message&nbsp;was added to <a href="${store.StoreUrl}Admin/Orders/OrderHistory.aspx?OrderId=$order.OrderId">Order Number $order.OrderId</a></strong></p>
<p><strong>Customer said:</strong></p>
<p>${note.Comment}</p>

Re: Show OrderNote in order confirmation Email?

Posted: Thu Nov 13, 2008 3:12 pm
by pbhavsar
jmestep wrote:You would have to see if you can add it to the Order confirmation email template which is located at Configure-->Email-->Templates. You can probably get the code from the Note added by Customer template which can be generated when there is an order note added. It would be something like this, but you would probably need to put code on it to get the first note added.
On ${note.CreatedDate}, a new message&nbsp;was added to <a href="${store.StoreUrl}Admin/Orders/OrderHistory.aspx?OrderId=$order.OrderId">Order Number $order.OrderId</a></strong></p>
<p><strong>Customer said:</strong></p>
<p>${note.Comment}</p>
Thank you for the advice.

I agree with you. However, I am having trouble locating which file I shall put my code in. Would you shine some more light on me please ? Thanks!

Re: Show OrderNote in order confirmation Email?

Posted: Thu Nov 13, 2008 6:17 pm
by jmestep
Is this note something a customer does in the checkout process and they are not using the one for the shipping message?

Re: Show OrderNote in order confirmation Email?

Posted: Fri Nov 14, 2008 7:45 am
by keats76
Something like this would probably work:

#foreach($note in $order.Notes)
$note.Comment <br/>
#end

I think the $order object is available to most nVelocity templates. Give it a shot and see if it works.

the note object is of type OrderNote if you want to look it up in the API.

Re: Show OrderNote in order confirmation Email?

Posted: Fri Nov 14, 2008 2:37 pm
by pbhavsar
What I am trying to do is to store "Delivery Date" and "Delivery Time" in the order. OrderNote may not be the desirable place to store the information. (I could not get it to work anyways ... :( ) I have decided to record the date and time in Shipment.ShipMessage. However, I still could not display the information in the "Order Confirmation Email".

My Code:
#foreach($shipment in $order.Shipments)
$shipment.ShipMessage.ToString()
#end

The data has been saved in the database, in OrderShipments.ShipMessage. But it shows an empty string in the email. Would anybody please point me out where I am doing wrong? Thank you!

Re: Show OrderNote in order confirmation Email?

Posted: Fri Nov 14, 2008 3:00 pm
by AbleMods
pbhavsar wrote:My Code:
#foreach($shipment in $order.Shipments)
$shipment_date.ShipMessage.ToString()
#end
Based on your code, I think you would want to do:

Code: Select all

$shipment.ShipMessage
There's no need for the "_date" since you've referenced it as $shipment not $shipment_date.

the ToString is unnecessary since the value is already a string.

Re: Show OrderNote in order confirmation Email?

Posted: Fri Nov 14, 2008 3:17 pm
by pbhavsar
Hi Joe Payne,

Sorry about that, it was a typo in my post. I have corrected it.

However, the problem remains.

Re: Show OrderNote in order confirmation Email?

Posted: Sat Nov 15, 2008 6:08 am
by mazhar
#foreach($note in $order.Notes)
$note.Comment <br/>
#end
First of all this code will not work and will not send any thing because Email is sent when order is placed and actually at that time there is no order note available at all. The correct way is as described by Joe. The ShipMessage is infact the delevery instruction available with shipping. In order to make it available on OnePageCheckout first set the EnableShipMessage property the OnePageCheckout by setting it to true. Then use the following code in your OrderConfirmation Email tempalte.

Code: Select all

#foreach($shipment in $order.Shipments)
$shipment.ShipMessage
#end