How exactly do you prepopulate?

salsal Member
in Help edited January 2008
I've looked at it a couple of times but can't figure this out. It looks like there's a couple of ways to do this but I'm looking for the non-query-string method. What I'd like to pre-populate is the State FIeld but apparently anything not a US state doesn't work. Would this be because the Country needs to be set to New Zealand first? Would prepopulating Country wih New Zealand force a "Region" field replacing the "State" because that's what we use in NZ.

Thanks in advance.
Comments
  • lukeluke FoxyCart Team
    edited January 2008
    Yes, you're correct. If you pre-populate the country_code and country_name fields, you should be ok to set the state_code and state_name fields. State is the same thing as province or region.

    For a non-query string method, do you mean you have a form? If so, just add hidden inputs like so:
    <input type="hidden" name="customer_country" value="NZ">
    <input type="hidden" name="customer_state" value="my region name">
    

    Please let us know if you run into any trouble.
  • salsal Member
    edited January 2008
    Hmm, the way I'm passing the info is URL, so this would mean I'd need to place it as a query string parameter per item. I suppose switching to form based "Add to cart" buttons wouldn't be too much trouble.

    Also, just to be clear, these key names you used here are different than the ones used in the wiki. Are they old or just version dependant? I'm on an old version (v2.9 :/) just until I have the time to update the templates to work with the new class and ID names.
  • lukeluke FoxyCart Team
    Ahh crap... no, I'm just an idiot. That's what I get for posting after 1 in the morning... i'll edit my post, sorry about that.

    If you're passing things through the URL... then you're using a query string, right? And yes, it would have to be a query string per item like so:
    cart.php?name=product&price=10&customer_country=NZ&customer_state=My%20Region
    
    
  • rthrashrthrash Member
    edited January 2008
    I'm also trying to prepopulate by passing in the full account info including the email address. However I'm always getting an error even with an email stating to "enter your email address" and always having a continue button. Does anyone see a similar error?

    For what it's worth, the titles on prepopulated logins don't exactly work without being forced into using graphical headers. If you're bypassing the login, then "Login or Register" doesn't make a lot of sense I don't think.

    I'm doing this by the following example:
    https://xxx.foxycart.com/cart?name=G.E. Profile Wine Captain Cooler&amp;code=18060043&amp;price=166330&amp;customer_first_name=Ryan&amp;customer_last_name=Thrash&amp;customer_email=ryan+test2@collabpad.com&amp;customer_address1=6157 Berwyn Ln&amp;customer_city=Dallas&amp;customer_state=TX&amp;customer_postal_code=75214&amp;customer_country=United States&amp;customer_phone=214-682-5050
    

    For what it's worth, removing the %2b from the email seems to make no difference (html entity used for testing in conjunction with gmail mail for adding a "+testIDhere" info).
  • lukeluke FoxyCart Team
    Ryan:

    "I'm always getting an error even with an email stating to "enter your email address" and always having a continue button. Does anyone see a similar error?"

    I'm sorry, I'm a little confused. When I used the link above and put in my own subdomain, it worked just fine (in Firefox). What is the exact error you're getting? What browser are you using?
  • Luke(/Ryan):
    I was getting that error when I included the foxycart js on the checkout page, maybe that could be hindering your login.
  • lukeluke FoxyCart Team
    Yeah, that can definitely cause problems... You should go into your checkout/cart templates and remove that file. Maybe we'll do that automatically for people since most people use a standard header and footer for all of their website.

    Would that be helpful if we just look for foxycart_includes.js and strip it out?
  • Definitely!
  • Hmm ... I don't have the foxycart.js on the checkout page. Then again, I'm very special when it comes to breaking things. :P
  • lukeluke FoxyCart Team
    thrash: do you see any javascript errors when you load your checkout page? You may have another library that is fouling up js which fires off before foxycart can setup your page as needed for a pre-populate. I you do have an error, please post it here and let us know what js library/file caused the problem.

    Thanks!
Sign In or Register to comment.