v2.0.6 vs v2.0.9?

Hi there.
I finally have my cart functioning as I want it to, but noticed that the shipping clips I used say v2.0.6 (in the footer of my cart config).
I know the most current is v2.0.9. Should I just change the number in the footer, or is it ok as it is?
It took me a long time to configure the cart exactly like I want, so I am scared to mess with anything.
Please let me know ASAP.
thx in advance!
-m
Comments
  • brettbrett FoxyCart Team
    Hi @purpleontime.
    @fc_adam would be the one to get you a response there. He'll chime in as soon as he's able. Without looking at it, my hunch is that it'd be minor bug fixes so you'd be ok, but @fc_adam will be able to get you a solid answer.
  • fc_adamfc_adam FoxyCart Team
    @purpleontime,

    If you're able to - I'd recommend updating the snippet to use the most recent version from the wiki. Each version number change does represent a change to the code itself, so just changing the number on your existing template isn't the same thing.

    You should be fine to still use the exact same custom shipping logic - but if you grab the latest version from the wiki then you'll have all the recent changes too.
  • when you say "the wiki" there are all kinds of versions on there. link?
    Even a link you gave me on another thread was for an old version. It would really be nice if you guys had this stuff laid out in a more organized way. Not trying to be a jerk, but this whole process of looking in the help, trying to search the forum which doesn't really work, then getting outdated pages is very messy. I can't imagine it'd be that hard to have a more centralized and organized way to go about it.
    For example, Adam, this is directly from a link you posted on my other forum question. You'll notice that it says v2.0.6. I have no idea why, but that is what you sent me to.
    You will see that link in my other post "Home stretch, please help"

    {% if context == 'cart' or context == 'checkout' %}
    <script type="text/javascript" charset="utf-8">
    (function (FC, $) {
    FC.customFlatRates = {};
    FC.customFlatRates.shipping_results = [];

    FC.customFlatRates.config = {
    'autoSelect': false /* Set to true if you'd like the top shipping option to be automatically selected for the user */
    };

    FC.customFlatRates.logic = function(address) {
    /* BEGIN CUSTOM SHIPPING LOGIC */

    if (address.country == "US") {
    FC.customFlatRates.add(1, 4.99, 'USPS', 'Priority');
    } else {
    FC.customFlatRates.add(2, 34.99, 'USPS', 'Priority International');
    }

    /* END CUSTOM SHIPPING LOGIC */
    };

    /* Flat Rate Shipping Modification Logic v2.0.6 */
    FC.customFlatRates.add=function(a,b,d,c){FC.customFlatRates.shipping_results.push({method:d,price:b,service_id:a,service_name:c})};FC.customFlatRates.hide=function(a){a=FC.customFlatRates.filterShippingOptions(a);for(var b=0;b<a.length;b++)FC.customFlatRates.shipping_results[a[b]].hide=!0};FC.customFlatRates.show=function(a){a=FC.customFlatRates.filterShippingOptions(a);for(var b=0;b<a.length;b++)FC.customFlatRates.shipping_results[a[b]].hide=!1};
    FC.customFlatRates.remove=function(a){a=FC.customFlatRates.filterShippingOptions(a);a=a.sort(function(a,b){return b-a});for(var b=a.length-1;0<=b;b--)FC.customFlatRates.shipping_results.splice(a[b],1)};
    FC.customFlatRates.update=function(a,b,d,c){a=FC.customFlatRates.filterShippingOptions(a);for(var e=0;e<a.length;e++){if("number"===typeof b||"string"===typeof b&&""!==b){var f=FC.customFlatRates.modifyPrice(FC.customFlatRates.shipping_results[a[e]].price,b);FC.customFlatRates.shipping_results[a[e]].price=f}"string"===typeof d&&(FC.customFlatRates.shipping_results[a[e]].method=d);"string"===typeof c&&(FC.customFlatRates.shipping_results[a[e]].service_name=c)}};
    FC.customFlatRates.reset=function(){FC.customFlatRates.shipping_results=[];FC.customFlatRates.error_message=!1};FC.customFlatRates.error=function(a){FC.customFlatRates.error_message=a};
    FC.api.getShippingOptions=function(a){var b={address_name:a.address_name,state:a.region,country:a.country,city:a.city,postal_code:a.postal_code};FC.customFlatRates.reset();FC.customFlatRates.logic(b);for(b=FC.customFlatRates.shipping_results.length-1;0<=b;b--)FC.customFlatRates.shipping_results[b].hide&&FC.customFlatRates.shipping_results.splice(b,1);if(FC.customFlatRates.config.autoSelect&&0==a.shipping_service_id||1==FC.customFlatRates.shipping_results.length){if(FC.json.has_multiship)for(b=0;b<
    FC.json.multiship_data.length;b++)FC.json.multiship_data[b].address_name==a.address_name&&(FC.json.multiship_data[b].shipping_service_id=FC.customFlatRates.shipping_results[0].service_id,FC.json.multiship_data[b].shipping_service_description=FC.customFlatRates.shipping_results[0].method+" "+FC.customFlatRates.shipping_results[0].service_name);else FC.json.shipping_address.shipping_service_id=FC.customFlatRates.shipping_results[0].service_id,FC.json.shipping_address.shipping_service_description=FC.customFlatRates.shipping_results[0].method+
    " "+FC.customFlatRates.shipping_results[0].service_name;FC.json.show_shipping_tbd=!1}return $.Deferred(function(a){setTimeout(function(){FC.customFlatRates.error_message?a.reject(Error(FC.customFlatRates.error_message)):a.resolve({ok:!0,data:{shipping_results:FC.customFlatRates.shipping_results}})},10)})};
    FC.customFlatRates.filterShippingOptions=function(a){if("number"==typeof a)for(var b=0;b<FC.customFlatRates.shipping_results.length;b++){if(FC.customFlatRates.shipping_results[b].service_id==a)return[b]}else{if("string"==typeof a){for(var d=[],c={},b=0;b<FC.customFlatRates.shipping_results.length;b++){var e=FC.customFlatRates.shipping_results[b];c[b]=e.method+" "+e.service_name}if("all"!=a.toLowerCase()){a=/(fedex|usps|ups)?\s?([\w\s]+)?/i.exec(a);if(void 0==a||""==a)return;for(b in c)void 0!=a[1]&&
    ""!=a[1]&&-1==c[b].toLowerCase().indexOf(a[1].toLowerCase())?delete c[b]:void 0!=a[2]&&""!=a[2]&&-1==c[b].toLowerCase().indexOf(a[2].toLowerCase())&&delete c[b]}for(b in c)d.push(parseInt(b));return d}if("object"==typeof a){d=[];for(b=0;b<a.length;b++)for(c=0;c<FC.customFlatRates.shipping_results.length;c++)FC.customFlatRates.shipping_results[c].service_id==a[b]&&d.push(a[b]);return d}}};
    FC.customFlatRates.modifyPrice=function(a,b){b=b.toString();var d=/([\+\-\=\*\/])?(\d+(?:\.\d+)?)(\%)?/.exec(b);a=parseFloat(a);var c=parseFloat(d[2]);void 0!=d[3]&&""!=d[3]&&(c=c/100*a);switch(void 0==d[1]&&""!=d[1]?"=":d[1]){case "+":a+=c;break;case "-":a-=c;break;case "/":a/=c;break;case "*":a*=c;break;default:a=c}return 0>a?0:a};
    function requireShipping(){if(!FC.json.shipping_address.has_live_rate_shippable_products){if(FC.json.has_multiship)for(i=0;i<FC.json.multiship_data.length;i++)FC.json.multiship_data[i].has_live_rate_shippable_products=!0,0==FC.json.multiship_data[i].shipping_service_id&&(FC.json.show_address_entry=!0,"cart"==FC.json.context&&(FC.json.show_shipping_tbd=!0));FC.json.shipping_address.has_live_rate_shippable_products=!0;FC.json.has_current_live_rate_shipping=!0;FC.json.has_current_flat_rate_shipping=
    !1;0==FC.json.shipping_address.shipping_service_id&&(FC.json.show_address_entry=!0,FC.json.show_shipping_tbd=!0);FC.Template(FC.json.context).clearOutput();FC[FC.json.context].render();$.each(FC.json.has_multiship?FC.json.multiship_data:[FC.json.shipping_address],function(a,b){FC.util.addressHasLocationInfo(b)&&0==b.shipping_results.length&&b.has_live_rate_shippable_products&&FC[FC.json.context].getShippingOptions({address:b})})}}FC.client.on("cart-item-quantity-update.done",requireShipping);
    FC.client.on("cart-item-remove.done",requireShipping);FC.client.on("cart-coupon-add.done",requireShipping);FC.client.on("cart-coupon-remove.done",requireShipping);FC.client.on("customer-login.done",requireShipping);FC.client.on("checkout-submit",requireShipping);
    {% if cart_is_fullpage or context == 'checkout' %}FC.client.on("ready.done",requireShipping);{% else %}requireShipping();{% endif %}
    })(FC, jQuery);
    </script>
    {% endif %}


  • Just an example of something that could be useful. A library of clips that is clearly organized on your site:

    For example, some sample pages to make things easy...
    Like:

    "If you want two ship options, copy paste this..."
    CODE HERE

    "Ship with various weight options do this..."
    CODE HERE

    More of a copy paste setup, rather than the in depth breakdown on you help and setup pages.

    Perhaps you aren't trying to attract people with less code knowledge, but I see a ton of repeat questions from people that are signed up. I know you aren't ecwid, and don't want to be, but a happy medium between hardcore root coding and a WYSIWYG would be really nice.
    Perhaps a "Code clip library" or something.

    All that to say, can you send me a link to the 100% correct code that I can copy paste that will bring my shop current but not change anything? Not just say "go to the wiki" please.
    And double check the link for me to be sure its correct please?
    Sorry if I come across rude, I don't mean to. Your customer support is great, it has just been a bit frustrating looking back on it. I feel the whole process could have been fixed much sooner if things were a little easier to navigate.
    thx
  • fc_adamfc_adam FoxyCart Team
    edited October 2015
    @purpleontime,

    Sorry if things have been confusing for you.

    We do have our snippets organised on our wiki for what it's worth. You can find snippets for store versions 1.1 and older here: http://wiki.foxycart.com/snippets/start - and snippets for version 2.0 here: http://wiki.foxycart.com/v/2.0/snippets

    Looking back over our previous conversations - you're making use of the Flat Rates snippet - that has just recently changed version number to 2.0.7 from your existing version of 2.0.6. The snippet you saw with the version of 2.0.9 is for the Live Rates snippet - which is not what you need.

    The snippet I sent to you was indeed the most up to date version at that time, but it's since had a small change that pushed it up to version 2.0.7. Having out-dated links is why I prefer to simply point people to the relevant page on the wiki, but as you were having some troubles getting the code set up I provided you with the completed snippet code in the pastie so you could simply copy and paste that in to get up and running.

    The flat rates snippet is always available at this link: https://wiki.foxycart.com/v/2.0/snippets/flat_rate_shipping_modification

    To update your snippet - copy the code that is between the /* BEGIN CUSTOM SHIPPING LOGIC */ and /* END CUSTOM SHIPPING LOGIC */ lines into a text editor on your computer. Then copy the new 2.0.7 javascript from step 2 of the page above to replace what you have set in your FoxyCart store now. Finally, copy the custom shipping logic from your text editor to be between the same tags again within the new 2.0.7 snippet code.

    Again - I'm really sorry that you've found the whole process confusing. Let me know if you have any other questions.
  • sorry. This is another example of a confusing reply.
    you recommend a snippet, then it is already not up to date?
    So now i have to:
    To update your snippet - copy the code that is between the /* BEGIN CUSTOM SHIPPING LOGIC */ and /* END CUSTOM SHIPPING LOGIC */ lines into a text editor on your computer. Then copy the new 2.0.7 javascript from step 2 of the page above to replace what you have set in your FoxyCart store now. Finally, copy the custom shipping logic from your text editor to be between the same tags again within the new 2.0.7 snippet code.
    This is silly.

    Rather than have me jump trough all these hoops for yet another time, can't you just lay all the code out correctly and say: "Copy paste this...", done.
    Instead I have to patch together all these instructions telling me to: copy this, don't copy that, but add this in here, but not there, etc, etc.
    Please just do the snippet in its entirety, and send to me. I have obviously done my part and am trying on my own, but enough is enough.
  • fc_adamfc_adam FoxyCart Team
    @purpleontime,

    I'm happy to. I was trying to prevent another instance where I provided the code to you in its entirety, but when a new version is released in the future - that link becoming irrelevant and out of date.

    The code I provided to you previously for you to copy and paste was up to date at that moment. It was the latest version of the code. The snippet was later altered slightly giving it a new version number for that change. This meant that the code in the link I gave you was technically an old version. Still working fine - but just an old version now. The snippet I'm recommending is still exactly the same - it's just that it had a version change that meant it was newer on the wiki than what is on your store. Snippets don't automatically update.

    Also to clarify, these snippets are customisations that can be applied to your templates - and are not part of the core that are automatically updated for you.

    You can see the complete snippet for your set up to copy here: http://pastie.org/private/bsdngyhyvuvlxyaen8bma. Copy that into the footer text area for the "Add custom header and footer code to your templates" configuration option, replacing the existing code for the flat rate snippets that is present there.

    I'm very sorry that this has been such a confusing experience for you. We do have a rebuild of our shipping functionality as an upcoming feature release, but unfortunately for now shipping customisations need to be approached with these snippets.
Sign In or Register to comment.