yireo / Yireo_GoogleTagManager2

Open Software License 3.0
147 stars 76 forks source link

JS Error - Cannot read properties of undefined (reading 'match') on product list pages. #183

Closed TomJ1588 closed 1 year ago

TomJ1588 commented 1 year ago

If you load up a listing page - category or search result. Then click on a product. Your throwing out Cannot read properties of undefined (reading 'match') from:

https://github.com/yireo/Yireo_GoogleTagManager2/blob/652669c975a0ecac65e8cac92f5e55685c880dd0/view/frontend/web/js/product/clicks.js#L9

Your looking for closest [id^=product_iteminfo] - when in default magento this is:

app/code/Magento/Catalog/view/frontend/templates/product/list.phtml

https://github.com/magento/magento2/blob/0a834cce01c3d924d450c9a71123d9ac6de68b62/app/code/Magento/Catalog/view/frontend/templates/product/list.phtml#L53C4-L53C4

product-item-info_

jissereitsma commented 1 year ago

Thanks for pointing this out. Did you know by the way that instead of creating an Issue, with the same amount of time, you could have just edited the right file here on GitHub and created a Pull Request instead? It would allow you to refer to the diff syntax (like this: https://github.com/yireo/Yireo_GoogleTagManager2/commit/224da4680e820b3456be5e88fe2d07cf5afb8909) and would have added your name to the CHANGELOG. Anyway, thanks for spotting this, this will be included in the next release.

TomJ1588 commented 1 year ago

I do know. I did fork, fix but didn't get to test it until this morning, if I'd have tested it yesterday I would have just sent the PR. But did test on 2.4.6 luma theme and a couple other themes I have. Fixed the JS error for me.

jissereitsma commented 1 year ago

Good to hear. I released now 3.5.8 with this fix.