Possible JS errors on the view order page in my account environment
Closed this issue · 2 comments
- I've verified and I assure that I'm running the latest version of the TIG PostNL Magento extension.
What is the purpose of your issue?
- Bug report (encountered problems with the TIG PostNL Magento extension)
Description of your issue, suggested solution and other information
Viewing of orders in the customers account section can result in JS errors, the module templates try to access elements defined by Magento elements and insert additional DOM content into them. However these elements are retrieved and used without checking if an actual element was found. This check should be added, as the module itself can not guarantee that an element can be found for the following expression $$('div.col2-set div.col-2 div.box-content')[0]
. This PR adds a truthful check around the statement where a call is made on this element, preventing JS errors from occurring in cases where template changes have been made to the Magento templates in such a way that these identifiers have changed.
I've proposed a fix for this in #48, in general this is good practise as well. Check for validity before using the element.
As mentioned in the pull request, thank you for pointing this out! You can expect this to be changed in an upcoming release.
Thanks for the quick update Dennis!