Custom Fields Not Showing in Receipt

webmalamawebmalama Member
in Help edited April 2012
Hey guys,

I've added two custom fields to my checkout form based on the custom field documentation for 0.7.2 (http://wiki.foxycart.com/v/0.7.2/checkout#adding_custom_checkout_fields). When submitted, the information in the fields isn't showing up on the receipts, transaction reports, or datafeeds.

Any clues as to where I went wrong? I'm wondering if it perhaps has anything to do with HMAC validation?

The code I added to the very end of my check form template, below the </html> tag is:
^^custom_begin^^
<div id="gift-information">
<h2>Sending a Gift?</h2>
<fieldset id="fc_custom_fields">
	<div class="fc_inner">
		<div>
			<h4>Is this a gift?</h4>
			<input type="checkbox" name="is_gift" value="yes" />
			<label for="is_gift">Check this box if you'd like to include a gift message.</label>
 
		</div>
		<div>
			<h4>Gift Message</h4>
			<p>Enter any gift message you'd like sent along with your purchase.</p>
			<textarea name="gift_message" cols="60" rows="4" maxlength="400"></textarea>
		</div>
	</div><!-- .fc_inner -->
</fieldset><!-- #fc_custom_fields -->
</div>
^^custom_end^^

Everything in the DOM looks good to go and the fields are inside of the form element.

The checkout page is located at https://breastcancerplanner.foxycart.com/checkout.php.

Thanks,
Aaron
Comments
  • lukeluke FoxyCart Team
    edited April 2012
    This one stumped me for a bit until I looked at your template and realized you have them positioned outside of the html tag after this:
    </body>
    </html>
    

    You have to position the custom fields where you want them to show up in the document, I think. That would be my first guess, anyway.


    Ignore me. I'm confused and need to read the manual for the code I wrote myself. :-/
  • @luke, I moved the code directly below the ^^checkout^^ and tried again. No love.

    Then, I spotted some old code that had come from a previous version to place the box appropriately:
    <script type="text/javascript" charset="utf-8">
    	jQuery("document").ready(function(){
    		jQuery('#fc_custom_fields_container').insertAfter('#fc_cart_container');
    	});
    </script>
    

    I removed this code and now everything is working as expected (although I now need to redo the CSS for that element). I'm not sure what the learning take-away is here though. Maybe, moving form elements with jQuery can keep them from submitting?
  • sparkwebsparkweb Member, Integration Developer, FoxyShop, Order Desk
    I'm like 99% sure that the ^^custom_begin^^ stuff is supposed to be at the very end of the file because the template engine grabs it and sticks it where it wants to anyway.
  • fc_adamfc_adam FoxyCart Team
    @sparkweb, you're right - the ^^custom_begin^^ placeholders will take it's contents and move it into the required place within the structure of the checkout form (generally right before the order total fields).
  • lukeluke FoxyCart Team
    Oh, sorry guys. /me needs more sleep. I'll edit my post. You'd think I'd know how this stuff should be setup, since I wrote it, right? Sorry to create confusion.
Sign In or Register to comment.