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.

How do I reload the JSON variables programmatically?

I am trying to shave some time off the need to make changes locally on my computer, upload them to a publicly accessible location online, cache the uploaded changes, etc.. (I decided not to try and do this through the API).

Toward that end I have copied the source code of the checkout page and am working from that copy to make mostly CSS changes more quickly.

Problem is that such code includes all the JSON variables at the time I copied the source code.

If I make a change to variable values through the FoxyCart admin interface, obviously those changed values won't be included in the JSON values in my copied source code.

If I change the JSON values inside the source code described above, the new values from the FoxyCart admin interface, still don't make it in as something in the code continues to pull the values from FoxyCart.

Short of copying the source over and over again whenever I make changes to the JSON values (doable but a bit of a pain in that I must then also redo the changes to the code that allow me to work on the page locally)...is there some way to programatically pull in the latest JSON values from FoxyCart?

Such that I can pull those values in and continue working on a local copy of the checkout page?

Any tips on this would be appreciated.

Thanks.

Carlos

Comments
  • fc_adamfc_adam FoxyCart Team
    @carlos123,

    Good question. Maybe try running FC.client.requestConfig() on the page. That will request the latest store configuration and merge it into the JSON.

    Which particular values are you referring to though?
  • I'll try that Adam.

    My question was based on trying to change the shipping_address1 and shipping_address2 JSON variables from "Address 1" and "Address 2" to "Address line 1" and "Address line 2 (if needed)".

    But it also had to do with how to work with the JSON locally (i.e. using a local copy of the checkout) where the admin interface changes in JSON related variables would be pulled in and applied.

    Carlos
  • Adam,

    Is there a corresponding function to pull in the store settings (as opposed to the store JSON related variables)? I mean as in the section of the code that starts out as...


    <script type="text/javascript" charset="utf-8">
    /* <![CDATA[ */
    FC = FC || {};

    // ** SETTINGS ** //
    FC.settings = {"storedomain":"...
    </script>


    Carlos


  • carlos123carlos123 Member
    edited July 2015
    Adam,

    The FC.client.requestConfig() doesn't appear to be working. Some things like the little flags in the country drop down list are missing.

    I am calling it like so in the place where the JSON variables would normally be in the code for the checkout page.


    <script type="text/javascript" charset="utf-8">
    FC.client.requestConfig();
    </script>


    Is that the way to call this?

    This isn't a huge deal or anything. I am just trying to figure out ways to allow me to work more efficiently when making changes locally. Being able to pull in admin values and settings will allow me to work off a more "live" checkout page which will make changes to templates easier to make since I won't have to go the usual upload changes, automagic cache, and so on as often.

    Carlos
  • Adam,

    I decided to just make copies of the JSON and the store settings when I make changes to allow me to have the latest changes in my development copy of the checkout page. That's easier than trying to figure this out :).

    I am including them like so...


    <script src="fc-json.js" type="text/javascript" charset="utf-8"></script>
    <script src="fc-settings.js" type="text/javascript" charset="utf-8"></script>


    The fc-json.js and fc-settings.js are just local files that hold the current JSON and store settings as copied from the current "live" checkout page source code.

    A bit inconvenient but...it works and is good enough.

    Carlos
  • fc_adamfc_adam FoxyCart Team
    @carlos123,

    Glad you were able to find a solution here.
Sign In or Register to comment.