gusman126 Posted March 2, 2020 Share Posted March 2, 2020 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? 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>"; } Link to comment Share on other sites More sharing options...
gusman126 Posted March 2, 2020 Author Share Posted March 2, 2020 hace 24 minutos, ndiaga dijo: Hi, Try to use both $id_order = $params['order']->id; and $id_order =Tools::getValue('id_order'); The error is not that you don't read the order id, The error is that not all orders are confirmed, payment gateway screens that do not end, for example Redsys By not confirming order, do not register number, do not send .js Possibility of sending .js with hook action? 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