Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Tom Steer 161 posts 596 karma points
    Jan 06, 2015 @ 18:29
    Tom Steer
    0

    Tea Commerce JS Conflict

    Hey TC,

    I've got an issue with the teacommerce.min.js file by where it seems to conflict with some other js on the site. When I take out the TC file the other JavaScript works perfectly. Is it possible to get a non minified version of it to see where the issue is :)

    Thanks,

    Tom

  • Dennis Aaen 4499 posts 18254 karma points admin hq c-trib
    Jan 06, 2015 @ 19:05
    Dennis Aaen
    100

    Hi Tom,

    If you have a minified version of a Javascript file, then you can use a service like the http://jsbeautifier.org/ to make a non minified version, that make it easier for you to find the issue.

    You can also find the source code for the Tea Commerce here on github: https://github.com/TeaCommerce/Tea-Commerce-for-Umbraco and the starter kit here: https://github.com/TeaCommerce/Starter-kit-for-Umbraco

    Hope this helps,

    /Dennis

     

  • Tom Steer 161 posts 596 karma points
    Jan 06, 2015 @ 21:06
    Tom Steer
    0

    Hey Dennis,

    Thanks for the tip about jsbeautfier :) will defiantly use that in the future!

    I ended up finding the file on the github link you gave: https://github.com/TeaCommerce/Tea-Commerce-for-Umbraco/blob/master/Source/Lib/Tea%20Commerce/tea-commerce.js Will have a play with it tomorrow and see what's causing the issue :)

    Cheers,

    Tom

  • Dennis Aaen 4499 posts 18254 karma points admin hq c-trib
    Jan 06, 2015 @ 21:11
    Dennis Aaen
    0

    Hi Tom, 

    You´re welcome, happy that I could help you. 

    Looking forward to hear from you, about what causing the issue

    /Dennis

  • Anders Burla 2560 posts 8256 karma points
    Jan 07, 2015 @ 08:25
    Anders Burla
    0

    Hi Tom

    First - @Dennis - great help!

    @Tom if/when you find the issue just let me know and we will fix it. Are you running latest Tea Commerce v3? I know that we changed a bit in the v3 javascript because of an issue that sounds like yours.

    Kind regards
    Anders

  • Tom Steer 161 posts 596 karma points
    Jan 07, 2015 @ 11:16
    Tom Steer
    0

    Hello,

    I've managed to find the issue now. Basically what is happening is; Because in the tea commerce file it extends the Array object with the contains method (Array.prototype.contains), when iterating an array using for-in (as they do in the one js library i'm using) it actually also enumerate the contains property. Which in turn was breaking the library. I'm going to try go through the library i'm using and change all for-in loops to use for instead and see if that works.

    Cheers,

    Tom

  • Tom Steer 161 posts 596 karma points
    Jan 07, 2015 @ 11:37
    Tom Steer
    0

    Actually I'm going to edit the source tea commerce js file to change the contains to a util on TCService rather than extending the Array object, as the for-in loop features alot in the js library i'm using  :( lol

  • Anders Burla 2560 posts 8256 karma points
    Jan 07, 2015 @ 13:11
    Anders Burla
    0

    Hi Tom

    It would be amazing if you could make the method as a util method that just gets the array as a parameter. AND then made a pull request :)

    Kind regards
    Anders

  • Tom Steer 161 posts 596 karma points
    Jan 07, 2015 @ 13:53
    Tom Steer
    0

    Hey Anders,

    Just done that :) Hopefully it is right, if not let me know what to change.

    Thanks,

    Tom

Please Sign in or register to post replies

Write your reply to:

Draft