Post by a.nia » Thu Jul 19, 2018 7:57 am

I have added Facebook pixel to header.tpl

I want to add a line of you to the Facebook script when users complete a purchase. Since OpenCart loads same header on all of the pages, I need to somehow find out if the order is completed and success.tpl is loaded, add and extra line to the Facebook pixel.

I have added the following code (used from one other post I saw in the forum) to the header.php:

Code: Select all

if (!empty($this->request->get['route'])) {
    $data['route'] = $this->request->get['route'];
} else {
    $data['route'] = '';
and then I have modified the Facebook pixel added to the header.tpl. So, I have added below code in the middle of the Facebook script in the header.tpl. Theoretically, the tracking line should be loaded on the success page, but nothing happens:

Code: Select all

<?php if (!empty($route) && $route == 'checkout/success') { ?>
    //  The extra line has been added here

<?php } ?>
I will be deeply delighted if someone can help on this ASAP.




Thu Jul 19, 2018 7:27 am
Who is online

Users browsing this forum: No registered users and 53 guests