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.

I Broke one thing fixing another

jrwhipjrwhip Member
in General edited December 2014
After some tinkering my cart was working well. However I had some code placed in the "Add custom form fields to your checkout" section of the configuration page, and apparently I accidentally replaced it with code that was suppose to be in the "Add custom header and footer code to your templates" on the same page.

The problem is I can't seem to figure out how to get it back to the way it was. I have two pieces of code which are suppose to be in this custom fields section:
{% if Referred_By is not defined %}
	{% set Referred_By = "" %}
	{% for key, custom_field in custom_fields %}
		{% if key == "Referred_By" %}
			{% set Referred_By = custom_field.value %}
		{% endif %}
	{% endfor %}
{% endif %}

<div class="fc-form-group" data-fc-error-for="Referred_By" data-fc-error-class="fc-alert-container--error">
	<div class="col-sm-8 col-sm-offset-3">
		<div class="fc-input-group-container fc-input-group-container--active">
			<label class="fc-input-group-container__title fc-input-group-container__title--forced fc-form-label">
				Referred by…
			<div class="fc-form-group">
				<p>How did you hear about us?</p>
				<input type="text" id="Referred_By" name="Referred_By" placeholder="" autocomplete="off" class="fc-form-control" aria-required="true" value="{{ Referred_By }}" data-fc-required>
		<div class="fc-alert fc-alert--danger hidden" data-fc-error-for="Referred_By" data-fc-error-class="show,hidden">
	        <div class="">Please tell us how you heard about us.</div>

You previously helped me get it correct in this thread:

I have gone over the thread several times, as well as the documentation and I can't seem to figure it out. Which is frustrating since I did it before.

Can you help me figure out what I am doing wrong?

Also I see this as being a potentially big problem. No way to revert to a previous state. I need a undo button or a backup option. Do you have anything like that?
  • winstonwinston FoxyCart Team

    I just tested this out on my store and the code you have above works perfectly. Could you link or whisper the store you're working on so I could investigate a bit further?

    Here's what I saw (i was testing on a customized store)

    That was with appending
    to the end of the product link. I'm happy to debug further if you can point me towards your store.
  • Am I putting the code in the right order? How do you have it exactly pasted into your store?
  • fc_adamfc_adam FoxyCart Team

    Looking at your form - I don't see a "Referred_By", but I do see a "referral_source". Is that the field you're wanting included in the cart? If so - you'll need to change the following line like so:
    {% if key == "referral_source" %}
  • Thanks! I can't believe I missed that. It's working great.
Sign In or Register to comment.