'Text Only' Email Confirmations

(please note that this mod has been developed by myself and the cs-cart helpdesk team to a specific tailored setup, it might not suit exactly what you need but can be altered. please ensure you backup files prior to use)



Right, the standard setup of cs-cart means that when a customer purchases from your shop, they get an invoice style email. They also get this invoice for each time you change status and request a copy sent to the customer. Most i’ve spoken to have found that sending duplicate invoices, or invoices at all is not common practise with shopping carts, and instead would prefer just simple ‘text based’ email notifications, with the original invoice being used by the seller only to supply printed with the order etc.



What I’ve done is setup so that the original invoice is still the same from the admin, or if the customer wishes to print from the order confirmation page, but the physical emails the customer and seller receive are ‘text based’ and much easier to grab information from.



For this I’ve created custom templates for status codes O (open), P (processed/processing) and C (completed). The rest aren’t used by me and will return the default setup.



How to setup?



Replace this code within file ‘skins/(skin)/mail/orders/order_notification.tpl’


{* $Id: order_notification.tpl 2069 2006-08-18 14:32:53Z zeke $ *}

{include file="letter_header.tpl"}

{$lang.dear} {$order_info.firstname},



{$order_status.email_header}



{$lang.invoice}:


{include file="orders/invoice.tpl"}

{include file="letter_footer.tpl"}




with this:


{* $Id: order_notification.tpl 2069 2006-08-18 14:32:53Z zeke $ *}

{include file="letter_header.tpl"}
{if $order_info.status == 'P'}
{include file="orders/processing.tpl"}
{elseif $order_info.status == 'C'}
{include file="orders/completed.tpl"}
{elseif $order_info.status == 'O'}
{include file="orders/open.tpl"}
{else}
{$lang.dear} {$order_info.firstname},
{$order_status.email_header}
{$lang.invoice}:
{include file="orders/invoice.tpl"}
{include file="letter_footer.tpl"}
{/if}




We are going to leave the ‘skins/(skin)/mail/orders/invoice.tpl’ file alone, but instead create new tpl files called ‘open.tpl’, ‘processing.tpl’ and ‘completed.tpl’, including code similar to this (note the top section can be tailored to suit what you want to say for specific codes):




Dear {$order_info.firstname} {$order_info.lastname}



Thank you for shopping at {$settings.Company.company_name}. Your order has been received and will be processed shortly.



You will receive a confirmation email when your order has been despatched.



----------------------------------------------------------------------------------------------

ORDER DETAILS



Order Number: {$order_info.order_id}

Date: {$order_info.timestamp|date_format:"`$settings.Appearance.date_format`, `$settings.Appearance.time_format`"}

Status: {include file="orders/order_status.tpl" status=$order_info.status display="view"}

Delivery Method: {$order_info.shipping}



{foreach from=$order_info.items item="oi"}
{$oi.amount} x {$oi.product} ({$oi.product_code|default:" "}) {include file="common_templates/price.tpl" value=$oi.subtotal}

{/foreach}


Sub Total: £{$order_info.subtotal}

Discount: £{$order_info.discount}

Delivery: £{$order_info.shipping_cost}

-------------------

Total: £{$order_info.total}



----------------------------------------------------------------------------------------------

INVOICE DETAILS



Name: {$order_info.firstname} {$order_info.lastname}

{if $order_info.company}Company: {$order_info.company}
{/if}
Email: {$order_info.email}

{if $order_info.phone}Phone: {$order_info.phone}
{/if}


----------------------------------------------------------------------------------------------

BILLING DETAILS



{$order_info.b_firstname} {$order_info.b_lastname}

{assign var="profile_fields" value='I'|fn_get_profile_fields}
{foreach from=$profile_fields.B item="field"}
{if !$field.field_name}
{assign var="data_id" value=$field.field_id}
{assign var="value" value=$order_info.fields.$data_id}
{if $value}{$value}
{/if}
{/if}
{/foreach}
{$order_info.b_address}

{if $order_info.b_address_2}{$order_info.b_address_2}
{/if}
{$order_info.b_city}

{$order_info.b_state_descr}

{$order_info.b_zipcode}

{$order_info.b_country_descr}



----------------------------------------------------------------------------------------------

DELIVERY DETAILS



{$order_info.s_firstname} {$order_info.s_lastname}

{assign var="profile_fields" value='I'|fn_get_profile_fields}
{foreach from=$profile_fields.S item="field"}
{if !$field.field_name}
{assign var="data_id" value=$field.field_id}
{assign var="value" value=$order_info.fields.$data_id}
{if $value}{$value}
{/if}
{/if}
{/foreach}
{$order_info.s_address}

{if $order_info.s_address_2}{$order_info.s_address_2}
{/if}
{$order_info.s_city}

{$order_info.s_state_descr}

{$order_info.s_zipcode}

{$order_info.s_country_descr}



----------------------------------------------------------------------------------------------



Should you have any questions regarding this order, please contact us on {$settings.Company.company_orders_department}



Once again, thank you for shopping at {$settings.Company.company_name}.





This mod will mean that depending on status, you and your customer will receive an email similar to the below for all orders, rather than an invoice each time:


[quote]Dear Jo Bloggs



Thank you for shopping at The Widget Shop. Your order has been received and will be processed shortly.



You will receive a confirmation email when your order has been despatched.



----------------------------------------------------------------------------------------------

ORDER DETAILS



Order Number: 161882

Date: 31/08/2007, 10:55 AM

Status: Processing

Delivery Method: UPS Standard



2 x Blue Widgets (10101) £198.00

4 x Round Green Widgets (10104) £556.00

3 x Not So Straight Widgets (10105) £585.00



Sub Total: £1339.00

Discount: £0.00

Delivery: £9.50

-------------------

Total: £1348.50



----------------------------------------------------------------------------------------------

INVOICE DETAILS



Name: Jo Bloggs

Company: Bloggs Inc

Email: jo.bloggs@bloggsinc.com

Phone: 00000000000



----------------------------------------------------------------------------------------------

BILLING DETAILS



Jo Bloggs

Bloggs Inc

1 Bloggs Road

Bloggsville

Bloggs Town

Bloggs County

BL0 0GG

United Kingdom (Great Britain)



----------------------------------------------------------------------------------------------

DELIVERY DETAILS



Jo Bloggs

Bloggs Inc

1 Bloggs Road

Bloggsville

Bloggs Town

Bloggs County

BL0 0GG

United Kingdom (Great Britain)



----------------------------------------------------------------------------------------------



Should you have any questions regarding this order, please contact us on help@thewidgetshop.com



Once again, thank you for shopping at The Widget Shop.[/quote]







Please note that adjustments have been made within the admin section so that ‘county’ replaces ‘state’ etc. Also, the code above is setup so that if a customer does not include a ‘company’ name it will not show that line. All sections are seperate, so billing and shipping will show differently if they have been typed in differently etc.



If you have any questions, let me know. I hope it helps.

Wow, thanks Ian!



I know this will be helpful for me. Wish I had time to play with it right now but don’t. Looks great though, and realativley straight forward and easy to mod per individual needs. I’ll have to see what it takes to add my “complications” (shipment tracking number in particular, ideally a custom message when needed as well) when I get to this, though that won’t be soon.



Thanks again for all the work.



I expect once I get my templates finished, the store as configured as I wish and my list of desired changes refined I'll probably sign up for a month of helpdesk assistance. Were the CS-team very responsive in assisting with this, or did you just need a couple of clarifications? My experience has been mostly 'pay us and we'll do it for you', though they did answer a number of pre-sale questions for me.

Put it simply, the helpdesk were incredibly good, answering my queries once or twice daily (appreciating their location and time difference). I asked tons of questions on this one, and they answered all of them in full, even the ones we needed to work togeather on over a few replies. I got my money’s worth out of them, and would suggest that paying for a month in the future should needed is money well spent. Doesn’t take away the fact this should really be a standard part of the cart anyway, but even so, with support like that, anything is possible.

Hi,

Thanks, looks great. Looks like alot of work went into this.

Just have a question. Have not had cart long enough to know.

Does an email have to go out to the customer each time the status is changed?

I only want one email, when the order is created and no others.

When I “process” an order, it just means to me that I transferred it to QuickBooks, but does not infer shipping. Shipping information is sent by other software.

I would only make one status change in CS-Cart and don’t want a notice sent to customer.

Thank you

[quote name=‘ian-d’]Put it simply, the helpdesk were incredibly good … paying for a month in the future should needed is money well spent.[/quote]

Very happy to hear that. I don’t mind paying for help, as long as I get value for my money. They have to make a living too.

[QUOTE]Doesn’t take away the fact this should really be a standard part of the cart anyway[/QUOTE]

Yeah, I’d agree with that, but it’s all a matter of perspective. I think all of my priorities should be standard, but they’re not, at least not yet. Cart programmers aren’t necessarily versed in all needs a merchant might face, and we all have different priorities and do things differently. Though you and I both prefer plain-text emails, I will mod what you’ve provided to suit the way I do business as it’s not an exact match (close though) and is missing some features I won’t be able to live without … i.e. my customers expect the ability to track their order, and I can’t imagine running a retail site w/o providing that. Not that it should be a priority for you, it just is for me. CS-C will eventually cover us both, if we want it sooner we have to pay.



My big concern with custom work is that it is easily transferrable to upgrades … this one should be w/o problem. I’d imagine this mod will find it’s way into the base package eventually.

[quote name=‘pbannette’]

When I “process” an order, it just means to me that I transferred it to QuickBooks, but does not infer shipping. Shipping information is sent by other software.[/QUOTE]

Actually this is the way I work now as well, handling actual order processing, in QB, including shipping. (I expect I’ll be moving toward doing most of that in CS-Cart and transferring completed transactions to QB though).

[quote name=‘pbannette’]Does an email have to go out to the customer each time the status is changed?[/QUOTE]



Nope, just untick the box so it doesn’t send an email copy to the customer. There’s some code to have it automatically default to off in the admin, its on the forum somewhere, recently discussed.

Nice mod ian!

Thanks a lot for sharing. I really prefer this method to the invoice method. It also makes it so you can easily copy and paste shipping addresses into shipping services.



One thing I noticed about your code is that all the break tags are written as “
”. When I implemented this code, there were no line breaks in my test order emails (using Outlook 2007). I changed them all to “
” and everything is fine. Just thought I’d point that out.


[quote name=‘arlen’]…my customers expect the ability to track their order, and I can’t imagine running a retail site w/o providing that. Not that it should be a priority for you, it just is for me.[/QUOTE]



It’s pretty easy to add the tracking number to your “completed” email. This is how I did it:



```php {$lang.tracking_number}: {$order_info.tracking_number}

```

Cool tjmaxwell … saves me the time of figuring it out, thanks.

I know everybody thinks this is cool, but Ive already done this and posted it on the forum, so I hope it didnt cost you much ! :stuck_out_tongue:



[URL=“http://vb.cs-cart.com/showthread.php?t=1723&highlight=status+emails”]http://vb.cs-cart.com/showthread.php?t=1723&highlight=status+emails[/URL]



Your still not sending out a plain text email, its still going via a MIME type of HTML

I know its not plain text, i coded it in html but its as close as you can get with cs-cart. I picked up on your thread originally, but it only covered the changes to notification, not actual help with templates which if i remember was something you wanted to do but hadn’t found time. No probs if its no use to you, sure it will be for the rest :slight_smile:

IAN-D,

Will your template list product options and what would they look like? Looks like the template example contains products without options.

Thanks.

pbannette - i don’t have how it would look, as said, its a custom form specific for how i want it so there is bound to be parts missing. Should be easy enough to introduce though.



All - minor edits done to include
instead of
, and also a section for if a customer adds a comment to their order, silly me for missing that one out!






Dear {$order_info.firstname} {$order_info.lastname}



Thank you for shopping at {$settings.Company.company_name}. Your order has been received and will be processed shortly.



You will receive a confirmation email when your order has been despatched.



----------------------------------------------------------------------------------------------

ORDER DETAILS



Order Number: {$order_info.order_id}

Date: {$order_info.timestamp|date_format:"`$settings.Appearance.date_format`, `$settings.Appearance.time_format`"}

Status: {include file="orders/order_status.tpl" status=$order_info.status display="view"}

Delivery Method: {$order_info.shipping}



{foreach from=$order_info.items item="oi"}
{$oi.amount} x {$oi.product} ({$oi.product_code|default:" "}) {include file="common_templates/price.tpl" value=$oi.subtotal}

{/foreach}


Sub Total: £{$order_info.subtotal}

Discount: £{$order_info.discount}

Delivery: £{$order_info.shipping_cost}

-------------------

Total: £{$order_info.total}



----------------------------------------------------------------------------------------------

INVOICE DETAILS



Name: {$order_info.firstname} {$order_info.lastname}

{if $order_info.company}Company: {$order_info.company}
{/if}
Email: {$order_info.email}

{if $order_info.phone}Phone: {$order_info.phone}
{/if}


----------------------------------------------------------------------------------------------

BILLING DETAILS



{$order_info.b_firstname} {$order_info.b_lastname}

{assign var="profile_fields" value='I'|fn_get_profile_fields}
{foreach from=$profile_fields.B item="field"}
{if !$field.field_name}
{assign var="data_id" value=$field.field_id}
{assign var="value" value=$order_info.fields.$data_id}
{if $value}{$value}
{/if}
{/if}
{/foreach}
{$order_info.b_address}

{if $order_info.b_address_2}{$order_info.b_address_2}
{/if}
{$order_info.b_city}

{$order_info.b_state_descr}

{$order_info.b_zipcode}

{$order_info.b_country_descr}



----------------------------------------------------------------------------------------------

DELIVERY DETAILS



{$order_info.s_firstname} {$order_info.s_lastname}

{assign var="profile_fields" value='I'|fn_get_profile_fields}
{foreach from=$profile_fields.S item="field"}
{if !$field.field_name}
{assign var="data_id" value=$field.field_id}
{assign var="value" value=$order_info.fields.$data_id}
{if $value}{$value}
{/if}
{/if}
{/foreach}
{$order_info.s_address}

{if $order_info.s_address_2}{$order_info.s_address_2}
{/if}
{$order_info.s_city}

{$order_info.s_state_descr}

{$order_info.s_zipcode}

{$order_info.s_country_descr}



{if $order_info.notes}----------------------------------------------------------------------------------------------

CUSTOMER NOTES


{$order_info.notes}

{/if}

----------------------------------------------------------------------------------------------



Should you have any questions regarding this order, please contact us on {$settings.Company.company_orders_department}



Once again, thank you for shopping at {$settings.Company.company_name}.



If anyone decides to use it, let us know how you get on. Hopefully cs-cart will introduce as standard on a new release.

[quote name=‘ian-d’]If anyone decides to use it, let us know how you get on. Hopefully cs-cart will introduce as standard on a new release.[/QUOTE]



It does look good, though I’ve put a hold on installing any new mods until the new cart is released.