As most of us are aware transactional emails play a huge part in marketing within an e-commerce store.
I'm currently looking at overhauling mine, but it seems Foxycart offer very little ability to really go to town on these.
For instance, I'd like to add personalisation to my receipt, but the ^^name_first^^ doesn't appear to be a usable field in receipts.
Is using webhooks and external service the best way to go about this?
You can use the transaction datafeed to build your own receipt emails, or you can also use Twig templates - which is a new feature in 1.0 - to build out your own templates and remain within the FoxyCart setup. Information on Twig can be found here: http://wiki.foxycart.com/static/redirect/checkout
But there doesn't appear to be any integration with Foxycart. Though it's owned by Mailchimp which does integrate.
Are there any how tos on using the datafeed?
If you take a look at our integrations page there are some generic integration examples for the datafeed, including one that gives a basic idea of sending a receipt. If you take that and customise as required - you'll just need to put in your mandrill specific code when it comes time for sending with in the endpoint. http://wiki.foxycart.com/integration
It looks like I won't have all the data available:
Doesn't include custom fields
Doesn't take into account product price modifiers when calculating option price.
Would a checkbox to sign up to marketing count as a custom field?
I can't see how it lets me sent over all the information for deassembley and reassembly in Mandrill. Unless you mean the XML-to-email.php - How do I tell Foxycart to use that?
Only being comfortable with HTML/CSS is a pain. I really need to learn more. lol
Unfortunately we don't have a full example for exactly what you're asking. The one you linked to was one of the examples I was referring to, and is more of a kickstarter.
So if we take it one step back, let me give a bit of context:
The XML datafeeds are a feature which sends an encrypted copy of the order details to an endpoint of your choosing. That endpoint is set in the stores FoxyCart administration, and is a server-side script (of any server side language) that is able to accept the encrypted information. From there, your script can do whatever it wants once it's decrypted the information. Whether that be adjusting something in a database like stock or user access levels, or passing information on to other services like newsletter subscription services, fulfilment houses, custom emails etc.
So that custom receipt script does have access to all of the information for the order, but currently it's just not coded to get that information from the XML it receives via the datafeed.
Is there a reason you're wanting to use mandrill to send the emails? For what it's worth, we currently use SendGrid as our outgoing email provider and keep a close eye on our stats to ensure we're getting really good deliverability.
Also, if you're not too familiar with server-side languages, I'd actually recommend either partnering with a developer to achieve what you're after, or working with the Twig templating available in 1.0. Using Twig templates you can customise the template as much as you want, even completely rewriting the structure if you want.
If you'd like to work with a developer, we can recommend some who are familiar with FoxyCart already that could help you - or if you perhaps give some more details on what exactly you're wanting to customise we can give some more specific advice.
Basically I just want to strip apart the receipt e-mail and rebuild it. It looks like I (well maybe not me) can do this with Mandrill.
Obviously I can create a nice looking HTML e-mail using FC, but as cart contents, addresses etc.. are all held in blocks (^^receipt^^, ^^cart^^), I can't style or separate the individual elements of these blocks to create the type of e-mail I desire.
I don't know if this is possible, but I'd also like to be able to show a small thumbnail image of the ordered product in the HTML version of the receipt too.
Is Mandrill the best way of going about what I want to achieve? The reason for choosing it, is that I'll be sending less than 2,000 e-mails a month so it would be completely free.
If a developer is required for this do you have any idea on how long it would take and cost?
I running wordpress and using the excellent foxyshop plugin.
Probably worth noting is that all Mandrill will give you is a way to send HTML emails. It won't build out the template for you - you'll still need to capture the XML datafeed yourself, and build a script which takes the order details, pulls out the information you need and then pass the data and template information over to Mandrill for it to send.
I'd definitely suggest taking a look at Twig documentation over here: http://wiki.foxycart.com/static/redirect/checkout - unless you're wanting to get custom in how the receipt email is sent, the ability to customise the template would be equal between Twig and going completely custom with the datafeed.
Also, you can definitely upgrade - take a look at the upgrade notes here: http://wiki.foxycart.com/static/upgrading and I'm sure @sparkweb will be able to give you some pointers on anything to note with FoxyShop
I want to have a go at templating my receipt via Twig, and have checked out the documentation.
So presumably wherever I want certainly elements to appear in the template I can can just drop them in? So for personalisation I could use:
That seems simple enough.
The problem is that I can't see anyway within Foxycart or other to actually test the e-mail template at all. So how am I to know that it's all working right, and what it looks like?
If you put through a test transaction, you can resend the receipt email for that same transaction from within your stores transaction report - so you just keep resending that same receipt.
In terms of the personalisation, that's right - just use the existing tags as reference as customise as needed.
customers name
payment details
billing address
shipping address
Not necessarily in that order.
I also want to show the product with small thumbnail image, and the price, in a table. Kind of like the default html template for 1.0
I can't seem to find a list of all the twig placeholders for foxycart though.
What ones are you missing?
Now all I can find is the regular ones like ^^cart^^ etc..
I guess I want things like {{ billing address }}, {{ shipping address}} even better if these are broken up into the individual elements {{ house number }} {{ street }} etc..
Then all the separate elements for ^^cart^^ so that I can style them in my own table.
I don't think we have a huge list of all of the placeholders for twig anywhere - your best bet would be to dig into the actual files that are linked to on the wiki page, and pull out the ones you need to use.
^^subtotal^^
^^order_total^^
Have just been printed like that in my email.
Here's the source which is just a work in progress.
That's odd that some things work as ^^#^^ but others as {{ # }}
Thanks
The ^^label^^ placeholders are the old ones that we've defined ourselves for the old templating setup in 0.7.2 and older. They're still there in 1.0 for backwards compatibility.
When working with twig, you'll just be using {{ label }} for placeholders to grab the information you want. If you look through the relevant templates as linked to on the wiki, you'll be able to see what these placeholders are for whey're they're used in the template. If you're looking for cart specific placeholders, you'll need to check the cart template fyi.
Think I'm slowly getting there.
Thanks for the patience.
1) I can't find the right call to get the product image into the template. In the examples given by FC even the Twig template just contains ^^cart^^ with no separation of the individual cart.
2) What's the call for the total of a product. Say the user buys 2x Product A, and 3x Product B. I want to display a table breaking that out.
3) Presumably I need some sort of loop, to ensure that multiple products, get added to the table in the receipt e-mail. What needs to be included for that?
Here is the code I used for a table to test some calls. It was added to the code I previously posted above. Absolutely nothing in the table was pulled in. So I'm doing something wrong.
Some of our team is on the road today. Someone will respond soon to your post. Thanks for hanging in there.
Thanks,
Josh
As I mentioned, you'll need to dig into the separate cart template to see the Twig templates for the cart - looking at that template should give you an answer for all three of your questions
I'm very sorry - it looks like I may have given you the wrong link previously. You'll find the default twig templates available part way down on this page: http://wiki.foxycart.com/static/redirect/templates - with templates for the cart, checkout, receipt and emails.
I've seen the code Now will that show the cost of shipping, or will that show the cart total including shipping?
It doesn't seem to do what i want.
for instance Which is in the cart template doesn't call up and image in the email. There doesn't seem to be any twig code for the order number, or item name either. At least as far as I can see. :-(
Sorry for the confusion. We do know that it can be a bit hard to find the different variables for Twig - and we have plans to put together a complete cheatsheet with all the different variables listed - but for now looking for the matching values in the raw templates is your best bet.
The order number is available as {{ order_id }} - and you can find that in the receipt and the email templates.
Item name - I'm assuming you're referring to the product names? That is available as {{ item.name }}, when in a loop of all the items in the cart like {% for item in items %} {% endfor %}
{{ item.image }} should definitely display an image if one is available - but again, it would need to be within the loop of all the items as noted above.