denincikas Posted September 10, 2021 Share Posted September 10, 2021 Hello I have created a simple HTML/JS calculator and integrated through .tpl files on product page. The problem is that when querySelector selects the option in variations, the product price dosen't change, but if i manually click with mouse on option the price does change. So my questions is how could i refresh the price after the variation is selected through querySelector. Any help would be greatly appreciated because iv been stuck on this part for like 2 weeks now. Thanks. Link to comment Share on other sites More sharing options...
endriu107 Posted September 10, 2021 Share Posted September 10, 2021 I think you need add events https://devdocs.prestashop.com/1.7/themes/reference/javascript-events/#dispatched-events in this case probably on updatedProduct. 1 Link to comment Share on other sites More sharing options...
denincikas Posted September 24, 2021 Author Share Posted September 24, 2021 On 9/10/2021 at 4:40 PM, endriu107 said: I think you need add events https://devdocs.prestashop.com/1.7/themes/reference/javascript-events/#dispatched-events in this case probably on updatedProduct. Thank you very much! I just put this code after querySelector: if(a > 2007 && a < 2034 && p > 670 && p < 771 && k == "krypkair"){ document.querySelector("#group_17 option[value='69']").selected = true; prestashop.emit('updateProduct', { reason: event.currentTarget.dataset }); } And now it updates price, thanks again! Link to comment Share on other sites More sharing options...
endriu107 Posted September 24, 2021 Share Posted September 24, 2021 I'm happy you solve problem Cheers Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now