Jump to content
thirty bees forum
  • 0

tool.js error


Naldinho

Question

I have a shop that has had issues with the ability to add products to cart -- the issue seems to be limited to Chrome and is intermittent which makes no sense to me. I was hoping someone with more knowledge could help.

The shop is now running on TB 1.3 but the problem existed before that so it is not because of upgrading to 1.3.

The theme is the old default theme from PrestaShop 1.6 as that was what the store was running before migration.

In developer tools I see the following error
 

tools.js:105 Uncaught TypeError: Cannot read properties of undefined (reading 'CAD')

    at displayPrice (tools.js:105)

    at formatCurrency (tools.js:83)

    at writeDiscountsContent (196-custom-tabs-set-of-5.html:592)

    at HTMLDocument.<anonymous> (196-custom-tabs-set-of-5.html:676)

    at j (jquery-1.11.0.min.js:2)

    at Object.fireWith [as resolveWith] (jquery-1.11.0.min.js:2)

    at Function.ready (jquery-1.11.0.min.js:2)

    at HTMLDocument.K (jquery-1.11.0.min.js:2)


The store is multicurrency with CAD being the default currency.

I'm really at a loss on this. Intermittent issues don't make sense to me. 
 

Link to comment
Share on other sites

9 answers to this question

Recommended Posts

  • 0

Intermittent issues like this are most likely caused by some caching mechanism. Do you, by any chance, have some Full Page Cache enabled (tb native or third party module)?

Anyway, there is a small bug in /js/tools.js. Edit this file, and change line 105 from

if (typeof window.currencyFormatters[currency] !== 'undefined' && window.currencyFormatters[currency])

to

if (typeof window['currencyFormatters'] !== 'undefined' && window.currencyFormatters[currency])

 This bug should not cause any issues, because front controller always generates the 'currencyFormatters' global variable. In you case, it does not -- this could be caused by FPC, or maybe some override. 

Link to comment
Share on other sites

  • 0
3 hours ago, datakick said:

Intermittent issues like this are most likely caused by some caching mechanism. Do you, by any chance, have some Full Page Cache enabled (tb native or third party module)?

No cache. I'll try for performance tweaks once everything is working perfectly but I made sure all cache/performance features were set to off.

I do have AttributesWizardPro which is a module that involves a lot of changes to files (at least more than most modules) and that is the only module on the product page that I did disable because it is essential to the store. 

During the first few hours of testing I suspected it was AttributesWizardPro as the issue would only occur on products that used that module. It is hard to know for certain because as I got frustrated my record keeping of when the issue presented became sloppy but I do believe it happened on product pages without AttributesWizardPro but I can't be certain.

In addition to that module I also use a module that displays the discounted prices in the top right also from PrestoChango but wanting to eliminate that as a possible source I disabled it and the problem persisted. 

Other things I noticed

  1. It was Chrome only (once in Brave but that is Chrome-based) and I could never get the error to happen in Firefox. That could just be variance but I tested this for ~6 hours and got zero instances in Firefox and it happened around 25-30% of the time in Chrome.
  2. Once it happened it would continue to happen 100% of the time even if I left the site and returned to it. Likewise if it worked it would continue working and not break no matter how many times I went to the site. Launching an incognito window would lead to a new probability of it working or not which would be permanent for that incognito window.
  3. You could tell the Add to Cart button was broken even before testing it because when the problem presented itself the minimum quantities would not be set -- it would say 1 instead of 25. Also if the discount display module was enabled it would also not display. So the error when it happened would kill those processes

Not sure if that sheds any light on what caused the issue. I have made the changes you provided and will test later today. I'm very grateful as this is not something I would have figured out on my own so thank you. 

 

 

Link to comment
Share on other sites

  • 0

The change delayed the issue but did not fix it. 

When you go to a product page now everything is fine but as soon as you change an attribute for the product it reloads the top left of the product page causing the same error as before.

The difference is that now the page is fine when you first arrive 100% of the time and it breaks 100% of the time. It also breaks it in all browsers now.

The issue is limited to products that take advantage of Attribute Wizard Pro but the store requires that module. 

Link to comment
Share on other sites

  • 0
6 hours ago, datakick said:

@Naldinho please post your store url

This is a page with a product that uses Attribute Wizard Pro

https://thetabdepartment.com/black-and-white-custom-tabs/7-custom-tabs-set-of-8.html#/stock-90lb_index_stock/sides_printed-front_and_back/spine_reinforcement-reinforced/drilled-3_hole_punched/collated-collated/turnaround-3_business_days_standard/paper_size2-letter_8_5_x_11/orientation_2-long_edge/mylar2-clear_mylar/portrait_or_landscape-portrait_binding_on_left_tabs_to_the_right_tabs_start_from_top

I now believe the issue is that combination.json.php from that module as I can see a ERR_EMPTY_RESPONSE when using developer tools. I've contacted the developer and am waiting to hear back but if you happen to have any suggestions it would be greatly appreciated


 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...