Extra Product Field in Confirmation & Thank You Emaiil

Questions and answers about ShopSite Custom Templates

Extra Product Field in Confirmation & Thank You Emaiil

Postby gerryleblanc » Mon Jun 30, 2014 12:30 pm

Hello there!
I need to include some extra information on the order confirmation page, and thank you email, and I need that done on a product specific basis. The way I am looking at it, I could use one of the Extra Product Fields to store the information (some text and a URL ..maybe HTML too..?), and if I had a javascript or template tag that could see what's in the shopping cart based on the SKUs there, then check the DB to see if there's a value in the PRODUCT.Field1 field for each product, then output it if that field is not empty. I am pretty savvy with customizing templates, so I feel like I just need some help here. Running ShopSite Pro 12 r2.1
Thanks for looking!
Gerry
gerryleblanc
 
Posts: 37
Joined: Fri Apr 23, 2010 10:47 am
Location: Massachusetts, USA

Re: Extra Product Field in Confirmation & Thank You Emaiil

Postby gerryleblanc » Mon Jun 30, 2014 1:22 pm

After digging some more, I can see that I am getting all the extra fields set as variables in the thank you email HTML template. Now, just to output to the email itself....
gerryleblanc
 
Posts: 37
Joined: Fri Apr 23, 2010 10:47 am
Location: Massachusetts, USA

Re: Extra Product Field in Confirmation & Thank You Emaiil

Postby gerryleblanc » Mon Jun 30, 2014 1:57 pm

Okay... I am getting closer! Thanks to this post:
http://support.shopsite.com/forums/viewtopic.php?f=11&t=9170&p=24360&hilit=Shopping+Cart+JavaScript+Variables#p24362

I am able to output the extra product field on the Thank You Screen, now to get it working on the email! I see in the raw email source, that the javascript is there, but it is not executing properly... not sure why!
gerryleblanc
 
Posts: 37
Joined: Fri Apr 23, 2010 10:47 am
Location: Massachusetts, USA

Re: Extra Product Field in Confirmation & Thank You Emaiil

Postby gerryleblanc » Mon Jun 30, 2014 2:23 pm

So now I have discovered that I can add:
Code: Select all
<script type="text/javascript">[-- SC_JAVASCRIPT extras --]</script>

To the HEAD of my email template, and all the variables are loaded!

But the bit that is still eluding me is why the same document.write function does not seem to output to the email delivered to my inbox!

Any help would be appreciated!
gerryleblanc
 
Posts: 37
Joined: Fri Apr 23, 2010 10:47 am
Location: Massachusetts, USA

Re: Extra Product Field in Confirmation & Thank You Emaiil

Postby gerryleblanc » Mon Jun 30, 2014 2:32 pm

Wow... this is fun... I have discovered that most email clients will block <javascript> from running, so even though my Thank You Email template is putting out valid HTML and Javascript, it is not displaying :(

Anyone have any ideas on how to maybe redefine the javascript variables as Shopsite variables and then output them?
gerryleblanc
 
Posts: 37
Joined: Fri Apr 23, 2010 10:47 am
Location: Massachusetts, USA

Re: Extra Product Field in Confirmation & Thank You Emaiil

Postby ShopSite Lauren » Tue Jul 01, 2014 9:21 am

Gerry, with emails, you want to code as if you were coding for browsers in the late 90's and early 2000's. Many email clients don't understand newer code, and are even really picky about basic coding elements such as CSS. For example, Gmail will disregard any CSS that is in the HEAD section of the 'page' which is normally where you want it. So for CSS you want to have the CSS inline when possible, or at least within the BODY of the 'page'. Like you mentioned, JavaScript is not common in emails (I don't know of any email clients that execute JavaScript). The best way to do what you are trying to do with ShopSite is to use the Order API and actually create and send your own thank you email. That would make it so that instead of trying to modify the email content after the email is created by ShopSite, your custom Order API would be creating the email and sending the information you want.
http://www.shopsite.com/help/current/en-US/sc/pro/order.api.html
- ShopSite Lauren
Contact me for help with any of your
custom ShopSite template questions.
ShopSite Lauren
 
Posts: 887
Joined: Fri Aug 11, 2006 1:35 pm
Location: Orem, UT

Re: Extra Product Field in Confirmation & Thank You Emaiil

Postby gerryleblanc » Tue Jul 01, 2014 9:27 am

Lauren, thank you for the reply... I'll check that out!

I have also been working with using the Custom Checkout fields to get the JS variables I need into Shopsite variables... still I am getting hung up on the way that JS interacts with HTML and FORM elements. Have you seen any examples of populating a hidden Custom Checkout field with one of the JS variables?
gerryleblanc
 
Posts: 37
Joined: Fri Apr 23, 2010 10:47 am
Location: Massachusetts, USA

Re: Extra Product Field in Confirmation & Thank You Emaiil

Postby ShopSite Lauren » Tue Jul 01, 2014 9:54 am

Oh yeah, that's not a bad idea, putting the custom information in a custom checkout field, because ShopSite can put the custom checkout fields in the email receipt.

I haven't tested the exact code, but it would be something like the following in one of the text fields on the checkout screen.
1. Enable at least 1 custom checkout field (Commerce Setup > Order System > Checkout).
2. Enter your custom information in one of the extra product fields.

<script type="text/javascript">
document.write("<input name=\"field01\" value=\"" + ss_field1 + "\" type=\"hidden\">");
</script>

Where field01 is the custom checkout field you are using and ss_field1 is the extra product field you are using.
- ShopSite Lauren
Contact me for help with any of your
custom ShopSite template questions.
ShopSite Lauren
 
Posts: 887
Joined: Fri Aug 11, 2006 1:35 pm
Location: Orem, UT

Re: Extra Product Field in Confirmation & Thank You Emaiil

Postby gerryleblanc » Tue Jul 01, 2014 11:21 am

Hi Again!

So, yes, I have been successful in getting the JS variable into the Custom Checkout field!

Now... my issue is that [-- CustomHTML_values --} does not seem to allow me much control over the values passed. None, in fact, as far as I can see. Is there a way to access the individual Custom Checkout fields in the Thankyou Email Template?

Like: [-- CustomHTML_values field01 --} ?
gerryleblanc
 
Posts: 37
Joined: Fri Apr 23, 2010 10:47 am
Location: Massachusetts, USA

Re: Extra Product Field in Confirmation & Thank You Emaiil

Postby gerryleblanc » Tue Jul 01, 2014 11:49 am

I might also get this to work for me if I could access the SKU and use it in an IF clause to run an include on the template. Any suggestions there?
gerryleblanc
 
Posts: 37
Joined: Fri Apr 23, 2010 10:47 am
Location: Massachusetts, USA

Re: Extra Product Field in Confirmation & Thank You Emaiil

Postby ShopSite Lauren » Tue Jul 01, 2014 12:04 pm

Not really, the template IF statements are only for general things in ShopSite. The IF statements come BEFORE the content...before you get any of the order information.

What is the goal with all this? Are you display A LOT of information, or just an additional sentence? Could there be many different sentences... could you give me more detailed information to see if there is any way I can help you get what you want without using the Order API.
- ShopSite Lauren
Contact me for help with any of your
custom ShopSite template questions.
ShopSite Lauren
 
Posts: 887
Joined: Fri Aug 11, 2006 1:35 pm
Location: Orem, UT

Re: Extra Product Field in Confirmation & Thank You Emaiil

Postby gerryleblanc » Tue Jul 01, 2014 12:16 pm

Lauren, thank you for continuing this thread with me!

The broad strokes are that I am trying to provide additional information after an item is purchased... and that information is specific to the product purchased.

An example would be like a post-purchase bonus: A message that says "You bought product X so now you get this other thing free" then a link is provided to a URL where that free thing was.

Another example would be when the product purchased requires the customer to then schedule an appointment via an online calendaring system... we'd want to send them a link to the online calendar in the email receipt and display that on the thank you screen.

I can see how I could add that information (text and HTML) to the Extra Fields on a product-by-product basis in order to store it all in the Shopsite database.. . I could also see running an include based on SKU to display the desired content.

I am mostly there... I've can make what I want happen on the Thank You screen via the JS variables... but the email template requires something simpler...

I looked over the Order API info, and feel like that's over my head so I'm trying to get this done with the tools available in SS.

Thanks again!
Gerry
gerryleblanc
 
Posts: 37
Joined: Fri Apr 23, 2010 10:47 am
Location: Massachusetts, USA

Re: Extra Product Field in Confirmation & Thank You Emaiil

Postby ShopSite Lauren » Tue Jul 01, 2014 1:53 pm

To display a link to where a customer can schedule something, I would suggest that in the email, you put the custom fields at the top, in some type of shaded area, something that stands out. Maybe even a section that looks more like a button. Then you can put all the text and link in the custom field (via the product field) to "Click here to schedule your appointment"...something like that.

However, the feature, to display similar products in the email receipt, that is something that the Order API is more designed for. It isn't something that I would know how to do in the email receipt that ShopSite creates, purely because emails and email clients are too limited on code.
- ShopSite Lauren
Contact me for help with any of your
custom ShopSite template questions.
ShopSite Lauren
 
Posts: 887
Joined: Fri Aug 11, 2006 1:35 pm
Location: Orem, UT

Re: Extra Product Field in Confirmation & Thank You Emaiil

Postby gerryleblanc » Fri Jul 11, 2014 8:16 am

Hi Lauren,

I've worked on this, and come to a place where I am able to do what I need, but I have found a real bug in Shopsite at the template level.

Using [-- CustomHTML_Values --] in the Thank You email is working for me to show a URL to the customer so that they can link to a scheduling app, or to another landing page where we can do more selling, or value add to the purchase.

The BUG is this:
[-- CustomHTML_Values --] in the *customer* email template outputs a blob of text, and nothing more. It does not distinguish between the custom field names or the custom field values (this would make sense, but I can't really call it a bug), what IS a bug is that is also does not do anything (except maybe a linefeed) to set off multiple fields from each other... not even a <BR> to separate field01 from field02 etc.

I call this a bug because in the *store manager* email notification, that template at least does separate the custom fields with a <BR> when I look a the raw source of the emails sent.

I'd put this into Feature Requests, but it seems to me that if I were to do that, I'd really want to request the ability to add a parameter to [-- CustomHTML_Values --] so that it could be something like: [-- CustomHTML_Values field01 --] so that each field could be handled with some HTML and styling.

Thank you for your guidance!
Gerry
gerryleblanc
 
Posts: 37
Joined: Fri Apr 23, 2010 10:47 am
Location: Massachusetts, USA

Re: Extra Product Field in Confirmation & Thank You Emaiil

Postby ShopSite Lauren » Fri Jul 11, 2014 10:23 am

Gerry,

That is a good idea. I will let our developers know and they should be able to change that tag's output rather quickly. Thank you for bringing that to our attention so that we can change it. Have a great weekend!
- ShopSite Lauren
Contact me for help with any of your
custom ShopSite template questions.
ShopSite Lauren
 
Posts: 887
Joined: Fri Aug 11, 2006 1:35 pm
Location: Orem, UT

Next

Return to Custom Template Questions

Who is online

Users browsing this forum: No registered users and 40 guests

cron