[email protected] Posted November 11, 2016 Share Posted November 11, 2016 Hola, He insertado correctamente el pixel de facebook en prestashop. Ahora quiero añadir el evento purchase en order-confirmation.tpl, pero quiero que el value sea dinámico. No encuentro información fiable sobre el tema. Creo que hay que añadir algo de código también en OrderController.php, para darle un valor a la variable. No sé muy bien como hacerlo, esto es lo que he leído por ahí: En OrderController.php añadir el siguiente código, aunque no se donde: $cart = new Cart((int)($this->id_cart));self::$smarty->assign(array('_order' => $this->id_order,'_value' => $cart->getOrderTotal())); Y luego en order-confirmation.tpl, lo siguiente: <!-- Facebook Pixel Code --> <script>!function(f,b,e,v,n,t,s){if(f.fbq)return;n=f.fbq=function(){n.callMethod?n.callMethod.apply(n,arguments):n.queue.push(arguments)};if(!f._fbq)f._fbq=n;n.push=n;n.loaded=!0;n.version='2.0';n.queue=[];t=b.createElement(e);t.async=!0;t.src=v;s=b.getElementsByTagName(e)[0];s.parentNode.insertBefore(t,s)}(window,document,'script','//connect.facebook.net/en_US/fbevents.js');fbq('init', 'xxxxxxxxxxxxxx');fbq('track', "PageView");fbq('track', 'Purchase', {value: {$_value}, currency: 'EUR'}); </script><noscript><img height="1" width="1" style="display:none"src="https://www.facebook.com/tr?id=1445570592421898&ev=PageView&noscript=1"/></noscript><!-- End Facebook Pixel Code --> Gracias Link to comment Share on other sites More sharing options...
shacker Posted November 12, 2016 Share Posted November 12, 2016 hay un hook llamado displayOrderConfirmation desde ahi puedes obtener los parametros de la cesta con $productsp = $params['cart']->getProducts(true); Link to comment Share on other sites More sharing options...
[email protected] Posted November 15, 2016 Author Share Posted November 15, 2016 Hola, No tengo muchos conocimientos de php y me pierdo En el código de arriba que tengo mal? Así no debería de funcionar? Gracias de nuevo 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