The Foxy forums are on the move!

We're in the process of moving our forums over to a new system, and so these forums are now read-only.
If you have a question about your store in the meantime, please don't hesitate to reach out to us via email.

Passing Session Variables to Email

damienkeedamienkee Member
in Help edited March 2012
Hi, I'm setting up a ticketing page for our local theatre group and am having a few issues transferring session variables through to the email confirmation.

We're using session variables to indicate what date the performance is on, rather than having all 10 performance dates as properties for each ticket type.

I can successfully pass and display the session variable on the checkout page, but cannot seem to populate the fc_custom_fields inputs so that they go through to the email.

I am no expert in jQuery (but am quickly learning!) but this one has me a little stumped. In a nutshell, how do I replace the ??? (which do go through to the email) with the variables I pull out of the JSON object? Hove been trying variation sof the val() and html() but am sure I've got the syntax wrong.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "">;

<html xmlns="">;
	<title>^^store_name^^ Checkout</title>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<link rel="stylesheet" href="https://^^store_domain^^/themes/standard/styles.css"; type="text/css" media="screen" charset="utf-8" />

<!-- INSERT Custom fields into checkout -->
<script type="text/javascript" charset="utf-8">
jQuery(document).ready(function() {
     var performance = fc_json.custom_fields.performance;
     var seating = fc_json.custom_fields.seating;


<body id="checkout">
	<div id="pageContainer" style="width:760px; margin:0px auto;">


<h2>Additional Information</h2>
<p>Show Selected: <div class="performance_holder"></div>
<p>Preferred Seating : <div class="seating"></div>
<fieldset id="fc_custom_fields">
<input type="hidden" name="performance_email" value="??">
<input type="hidden" name="seating_email" value="???"

</div><!-- .fc_inner -->
</fieldset><!-- #fc_custom_fields -->


Full link here if it helps -

Any help would be greatly appreciated!

Damien Kee

  • lukeluke FoxyCart Team
    Hey Damien. The easiest way is to give your inputs id's like so:
    <input type="hidden" id="performance_email" name="performance_email" value="???" />
    <input type="hidden" id="seating_email" name="seating_email" value="???" />

    And then update the jQuery:
    var performance = fc_json.custom_fields.performance;
    var seating = fc_json.custom_fields.seating;

    Hope that helps.
  • Luke, you rock!!!! :)

    Next step, can I edit the ^^cart^^ placeholder? (I've looked but pretty sure I can't). I don't want to include the line items 'Category' and 'Group Total' as I think they're not relevant to us (and the word 'Group' has different meaning to us which will be very confusing.)

    The option I'm exploring now is doing a for loop to check through all the products, pick out the ones that have non-zero quantities and send them through to the email like I've done with the session variables.

    Let me know if you think there is a better way.

    Damien Kee
  • sparkwebsparkweb Member, Integration Developer, FoxyShop, Order Desk
    If you want to do further customization of the email receipt I think you'll need to go this route:
  • Thanks Sparkweb, I did look at that, but it doesn't handle custom fields :(
  • fc_adamfc_adam FoxyCart Team

    I believe that limitation is just because it was built for an old version of the XML datafeed. Newer versions of FoxyCart will include custom fields in the XML datafeed. The script would just need to be adapted to match the current XML datafeed as displayed here:
  • lukeluke FoxyCart Team
    @damienkee: you can also use the "language" section of the admin to customize that text however you like. Additionally, you can use jQuery to hide things you don't want, though that would obviously only work for the cart, checkout and receipt, not the actual email.

    Hope that helps.
Sign In or Register to comment.