Jump to content

Affiliate Tracking Code


Recommended Posts

Hello,

 

I am trying to add affiliate tracking code to my client's installation and I have seen a few solutions but the code they say to find does not match what I am looking at, I'm guessing my client's is older.  I can not find a version number in the code but it does say 'copyright 2007-2012 PrestaShop' so I guess this is from 2012?

 

Can anyone help with what I need to add to OrderConfirmationController.php?  I see this in function process:

 

        self::$smarty->assign(array(
            'is_guest' => self::$cookie->is_guest,
            'HOOK_ORDER_CONFIRMATION' => Hook::orderConfirmation((int)($this->id_order)),
            'HOOK_PAYMENT_RETURN' => Hook::paymentReturn((int)($this->id_order), (int)($this->id_module))
        ));

 

There is also this:

 

        if (self::$cookie->is_guest)
        {
            self::$smarty->assign(array(
                'id_order' => $this->id_order,
                'id_order_formatted' => sprintf('#%06d', $this->id_order)
            ));
            /* If guest we clear the cookie for security reason */
            self::$cookie->mylogout();
        }
 

which looks more like what I want but I don't want to add it if they are only a guest, I want it for all.

 

So I guess I add those variables from if guest to the top one, but I also need total order - what would this variable be?  I see if $order->payment != $module->displayName which looks like a text comparison so I don't want that - is there an $order->total_products?

 

Any help greatly appreciated.  This is my first time working with Prestashop.

 

Cybril
 

Link to comment
Share on other sites

This should work

 

 

 self::$smarty->assign(array(

            'id_order' => $this->id_order,
            'id_order_formatted' => sprintf('#%06d', $this->id_order),
            'is_guest' => self::$cookie->is_guest,
            'HOOK_ORDER_CONFIRMATION' => Hook::orderConfirmation((int)($this->id_order)),
            'HOOK_PAYMENT_RETURN' => Hook::paymentReturn((int)($this->id_order), (int)($this->id_module))
        ));

 

 

But what is your presta version? cause 1.6 looks like

 

 

$this->context->smarty->assign(array(

'is_guest' => $this->context->customer->is_guest,
'HOOK_ORDER_CONFIRMATION' => $this->displayOrderConfirmation(),
'HOOK_PAYMENT_RETURN' => $this->displayPaymentReturn()
));
Link to comment
Share on other sites

Thank you, this is what I ended up doing yesterday:

 

        self::$smarty->assign(array(
            'is_guest' => self::$cookie->is_guest,
            'HOOK_ORDER_CONFIRMATION' => Hook::orderConfirmation((int)($this->id_order)),
            'HOOK_PAYMENT_RETURN' => Hook::paymentReturn((int)($this->id_order), (int)($this->id_module)),
            'id_order' => $this->id_order,
            'id_order_formatted' => sprintf('#%06d', $this->id_order),
'total_products'=>$this->total_products
        ));
        
        if (self::$cookie->is_guest)
        {
            //self::$smarty->assign(array(
                //'id_order' => $this->id_order,
                //'id_order_formatted' => sprintf('#%06d', $this->id_order)
            //));
            /* If guest we clear the cookie for security reason */
            self::$cookie->mylogout();
        }

 

Can you confirm total_products variable will work?  I don't know the version, I can not find it anywhere in the code.

Link to comment
Share on other sites

Perhaps you could tell me what will work rather than just saying 'definitely not' and 'it will never work of course', I asked in my first post what the total order variable was and also said this was my first time with Prestashop, so a bit more help would be appreciated, being a 'Prestashop Superstar' and all.

Link to comment
Share on other sites

Yes I just posted direct the script tag.  There is no compilation error, it's just not showing up, but the strange thing is some of the id's and classes in the output I see on the page do not match the code I see in the template file, it's like it's a completely different file (which would certainly be the reason I'm not seeing the script tag show up) but I can't see where else I should be putting it - there is only one folder (prestashop) under themes.  Maybe I'll try the cdata block and see how I go, thanks.

Link to comment
Share on other sites

The test here didn't work and I didn't find an option in admin (finally got access) to force a compile - I have found out we have Version: 1.4.8.2 - I am now browsing through admin to see if I can add via there - I see back office -> modules -> positions - would I do it in there somewhere?

Link to comment
Share on other sites

×
×
  • Create New...