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 variables in URL to be used in checkout template

tankmantankman Member
in Help edited March 2009
I want to be able to pass some variables (like city name) to the checkout page on my foxycart cached template so it can be displayed on the checkout page.

Is this possible to do? through the URL maybe?

Thanks.
Comments
  • lukeluke FoxyCart Team
    Take a look at this: http://wiki.foxycart.com/getting_started:adding_links_and_forms#session_attributes

    As for displaying them on the checkout page, you can do that with some JavaScript. Just pull them out of the fc_json JSON object.
  • brettbrett FoxyCart Team
    Also, depending on what you're doing you might want to check out the "pre-populating" functionality or the User API:
    http://wiki.foxycart.com/docs:checkout:prepopulating
    http://wiki.foxycart.com/docs:api
  • tankmantankman Member
    edited March 2009
    Hi Brett and Luke, Thanks for the response.

    Brett, I visited the links you pointed out for other needs I have. I would like to avoid having people create a new membership on foxycart because given the seamless interface to my site, they will get confused about why they have to create a new password.

    The wiki article pointed out that if I add this to my shopping cart form: <input type="hidden" name="shipping_phone" value="." /> then the checkout page would immediately show all fields and not a password field. I went ahead and added this field, however it doesn't seem to work. In fact, the "continue" button doesn't work at all when clicked on.

    Am I doing something wrong? btw: thanks for offering this level of customizability!
  • update:

    the issue with the continue link not working at all also happens when I have this field in the form:

    <input type="hidden" name="customer_email" value="{username}" />

    when I commented out this line, everything works fine again.


    (for my site, username is the email address.)
  • lukeluke FoxyCart Team
    Can you send us an example link where your form is located? You might have something else going on, because it seems to work just fine on our end. You're passing those values to the cart, correct?
  • tankmantankman Member
    edited March 2009
    I'll send you a pm with the URL. I'm using this code:
    <form action="https://mysite.foxycart.com/cart"; class="foxycart" method="post">
    	<input type="hidden" name="name" value="ad credits" />
    	<input type="hidden" name="price" value="39" />
    	<input type="hidden" name="discount_quantity_amount" value="savings per ad {3-3.90|10-9.75|20-13.26}" />
    	<input type="hidden" name="cart" value="checkout" />
    	<input type="hidden" name="empty" value="true" />
            <input type="hidden" name="x:origin" value="la" />
            <input type="hidden" name="h:variable_domainshort" value="data" />
            <input type="hidden" name="x:variable_location" value="la" />
           <input type="hidden" name="customer_email" value="me@me.com" />
           <input type="hidden" name="customer_phone" value="." />
    
    <select name="quantity" class="pulldown">
    <option value="">Buy more ad credits:</option>
    <option value="1">1 ad ($39)</option>
    <option value="2">2 ads ($39 per ad X 2 = $78)</option>
    </select>
    	<input type="submit" value="Purchase" class="submit" />
    </form>
    

    oh. and I'm going directly to the checkout page.
  • lukeluke FoxyCart Team
    What store version are you on? I just tested with your code and it worked perfectly...

    I hate to give you the old "it works for me" response... but... well... it works for me. :)
Sign In or Register to comment.