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.

Use Different Addresses but with propogated values?

dogfishentdogfishent Member
in Help edited July 2013
Greetings,
I am wondering if someone can help me with an issue I am having with my checkout page.
I am going to be running a guest only checkout page.
When I send the customer to the checkout page, the shipping address is already set in the form.
I have included the following script to allow for the Use Different Addresses to be checked and then the Shipping Information to be visible:
<script type="text/javascript">
if (!jQuery("#use_different_addresses").is(":checked")) {
jQuery("#use_different_addresses").attr("checked", "checked");
FC.checkout.displayShippingAddress(jQuery("#use_different_addresses")[0]);
}
jQuery("#fc_use_different_address").hide();
</script>

Here is where my conundrum comes...
I had an account on FoxyCart already set up.
As soon as the script above runs, it removes the shipping information from the form POST and populates with a shipping address from my account linked to my email.

Is there a way to check the "Use Different Addresses" and show the Shipping Address, but NOT update the Shipping information with any from the profile?

Example is found here.
https://forestofflowers999.foxycart.com/checkout.php?ThisAction=customer_info&fcsid=kdi3do38ucd5o4ukfasbki4041
When the page loads the name of the Shipping address is Nan Britton but should be Melanie Howe as I sent it in the form.

Many thanks.
Tagged:
Comments
  • so, I figured it out....
    instead of
    jQuery("#use_different_addresses").attr("checked", "checked");
    I used
    $("#use_different_addresses").prop("checked", true);
    and that seemed to work!
  • fc_adamfc_adam FoxyCart Team
    @dogfishent,

    I'm glad you got the use_different_address issue sorted - did that also sort the overwriting issue when logging in? I have a feeling even if you have that checkbox checked, it will overwrite the information in the shipping address if the customer you login with has an existing shipping address set on their account.
  • dogfishentdogfishent Member
    edited July 2013
    @fc_adam, you may be right. I did the above in conjunction with setting the checkout up as guests only.
    Would that be what allowed me to use a different address even when starting with a preexisting user?

    Alternatively, is there a way to solve this in your thinking?
    This application I am setting up should never allow for the shipping address to be saved.

    Regards.
  • fc_adamfc_adam FoxyCart Team
    @dogfishent,

    If you stick with only guest checkouts, then you won't have any issues. If you're wanting to allow accounts though, you would need to overwrite and change the default javascript on the checkout to stop it prepopulating the shipping address - that would be the only way to do it.
  • @tc_adam,

    How would I go about changing the defaul javascript?
  • fc_adamfc_adam FoxyCart Team
    @dogfishent,

    Probably a big thing to note that I should have noted before - it's not really something we can support ourselves when you start changing how the default javascript works. Also, to be honest, if you're not familiar with javascript at all, I wouldn't suggest doing this yourself. If you're not too familiar with it, we can suggest some developers who might be able to help you achieve that.

    In terms of how it's achieved, it will essentially be a case of opening up the checkout.js file and looking for the function related to logging in a user and duplicating that function in your own javascript and overwriting the function. It's a big function so it's not for the faint hearted.
Sign In or Register to comment.