Integration With The Affiliate Program

Hello, tell me please did you integrate with affiliate programs?
We are currently working with an affiliate program actionpay.net and we can't implement integration with a pixel that captures user action.

There is this code, how correct and it works or not, it must be placed on the last page of the order.
<?php
if (isset($_COOKIE["actionpay"]) && $_COOKIE["utm_source"]=="actionpay"){
echo '<img src="<a data-ipb='nomediaparse' href='https://apypx.com/ok/id.png?actionpay=%27.$_COOKIE%5B'>https://apypx.com/ok/id.png?actionpay='.$_COOKIE["actionpay"].'&apid='.$order_id.'&price='.$total.'"height="1px" width="1px" />';
}
?>
We tried to put it through {literal} in /templates/views/checkout/checkout.tpl
but the when part is displayed on the design page. Just tried to create a separate php file and make it include, the situation is similar.
The pixel was written based on the instructions:
Can please tell me how to put it and check its correctness.
Please tell me how to set the cookie lifetime of 30 days or they are normally active for 30 days.
Thanks for supporting me. We are glad to cooperate with You.

Hello, tell me please did you integrate with affiliate programs?
We are currently working with an affiliate program actionpay.net and we can't implement integration with a pixel that captures user action.

There is this code, how correct and it works or not, it must be placed on the last page of the order.
if (isset($_COOKIE["actionpay"]) && $_COOKIE["utm_source"]=="actionpay"){
echo '';
}
?>
We tried to put it through {literal} in /templates/views/checkout/checkout.tpl
but the when part is displayed on the design page. Just tried to create a separate php file and make it include, the situation is similar.
The pixel was written based on the instructions:
Can please tell me how to put it and check its correctness.
Please tell me how to set the cookie lifetime of 30 days or they are normally active for 30 days.
Thanks for supporting me. We are glad to cooperate with You.

Hello,

You can create app/addons/my_changes/controllers/frontend/checkout.post.php file and add such code:

if ($mode == 'complete') {
    if (isset($_COOKIE["actionpay"]) && $_COOKIE["utm_source"]=="actionpay"){
        echo '';
    }
}

Hello,

You can create app/addons/my_changes/controllers/frontend/checkout.post.php file and add such code:

if ($mode == 'complete') {
    if (isset($_COOKIE["actionpay"]) && $_COOKIE["utm_source"]=="actionpay"){
        echo '';
    }
}

Здравствуйте, спасибо за поддержку!

In the .tpl you can use

{if $smarty.cookie.actionpay && $smarty.cookie.utm_source == 'actionpay'}

{/if}

Do not forget to correct src parameter

In the .tpl you can use

{if $smarty.cookie.actionpay && $smarty.cookie.utm_source == 'actionpay'}

{/if}

Do not forget to correct src parameter

Hello, thanks for the answer.
Please tell me, I found that in the variable $order_info['order_id'] is sent the order number, and in the variable $order_info['total'] the order amount, how to find out whether the promo code was used when ordering or not, in which variable it can be checked.
Thanks for supporting me.

The $order_info.promotions array contains all information about applied promotions

The $order_info.promotions array contains all information about applied promotions

Thanks for the reply, we checked when placing the order we want to display the data:
echo $order_info['order_id'];
echo $order_info['total'];
echo $order_info.promotions;
We want to make a condition if a promotion is used, then one code was executed, if not used, then another. Please tell me how to check it?

The $order_info.promotions array contains all information about applied promotions

Please tell me how to set up cookies for 30 days.

We want to make a condition if a promotion is used, then one code was executed, if not used, then another. Please tell me how to check it?

Check content of the array with the following code

{$order_info.promotions|fn_print_r}

Please tell me how to set up cookies for 30 days.

What is the purpose of new cookie?

Check content of the array with the following code

{$order_info.promotions|fn_print_r}

What is the purpose of new cookie?

Hello, thanks for the answer.
The purpose of the new cookie is to save the user's data, if he / she clicked on the affiliate link and when placing an order, the data from the pixel is transferred to the affiliate program.
Here is pixel:
if (isset($_COOKIE["actionpay"]) && $_COOKIE["utm_source"]=="actionpay"){
echo '';
}
But it does not transmit the necessary data when ordering.
Partners say that cookies should be stored for 30 days. When placing an order, the link of the partner, must be transmitted through the pixel data order number, price, and if promotional codes are used, then another pixel must be used.
Please tell me how to save cookies 30 days. And whether the pixel works correctly.

OK. Please provide us with the code where actionpay cookie is set

OK. Please provide us with the code where actionpay cookie is set

Hello, a link to the cookie instructions.
Thanks for supporting me.

https://docs.google.com/document/d/1UPnSi2cD5ICJt8R9WhQOUoGmQZgwfFu6n_cI2rZT4q0/edit#heading=h.3znysh7

Вы выполнили пункт "Сохранение значений параметров url в cookie"?

Если да, то можно использовать хук на целевой странице заказа

design/themes/TEMA/templates/views/checkout/complete.tpl

и показывать пиксель с помощью smarty

{if $smarty.cookies.actionpay && $smarty.cookies.utm_source == 'actionpay'}

{/if}

Там же проверяйте и массив promotions

Здравствуйте, спасибо за ответ.

Вы выполнили пункт "Сохранение значений параметров url в cookie"?

Если да, то можно использовать хук на целевой странице заказа

design/themes/TEMA/templates/views/checkout/complete.tpl

и показывать пиксель с помощью smarty

{if $smarty.cookie.actionpay && $smarty.cookie.utm_source == 'actionpay'}

{/if}

Там же проверяйте и массив promotions

Вы выполнили пункт "Сохранение значений параметров url в cookie"?

Нет, подскажите пожалуйста, как это сделать?

design/themes/TEMA/templates/views/checkout/complete.tpl

и показывать пиксель с помощью smarty

Мы вставили данный код куда высказали

Спасибо за вашу поддержку.

После вставки кода в design/themes/TEMA/templates/views/checkout/complete.tpl

Вышла ошибка, после оформления заказ:

Smarty Compiler: Syntax error in template "../design/themes/responsive/templates/views/checkout/complete.tpl" on line 84 "{if $smarty.cookie.actionpay && $smarty.cookie.utm_source == 'actionpay'}" $smarty.cookie is invalid -->

Да, должно быть cookies вместо cookie. Свой пост поправил

Нет, подскажите пожалуйста, как это сделать?

Например, через контроллер init.post.php в модуле. Он будет вызываться при посещении любой страницы витрины

Спасибо за ответ.

Да, должно быть cookies вместо cookie. Свой пост поправил

Например, через контроллер init.post.php в модуле. Он будет вызываться при посещении любой страницы витрины

Мы получается должны поставить код из инструкции: https://docs.google.com/document/d/1UPnSi2cD5ICJt8R9WhQOUoGmQZgwfFu6n_cI2rZT4q0/edit#heading=h.3znysh7

if (isset($_GET["actionpay"])){
         setcookie("actionpay", $_GET["actionpay"], time()+60*60*24*30);
}

в конец файла init.php который находится в корней сайта? Такой файл не нашли init.post.php.
Есть еще такой файл
../app/controllers/backend/init.php

Мы вставили данный код, как вы и сказали, но он не отрабатывает:

../design/themes/responsive/templates/views/checkout/complete.tpl

    {* place any code you wish to display on this page right after the order has been placed *}
    {hook name="checkout:order_confirmation"}
        {if $smarty.cookies.actionpay && $smarty.cookies.utm_source == 'actionpay'}
        
        {/if}
    {/hook}

design/themes/TEMA/templates/views/checkout/complete.tpl

и показывать пиксель с помощью smarty

{if $smarty.cookies.actionpay && $smarty.cookies.utm_source == 'actionpay'}

{/if}

Спасибо за ответ.

Мы получается должны поставить код из инструкции: https://docs.google.com/document/d/1UPnSi2cD5ICJt8R9WhQOUoGmQZgwfFu6n_cI2rZT4q0/edit#heading=h.3znysh7

if (isset($_GET["actionpay"])){
         setcookie("actionpay", $_GET["actionpay"], time()+60*60*24*30);
}

в конец файла init.php который находится в корней сайта? Такой файл не нашли init.post.php.
Есть еще такой файл ../app/controllers/backend/init.php

You can use My changes module and create the following file

app/addons/my_changes/controllers/frontend/init.pre.php

Мы вставили данный код, как вы и сказали, но он не отрабатывает:

../design/themes/responsive/templates/views/checkout/complete.tpl

Right, because cookie is not set in the php file

You can use My changes module and create the following file

app/addons/my_changes/controllers/frontend/checkout.pre.php

Hello, we have inserted a cookie handler, as you said

if (isset($_GET["actionpay"])){
         setcookie("actionpay", $_GET["actionpay"], time()+60*60*24*30);
}

Right, because cookie is not set in the php file

Please tell me where it is necessary to put, or it was about the upper code?
We did but, it still doesn't process.
Please tell me how to solve this problem.