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 :)
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.
@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.
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.
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
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
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
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
Hi Tom,
You´re welcome, happy that I could help you.
Looking forward to hear from you, about what causing the issue
/Dennis
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
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
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
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
Hey Anders,
Just done that :) Hopefully it is right, if not let me know what to change.
Thanks,
Tom
is working on a reply...