Szed Posted November 13, 2013 Share Posted November 13, 2013 (edited) Hi ! I would like to be able to, in a module, call $cart->getSummaryDetails() (with ajax) and do some other javascript after my cart was saving or updating. I use hookActionCartSave but i can't use a .tpl with it, so no javascript. Anybody have an idea ? Thanks ! Edited November 13, 2013 by Szed (see edit history) Link to comment Share on other sites More sharing options...
NemoPS Posted November 13, 2013 Share Posted November 13, 2013 What about echoing out the javascript from the function you are hooking? It should run that way! Link to comment Share on other sites More sharing options...
Szed Posted November 13, 2013 Author Share Posted November 13, 2013 I'm tried public function hookActionCartSave($params){ echo '<script type="text/javascript">console.log(\'test\')</script>'; } But when the hook is call, i got an alert Error (for example when i add a product to my card : impossibe to add to cart / text status : parse error / responseText : unexpectable token <' / [...] :/ Link to comment Share on other sites More sharing options...
ExpressTech Posted November 14, 2013 Share Posted November 14, 2013 You might need to hook in the javascript part (by hooking to onclick on add to cart, for example). The PHP hook will run on server and might not give you the desired results. Link to comment Share on other sites More sharing options...
Szed Posted November 14, 2013 Author Share Posted November 14, 2013 Yeah, i tried that finally. But there is a lot of button/action who update the cart (add to cart, update quantity, change carrier, delete product, bloc cart...). So, a hook which is call after each action on the cart, with a template, will be a better solution, but i did'nt find one 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