Hello to everyone,
I have a very queer problem.
I have added an external widget on our product page from a company that gives reviews to products.
We have 2 other widgets from this company (one added as a plugin and the other with the JS directly on a block). Both are working fine.
As this widget needed to be added under the product title we followed these steps to add it to the catalog_product_view.xml file: https://devdocs.magento.com/guides/v2.3/javascript-dev-guide/javascript/custom_js.html
We've tried:
- With the template (phtml file), plus the JS and the require-js file.
- Adding the JS directly in the phtml file.
In bot scenarios we get the same result.
The widget is loaded. Stars appear under the title. But on some products the rating appears (stars are yellow) and on others (which should have) it doesn't.
Can anyone imagen what might be producing this external js not to load corretly on some products and load on others??? It has me completely puzzled.
No alerts on the console. No errors on the server.
AND if we add that same code in a static html page in the pub folder, with the id of the product, it works ALWAYS. So it is something with the code in the phtml which makes it work for some products and not for others....
Any clues???
Solved! Go to Solution.
Ok, strangely enough we've removed 2 spaces from a php part of the code and added
type="text/javascript" to the script part (which we always do but I don't know why we left it out), and now it's working for all products.
The strange part was that it worked for some and not others......
I close this post and open another because the script now works in Chrome but not in Firefox (so much fun....).
Ok, strangely enough we've removed 2 spaces from a php part of the code and added
type="text/javascript" to the script part (which we always do but I don't know why we left it out), and now it's working for all products.
The strange part was that it worked for some and not others......
I close this post and open another because the script now works in Chrome but not in Firefox (so much fun....).