gusman126 Posted March 2, 2020 Share Posted March 2, 2020 (edited) Hi, I have a problem with this hook I read the order and send the data by javascript code To ensure I keep a .log file with the IDs of the orders. The problem is that I am missing order IDs, I do not read all orders and all are confirmed, payment methods Paypal and Redsys I tried using the hookactiovalidateorder This one does read all the IDs, but I can't send javascript code I see that it is the same problem that Ganalytics has Ganalytics' solution is to add extra code backoffice, The problem is that my client does NOT backoffice at all. Solutions? code : public function hookDisplayOrderConfirmation($params) { /* Place your code here. */ $id_order = $params['order']->id; $logfile = fopen(dirname(__FILE__).'/datos.txt', "a"); fwrite($logfile, $id_order); return "<script type='text/javascript'> dataLayer.push({ 'event': 'transaction', 'ecommerce': { 'purchase': { 'actionField': { 'id': '20651', 'affiliation': 'Online Store', 'revenue': '38.850000', 'tax':'5.89', 'shipping': '4.9', 'coupon': '' }, 'products': [{"name":"Diana Negro","id":"18857","price":33.95,"brand":null,"category":"Sandalias","variant":"19183","quantity":"1"}] } } }); </script>"; } Edited March 2, 2020 by gusman126 (see edit history) 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