Jump to content

[Solved] Affiliate Tracking Code


Recommended Posts

Hy everyone,

 

I need to configure a tracking code for a affiliate network and i donno were to start. Any help is appreciated :

 

<iframe height='1' width='1' scrolling='no' marginheight='0' marginwidth='0' frameborder='0' src='http://event.2parale.ro/events/salecheck?amount=__ADD_SALE_VALUE__&campaign_unique=d0f344933&confirm=73df4a3cf58938ab&description=__ADD_DESCRIPTION__&transaction_id=__ADD_TRANSACTION_ID__'></iframe>

Edited by Larry Baldwin (see edit history)
Link to comment
Share on other sites

you can use free html box / contentbox module to paste this code in the header section (or in other places too)

you can paste this code to the template .tpl files

 

 

btw. what is

__ADD_SALE_VALUE__

__ADD_DESCRIPTION__

 

 

?

Link to comment
Share on other sites

I am going to paste the explanation from the affiliate network :

 

  • Replace ADD_SALE_VALUE with total value of the sale
  • Replace ADD_TRANSACTION_ID with a unique id of the order
  • Replace ADD_DESCRIPTION with a informative description of sale (eg. product_nameXquantity ) (Important: must be URL encoded.)

Link to comment
Share on other sites

I donno what are the variables for sale value , transaction id, and the other. How to call them so the affiliate network to get all they need.

 

I need to send them the info so they can track the sales made trought the affiliate network.

I

 

I guess. Maybe on order-confirmation

Link to comment
Share on other sites

okay, so let's do the show ;-)

 

 

open the file:

controllers/front/OrderConfirmationController.php

 

 

you've got there:

$this->setTemplate(_PS_THEME_DIR_.'order-confirmation.tpl');

 

right before this code, paste this one:

 

    $order = new Order($this->id_order);
    $cart = new Cart($order->id_cart);
    $description="";
    foreach ($cart->getProducts() AS $k=>$v){
	    $description.=$v['name']."X".$v['quantity'];
    }	   
    $description=urlencode($description);

    $this->context->smarty->assign(array(
    'total_to_pay'=>$order->getOrdersTotalPaid(),
    'description'=>$description
    ));

 

then in order-confirmation.tpl use:

 

{$total_to_pay} instead the __ADD_SALE_VALUE__

{$description} instead the __ADD_DESCRIPTION__

 

save changes and try

 

let me know if it works exactly as you expect

 

regards

  • Like 10
Link to comment
Share on other sites

Thanks ! I will try it right now. THX ! Maybe i come back only tomorrow with the answer : the affiliate network needs to test the code , not me - cause the campaign is active only after i confirm that i inserted the code.

 

Vekia - u are a boss ! :) ! THX !

Link to comment
Share on other sites

Just saying : all seems good until now ! No error , piwik still tracking, order is good ( all checked with cleared cookies and cache - incognito mode ) . Max tomorrow i will come back with a feedback so anyone else interested should have this. Thank you again Vekia.

Link to comment
Share on other sites

I have only one problem : they said that i need to give them products without delivery. So the total sale should be total products. In rest is 100% working. Any ideas on that ? Should i change from :

'total_to_pay'=>$order->getOrdersTotalPaid(),

To :

'total_products'=>$order->getOrdersTotalProducts(),

?

 

Link to comment
Share on other sites

Yes. I use it there. Thanks ! :) I don`t think it is outstanding haha .... maybe the prices are :) We are currently thinking about paying a team for a re-design.If u do this type of things ( design/theme customisations ) , please pm me so we can talk about this.

Link to comment
Share on other sites

  • 1 month later...

Hi all, I have same issue with affiliate pixel.

 

BUT MY PROBLEM IS - MY ESHOP RUN ON PRESTASHOP 1.3

and this 1.3 version havent "orderconfirmationcontroller.tpl"

 

In my Prestashop 1.3 with my template I have only this:

1) in root my website: order-confirmation.php

2) and in my prestashop template root-themes-mytheme: order-configuration.tlp

 

MY AFFILIATE PIXEL LOOK THIS:

<iframe height="1" width="1" frameborder="0" scrolling="no" src="https://www.affilweb.com/tags/c?containerTagId=1234&CID=123456&OID=YYYYYY&TYPE=123456&AMOUNT=XXXXXX&CURRENCY=EUR" name="web"></iframe>

 

and i only change XXXXXX for price without delivery and tax

and YYYYYY is order id

 

please anyone help me with this, very thanks.

 

(i tried only this: "copy pixel code" into "root/order-configuration.php"

and in pixel rewrite YYYYYY for {$orderId} and XXXXXX for {$total}

but on this affiliate company write me that pixel send good/ok

but two parametres are YYYYYY and XXXXXX are still look as YYYYYY XXXXXX and not as id and price) :,(

(so I must pixel code copy into root-themes-mytheme-order-configuration.tlp too? Iam beginer in this)

Edited by MPart (see edit history)
Link to comment
Share on other sites

this is my order-configuration.php in root my prestashop:

 

on end i add pixel code but now only sending pixel is good but two parametres are still look as {$orderId} and {$total} and not as order id and price without tax,delivery

 

<?php
/* SSL Management */
$useSSL = true;
include(dirname(__FILE__).'/config/config.inc.php');
include(dirname(__FILE__).'/header.php');
$id_cart = intval(Tools::getValue('id_cart', 0));
$id_module = intval(Tools::getValue('id_module', 0));
$id_order = Order::getOrderByCartId(intval($id_cart));
$secure_key = Tools::getValue('key', false);
if (!$id_order OR !$id_module OR !$secure_key OR empty($secure_key))
Tools::redirect('history.php'.(Tools::isSubmit('slowvalidation') ? '?slowvalidation' : ''));
$order = new Order(intval($id_order));
if (!Validate::isLoadedObject($order) OR $order->id_customer != $cookie->id_customer OR $secure_key != $order->secure_key)
Tools::redirect('history.php');
$module = Module::getInstanceById(intval($id_module));
if ($order->payment != $module->displayName)
Tools::redirect('history.php');
$smarty->assign(array(
'HOOK_ORDER_CONFIRMATION' => Hook::orderConfirmation(intval($id_order)),
'HOOK_PAYMENT_RETURN' => Hook::paymentReturn(intval($id_order), intval($id_module))));

?>
<iframe height="1" width="1" frameborder="0" scrolling="no" src="https://www.affilweb.com/tags/c?containerTagId=1234&CID=123456&OID={$orderId}&TYPE=123456&AMOUNT={$total}&CURRENCY=EUR" name=""web></iframe>

Edited by MPart (see edit history)
Link to comment
Share on other sites

it's because tutorial in this topic is for prestashop 1.5

unfortunately all steps described here will not work in 1.3

 

Oh okay so what i must do now when i have prestashop 1.3?

 

Write pixel only into order-configuration.php in root my prestashop?

Or write into root-order-configuration.php and into root-themes-mytheme: order-configuration.tlp?

I MEAN THAT I WRITE ONLY INTO ORDER-CONFIGURATION.PHP IN ROOT

BUT MAYBE IS THIS MY BAD MEAN.

 

This i have now, all is good pixel is send into affiliatecompany good but only TWO PARAMETRES are still look as {$orderId} and {$total} and not forexample 125364 and forexample 12,99

Edited by MPart (see edit history)
Link to comment
Share on other sites

Oh :D

why you added this to the .php file?

you have to add it to the template .tpl files not to the controllers

 

Oh :D true

so i delete pixel code from root-order-configuration.php

and write into root-themes-mytheme-order-configuration.tlp

right?

 

only please what i must write for YYYYYY and for XXXXXX

when YYYYYY must be order id, and XXXXXX price without tax or delivery please?

Link to comment
Share on other sites

now i have in root-themes-mytheme-order-configuration.tlp this code:

<script type="text/javascript">
<!--
var baseDir = '{$base_dir_ssl}';
-->
</script>
{capture name=path}{l s='Order confirmation'}{/capture}
{include file=$tpl_dir./breadcrumb.tpl}
<div id="primary_block" class="clearfix">
<h2>{l s='Order confirmation'}</h2>
{assign var='current_step' value='payment'}
{include file=$tpl_dir./order-steps.tpl}
{include file=$tpl_dir./errors.tpl}
{$HOOK_ORDER_CONFIRMATION}
{$HOOK_PAYMENT_RETURN}
<br />
<a href="{$base_dir_ssl}history.php" title="{l s='Back to orders'}"><img src="{$img_dir}icon/order.gif" alt="{l s='Back to orders'}" class="icon" /></a>
<a href="{$base_dir_ssl}history.php" title="{l s='Back to orders'}">{l s='Back to orders'}</a></div>

 

so i add before <br/> pixel code with {$orderId} and {$total} is it good now?

<script type="text/javascript">
<!--
var baseDir = '{$base_dir_ssl}';
-->
</script>
{capture name=path}{l s='Order confirmation'}{/capture}
{include file=$tpl_dir./breadcrumb.tpl}
<div id="primary_block" class="clearfix">
<h2>{l s='Order confirmation'}</h2>
{assign var='current_step' value='payment'}
{include file=$tpl_dir./order-steps.tpl}
{include file=$tpl_dir./errors.tpl}
{$HOOK_ORDER_CONFIRMATION}
{$HOOK_PAYMENT_RETURN}
<iframe height="1" width="1" frameborder="0" scrolling="no" src="https://www.affilweb.com/tags/c?containerTagId=1234&CID=123456&OID={$orderId}&TYPE=123456&AMOUNT={$total}&CURRENCY=EUR" name="web"></iframe>
<br />
<a href="{$base_dir_ssl}history.php" title="{l s='Back to orders'}"><img src="{$img_dir}icon/order.gif" alt="{l s='Back to orders'}" class="icon" /></a>
<a href="{$base_dir_ssl}history.php" title="{l s='Back to orders'}">{l s='Back to orders'}</a></div>

Edited by MPart (see edit history)
Link to comment
Share on other sites

you can put this code anywhere you want, the most important thing is fact that it is necessary to put it into the .tpl file

 

Okay thanks for you reply.

 

Only one small question: prestashop code for "product id" and "product price without any tax or deliver"?

Are right this two code: for product id "{$orderId}" and for price without any tax and delivery "{$total}"?

 

i find more variant and now i dont know what is right :D

Edited by MPart (see edit history)
Link to comment
Share on other sites

Hi,

today affiliate company write me that PIXEL is send (it is good)

but now only need fix two parametres productid and price.

 

now i have in order-confirmation.tpl this pixel code:

 

<iframe height="1" width="1" frameborder="0" scrolling="no" src="https://www.affiliateweb.com/tags/c?containerTagId=5446&CID=123456&OID={$orderId}&TYPE=654321&AMOUNT={$total}&CURRENCY=EUR" name="myeshop_sale"></iframe>

 

and affiliate company see this:

 

<iframe height="1" width="1" frameborder="0" scrolling="no" src="https://www.affiliateweb.com/tags/c?containerTagId=5446&CID=123456&OID=&TYPE=654321&AMOUNT=0,00 €&CURRENCY=EUR" name="myeshop_sale"></iframe>

 

please anyone help me with prestashop code for this two parametres product id and product price without delivery and tax.

Edited by MPart (see edit history)
Link to comment
Share on other sites

now i test it

and first code for product id is good works :) $id_order

but second code for price without delivery etw is bad :( $order->total_products

Link to comment
Share on other sites

solution below is for prestashop 1.3

 

 

open order-confirmation.php page

 

change

$smarty->assign(array(
'HOOK_ORDER_CONFIRMATION' => Hook::orderConfirmation(intval($id_order)),
'HOOK_PAYMENT_RETURN' => Hook::paymentReturn(intval($id_order), intval($id_module))));

 

to:

 

$order = new Order($idorder);
$smarty->assign(array(
'order' => $order,
'HOOK_ORDER_CONFIRMATION' => Hook::orderConfirmation(intval($id_order)),
'HOOK_PAYMENT_RETURN' => Hook::paymentReturn(intval($id_order), intval($id_module))));

Link to comment
Share on other sites

open order-confirmation.php page

 

change

$smarty->assign(array(
'HOOK_ORDER_CONFIRMATION' => Hook::orderConfirmation(intval($id_order)),
'HOOK_PAYMENT_RETURN' => Hook::paymentReturn(intval($id_order), intval($id_module))));

 

to:

 

$order = new Order($idorder);
$smarty->assign(array(
'order' => $order,
'HOOK_ORDER_CONFIRMATION' => Hook::orderConfirmation(intval($id_order)),
'HOOK_PAYMENT_RETURN' => Hook::paymentReturn(intval($id_order), intval($id_module))));

 

vekia thanks works.

 

only small question and when will change only code in *.tpl when only price not show

exist any other version code for price? no $order->total_products maybe only $order? or another?

 

(because in my version -> modded only order-confirmation.tpl works good, send pixel, send product id, only price not

..so I think if there is for price only small different code, and I there the whole time write only bad code)

Edited by MPart (see edit history)
Link to comment
Share on other sites

$order is a "object" something like array, you can display all available variables in this object with {$order|print_r}

then you can select variable you want, try it

 

oh i understand, $order is only as array, so how would this looked with price this array please

(i searched here on forum code for array $order with price, but did not find, maybe I was looking wrong :D or it isn't here)

Edited by MPart (see edit history)
Link to comment
Share on other sites

I a little tangled :D so I returned back backup.

 

Now I've just modified the "order-configuration.tpl". I wrote into .tpl pixel code.

Into pixel code I wrote good array for product id "{$id_order}" and now I must only wrote good array for price. is it right that

 

what for price "{$orderTotal}"

Edited by MPart (see edit history)
Link to comment
Share on other sites

have you ever read my messages above? i gave you solution :|

 

yes i understand your message. okay when i edit order-configuration.php too okay but i must write array for price into pixel. sory my english isnt good.

 

sorry whit is outside speech,now i find on this forum this three code what is do?

why i not used simple only one from these three code in my *.tpl and not modded php?

$order->total_products

$order->total_products_wt

$order->total_paid_real

Edited by MPart (see edit history)
Link to comment
Share on other sites

just do not understand why when i edit only *.tpl so id_order works but price not.

is there any explanation? or simply for price i must be edit *.tpl and *.php too.

this is it what i not understand.

 

(when i edit only *.tpl id oder works so why not price? i have for price bade array code or for price i must edit *.php too? there's no way to shows price without edit *.php as product id?)

Edited by MPart (see edit history)
Link to comment
Share on other sites

So you edited the controller .php file. Now in the .tpl file you can use variable {$order} with "subvariables"

 

to use subvariables you have to use them like this $order->total_order etc.

 

to display all available variables in the template put this:

 

{$order|print_r}

 

put there for example at the top of the .tpl file.

 

then refresh your website. You will see all available variables. Select one of them. and use it in format: $order->variable

where variable is a name of variable for example: $order->total_order.

Link to comment
Share on other sites

ok i do this, add code into order-confirmation.php and into order-confirmation.tpl i add pixel

 

into root/order-confirmation.php i replace this :

$smarty->assign(array(

'HOOK_ORDER_CONFIRMATION' => Hook::orderConfirmation(intval($id_order)),

'HOOK_PAYMENT_RETURN' => Hook::paymentReturn(intval($id_order), intval($id_module))));

 

for:

$order = new Order($idorder);

$smarty->assign(array(

'order' => $order,

'HOOK_ORDER_CONFIRMATION' => Hook::orderConfirmation(intval($id_order)),

'HOOK_PAYMENT_RETURN' => Hook::paymentReturn(intval($id_order), intval($id_module))));

 

 

and into root/themes/mytheme/order-confirmation.tpl i add pixel with this two array:

<iframe height="1" width="1" frameborder="0" scrolling="no" src="https://www.affilwebsite.com/tags/c?containerTagId=1234&CID=123456&OID={$id_order}&TYPE=123456&AMOUNT={$order->total_order}&CURRENCY=EUR" name="myeshop_sale"></iframe>

 

 

IS IT RIGHT :)

Ok very thanks for your help,bb.

Edited by MPart (see edit history)
Link to comment
Share on other sites

Hi, today affiliate company write me that still pixel no send price, why? :,(

I used what you write me. I made steps from my post #57 but company write me still miss amount parameter.

 

this affil comp write me:

Hello, I just did another test and the amount of the parameter AMOUNT unfortunately still missing.

Link to comment
Share on other sites

show me what youv'e got in the controller and in the .tpl file

 

moreover, what you've got when you use {$order|print_r} somewhere in the template? as i suggesdted you should check first available variables. please share them here.

Link to comment
Share on other sites

ok.

 

this is what I have now in my root/order-confirmation.php:

<?php

/* SSL Management */
$useSSL = true;

include(dirname(__FILE__).'/config/config.inc.php');
include(dirname(__FILE__).'/header.php');

$id_cart = intval(Tools::getValue('id_cart', 0));
$id_module = intval(Tools::getValue('id_module', 0));
$id_order = Order::getOrderByCartId(intval($id_cart));
$secure_key = Tools::getValue('key', false);
if (!$id_order OR !$id_module OR !$secure_key OR empty($secure_key))
Tools::redirect('history.php'.(Tools::isSubmit('slowvalidation') ? '?slowvalidation' : ''));
$order = new Order(intval($id_order));
if (!Validate::isLoadedObject($order) OR $order->id_customer != $cookie->id_customer OR $secure_key != $order->secure_key)
Tools::redirect('history.php');
$module = Module::getInstanceById(intval($id_module));
if ($order->payment != $module->displayName)
Tools::redirect('history.php');

$order = new Order($idorder);
$smarty->assign(array(
'order' => $order,
'HOOK_ORDER_CONFIRMATION' => Hook::orderConfirmation(intval($id_order)),
'HOOK_PAYMENT_RETURN' => Hook::paymentReturn(intval($id_order), intval($id_module))));

?>


<?php	

$smarty->display(_PS_THEME_DIR_.'order-confirmation.tpl');

include(dirname(__FILE__).'/footer.php');

 

and this is what i have now in my root/themes/mystyle/order-confirmation.tpl:

<script type="text/javascript">
<!--
var baseDir = '{$base_dir_ssl}';
-->
</script>

{capture name=path}{l s='Order confirmation'}{/capture}
{include file=$tpl_dir./breadcrumb.tpl}
<div id="primary_block" class="clearfix">

<h2>{l s='Order confirmation'}</h2>

{assign var='current_step' value='payment'}
{include file=$tpl_dir./order-steps.tpl}

{include file=$tpl_dir./errors.tpl}

{$HOOK_ORDER_CONFIRMATION}
{$HOOK_PAYMENT_RETURN}

<iframe height="1" width="1" frameborder="0" scrolling="no" src="https://www.affiliatewebsite.com/tags/c?containerTagId=1234&CID=123456&OID={$id_order}&TYPE=123456&AMOUNT={$order_Total}&CURRENCY=EUR" name="myeshopwebsite_sale"></iframe>
<br />
<a href="{$base_dir_ssl}history.php" title="{l s='Back to orders'}"><img src="{$img_dir}icon/order.gif" alt="{l s='Back to orders'}" class="icon" /></a>
<a href="{$base_dir_ssl}history.php" title="{l s='Back to orders'}">{l s='Back to orders'}</a></div>

Edited by MPart (see edit history)
Link to comment
Share on other sites

Sorry I not understand now. I never write anywhere {$order|print_r}. Everything should be original. How can it I find out.

Link to comment
Share on other sites

read my posts please, i suggested you several times to put somewhere in the template {$order|print_r} for test purposes. Then after refresh

you will se available variables, then you will be able to select correct variable like {$order->total_order}

Link to comment
Share on other sites

ok so replace amount array for {$order|print_r} into pixel. right. when do this. where i look avaible variables? only on this give me answer and i go edit file.

Edited by MPart (see edit history)
Link to comment
Share on other sites

nope, I said you before that you have to use this code not int he tracking pixel. paste it somewhere else, for example under the tracking pixel code.

 

oh, okay sorry iam begineer. okay so only tell me when i put this code under pixel code where i can see you? sorry for my question, i speak because my eshop is online for users and I can not afford any failure or error on website if you understand me.

Link to comment
Share on other sites

open the confirmation page (create fake order) and you will se all variables there. this is the only way to achieve this.

cope the available fields here, to the forum. then remove the code from .tpl file.

 

we will see then what variable to use

Link to comment
Share on other sites

now i test it and this show me:

 

Order Object ( [id_address_delivery] => [id_address_invoice] => [id_cart] => [id_currency] => [id_lang] => [id_customer] => [id_carrier] => [secure_key] => [payment] => [module] => [recyclable] => 1 [gift] => 0 [gift_message] => [shipping_number] => [total_discounts] => [total_paid] => [total_paid_real] => [total_products] => [total_products_wt] => [total_shipping] => [total_wrapping] => [invoice_number] => [delivery_number] => [invoice_date] => [delivery_date] => [valid] => [date_add] => [date_upd] => [tables:protected] => Array ( [0] => orders ) [fieldsRequired:protected] => Array ( [0] => id_address_delivery [1] => id_address_invoice [2] => id_cart [3] => id_currency [4] => id_lang [5] => id_customer [6] => id_carrier [7] => payment [8] => total_paid [9] => total_paid_real [10] => total_products [11] => total_products_wt ) [fieldsSize:protected] => Array ( [payment] => 32 ) [fieldsValidate:protected] => Array ( [id_address_delivery] => isUnsignedId [id_address_invoice] => isUnsignedId [id_cart] => isUnsignedId [id_currency] => isUnsignedId [id_lang] => isUnsignedId [id_customer] => isUnsignedId [id_carrier] => isUnsignedId [secure_key] => isMd5 [payment] => isGenericName [recyclable] => isBool [gift] => isBool [gift_message] => isMessage [total_discounts] => isPrice [total_paid] => isPrice [total_paid_real] => isPrice [total_products] => isPrice [total_products_wt] => isPrice [total_shipping] => isPrice [total_wrapping] => isPrice [shipping_number] => isUrl ) [table:protected] => orders [identifier:protected] => id_order [_taxCalculationMethod:private] => 0 [id] => [fieldsRequiredLang:protected] => Array ( ) [fieldsSizeLang:protected] => Array ( ) [fieldsValidateLang:protected] => Array ( ) ) 1

Link to comment
Share on other sites

when i rewrite $order = new Order($idorder); on $order = new Order($id_order);

on confirmation page i see this:

 

Order Object ( [id_address_delivery] => 2025 [id_address_invoice] => 2025 [id_cart] => 6800 [id_currency] => 1 [id_lang] => 4 [id_customer] => 1586 [id_carrier] => 25 [secure_key] => c188743ae6281ad1a45d0b42831f8e2c [payment] => Dobierka [module] => cashondelivery [recyclable] => 0 [gift] => 0 [gift_message] => [shipping_number] => [total_discounts] => 0.00 [total_paid] => 37.00 [total_paid_real] => 37.00 [total_products] => 30.83 [total_products_wt] => 37.00 [total_shipping] => 0.00 [total_wrapping] => 0.00 [invoice_number] => 0 [delivery_number] => 1890 [invoice_date] => 0000-00-00 00:00:00 [delivery_date] => 2013-07-18 13:37:49 [valid] => 1 [date_add] => 2013-07-18 13:37:49 [date_upd] => 2013-07-18 13:37:49 [tables:protected] => Array ( [0] => orders ) [fieldsRequired:protected] => Array ( [0] => id_address_delivery [1] => id_address_invoice [2] => id_cart [3] => id_currency [4] => id_lang [5] => id_customer [6] => id_carrier [7] => payment [8] => total_paid [9] => total_paid_real [10] => total_products [11] => total_products_wt ) [fieldsSize:protected] => Array ( [payment] => 32 ) [fieldsValidate:protected] => Array ( [id_address_delivery] => isUnsignedId [id_address_invoice] => isUnsignedId [id_cart] => isUnsignedId [id_currency] => isUnsignedId [id_lang] => isUnsignedId [id_customer] => isUnsignedId [id_carrier] => isUnsignedId [secure_key] => isMd5 [payment] => isGenericName [recyclable] => isBool [gift] => isBool [gift_message] => isMessage [total_discounts] => isPrice [total_paid] => isPrice [total_paid_real] => isPrice [total_products] => isPrice [total_products_wt] => isPrice [total_shipping] => isPrice [total_wrapping] => isPrice [shipping_number] => isUrl ) [table:protected] => orders [identifier:protected] => id_order [_taxCalculationMethod:private] => 0 [id] => 1993 [fieldsRequiredLang:protected] => Array ( ) [fieldsSizeLang:protected] => Array ( ) [fieldsValidateLang:protected] => Array ( ) ) 1

Link to comment
Share on other sites

awesome :)

 

you see there variables:

[total_paid] => 37.00
[total_paid_real] => 37.00
[total_products] => 30.83
[total_products_wt] => 37.00
[total_shipping] => 0.00
[total_wrapping] => 0.00

 

you can use in the .tpl file variables like:

$order->total_paid  - it will show: 37.00
$order->total_paid_real - it will show 37.00
$order->total_products - it will show 30.83
$order->total_products_wt- it will show 37.00
$order->total_shipping - it will show 0.00
$order->total_wrapping - it will show 0.00

 

now you can put one of them to the tracking pixel code

Link to comment
Share on other sites

ok so via this list of price i find price without tax and delivery and write into tracking, right? okay again very thanks for your help :)

Link to comment
Share on other sites

yes. i add on amount possition {$order->total_paid}

now affilcompany testing this version.perhaps it will be works.

Link to comment
Share on other sites

now company write me, that pixel have price so what is good :) but now is price with delivery :/

how to remove delivery?

 

when i have delivery on hard price for example 3eura, exist any option how to write some as {$order->total_paid}-3?

Link to comment
Share on other sites

okay. so now i test in pixel write this {$order-total_products}. right?

 

sorry i mean {$order->total_products}

 

now i write into company for test it. so after small time i write if work this :)

Edited by MPart (see edit history)
Link to comment
Share on other sites

hi, i wrote into this thread before some days.

 

i have only one question. exist any parametr for adding into pixel this???

c1: Transfer the total amount of the shopping cart through this parameter, numeric value, use dot as decimal separator

c2: Pass back IDs of products ordered, alphanumeric value, multiple products have to be separated by commas

c3: Fill in the quantities of each ordered product, positive integer value, multiple quantities have to be separated by commas while keeping the same order as in PRIDS-C parameter

c4: Transmit IDs of products ordered, alphanumeric value, multiple products have to be separated by PIPE characters

 

I adding second affiliate and this need four info, first and second C1 and C4 is same as in previous affiliate so i add as my first affiliate. Now i only need help with add array into second pixel. Bud i dont know what is good array for C2 and C3 :/

Link to comment
Share on other sites

this is my second affiliate pixel:

 

<iframe height="1" width="1" frameborder="0" scrolling="no" src="https://www.affiliatewebsite.com/c?containerTagId=1234&CID=123456&TYPE=123456&OID={$id_order}&AMOUNT={$order->total_products}&CURRENCY=EUR&PRIDS-C={Comma-separated product IDs -> Note c2}&PRQTY-C={Comma-separated product quantities -> Note c3}&PRIDS-P={PIPE-separated product IDs -> Note c4}" name="namemyshop_sale"></iframe>

 

green array is good, this is same as in previos my first pixel but red i dont know.

anyone please what is right array for red

Link to comment
Share on other sites

this is not as simple as it seems, if you want to add comma sepparated product IDs you have to create some variable with foreach loop, the same with quantities and product IDs

 

you can do it in one foreach loop

then put created variables into the affiliation pixel code

Link to comment
Share on other sites

Hi, you help me before x days with affiliate pixel. its works.

 

but today i copy backup my website (old +-30days) on second domain.

second domain is same eshop 1:1 as in my first domain only is second on germany language (on my first domain where i made moddifications is english).

but when i made same moddifications as in first/original website, here on second domain not works :/

parametre "OID" this is parametr for id order IS EMPTY :( why?

 

I made moddifications same as in previous domain (modded order-confirmation.php in root and order-confirmation.tpl in template)

 

this i have in order-confirmation.php in root (second domain where is empty id order):

/* SSL Management */

$useSSL = true;

 

include(dirname(__FILE__).'/config/config.inc.php');

include(dirname(__FILE__).'/header.php');

 

$id_cart = intval(Tools::getValue('id_cart', 0));

$id_module = intval(Tools::getValue('id_module', 0));

$id_order = Order::getOrderByCartId(intval($id_cart));

$secure_key = Tools::getValue('key', false);

if (!$id_order OR !$id_module OR !$secure_key OR empty($secure_key))

Tools::redirect('history.php'.(Tools::isSubmit('slowvalidation') ? '?slowvalidation' : ''));

$order = new Order(intval($id_order));

if (!Validate::isLoadedObject($order) OR $order->id_customer != $cookie->id_customer OR $secure_key != $order->secure_key)

Tools::redirect('history.php');

$module = Module::getInstanceById(intval($id_module));

if ($order->payment != $module->displayName)

Tools::redirect('history.php');

 

$order = new Order($id_order);

$smarty->assign(array(

'order' => $order,

'HOOK_ORDER_CONFIRMATION' => Hook::orderConfirmation(intval($id_order)),

'HOOK_PAYMENT_RETURN' => Hook::paymentReturn(intval($id_order), intval($id_module))));

 

and this i have in order-confirmation.tpl in my template (second domain where is empty id order):

<script type="text/javascript">

<!--

var baseDir = '{$base_dir_ssl}';

-->

</script>

 

{capture name=path}{l s='Order confirmation'}{/capture}

{include file=$tpl_dir./breadcrumb.tpl}

<div id="primary_block" class="clearfix">

 

<h2>{l s='Order confirmation'}</h2>

 

{assign var='current_step' value='payment'}

{include file=$tpl_dir./order-steps.tpl}

 

{include file=$tpl_dir./errors.tpl}

 

{$HOOK_ORDER_CONFIRMATION}

{$HOOK_PAYMENT_RETURN}

 

<iframe height="1" width="1" frameborder="0" scrolling="no" src="https://www.affiliatewebsite.com/tags/c?containerTagId=1234&CID=123456&TYPE=123456&OID={$id_order}&AMOUNT={$order->total_products}&CURRENCY=EUR" name="mywebsite_sale"></iframe>

<br />

<a href="{$base_dir_ssl}history.php" title="{l s='Back to orders'}"><img src="{$img_dir}icon/order.gif" alt="{l s='Back to orders'}" class="icon" /></a>

<a href="{$base_dir_ssl}history.php" title="{l s='Back to orders'}">{l s='Back to orders'}</a></div>

Edited by MPart (see edit history)
Link to comment
Share on other sites

0 errors in importing ftp database, this made support in hosting. all works on 100%.

 

when i made same moddifications as in first domain so pixel works too

but only one parametr is empty :/ and it OID

but when i look on first domain and on second all is same write, on both domain is write same array etc.

so just do not know where she could be a mistake if everything is exactly the same

 

<iframe height="1" width="1" frameborder="0" scrolling="no" src="https://www.affiliatewebsite.com/tags/c?containerTagId=1234&CID=123456&TYPE=123456&OID={$id_order}&AMOUNT={$order->total_products}&CURRENCY=EUR" name="mywebsite_sale"></iframe>

 

vekia what you mean error reporting? you mean in presta?

Edited by MPart (see edit history)
Link to comment
Share on other sites

instead

'order' => $order,

try to use

'order' => $order,
'id_order' => $id_order,

 

Sorry for the long pause, but I got answer from affiliate company up today.

When I was made additional editation, what you wrote vekia, so affiliate pixel code began work :)

So when have someone problem with works only made additional edit what wrote vekia and it will work.

Link to comment
Share on other sites

glad to hear that another solution here works well :)

i just want to say, when someone have got problems with tracking pixel - then I give it a url to this thread

it's the most valuable know how related to creating tracking pixels ;)

 

thanks MPart!

 

regards

Link to comment
Share on other sites

  • 1 month later...

Hi,

 

I have a working affiliate tracking code, but I'd like to tier my rewards. Unfortunaly the affiliate says they can't do it from thier side, so an1 knows if it would be possible to set up reqard tiers depending on value? So if it say over 500 it's 10 % and under it's 30% for example.

Link to comment
Share on other sites

  • 5 months later...

hai,

 

I use v 1.5.6.2 but when buyer confirm the order(shop cart), they will be have blank page, can you advice an solution

here below the code

 

order-cofirmation.php
require(dirname(__FILE__).'/config/config.inc.php');
Tools::displayFileAsDeprecated();
Tools::redirect('index.php?controller=order-confirmation'.((count($_GET) || count($_POST)) ? '&'.http_build_query(array_merge($_GET, $_POST), '', '&') : ''), __PS_BASE_URI__, null, 'HTTP/1.1 301 Moved Permanently');

=================================
order-confirmation.tpl
{capture name=path}{l s='Order confirmation'}{/capture}

<h1>{l s='Order confirmation'}</h1>

{assign var='current_step' value='payment'}
{include file="$tpl_dir./order-steps.tpl"}

{include file="$tpl_dir./errors.tpl"}

{$HOOK_ORDER_CONFIRMATION}
{$HOOK_PAYMENT_RETURN}

<br />
{if $is_guest}
    <p>{l s='Your order ID is:'} <span class="bold">{$id_order_formatted}</span> . {l s='Your order ID has been sent via email.'}</p>

    <a href="{$link->getPageLink('guest-tracking', true, NULL, "id_order={$reference_order}&email={$email}")|escape:'html'}" title="{l s='Follow my order'}"><span class="fa fa-shopping-cart"></span>{l s='Follow my order'}</a>
{else}    
    <a href="{$link->getPageLink('history', true)|escape:'html'}" title="{l s='Back to orders'}"><span class="fa fa-shopping-cart"></span>{l s='Back to orders'}</a>
{/if}
 

Link to comment
Share on other sites

Hi, after long time searching I found this topic. I use Prestashop 1.4.7 and want to place a conversion pixel. but get a white page as order-confirmation-page

 

In OrderconfirmationController.php I have:

{
$order = new Order($this->id_order);
   $cart = new Cart($order->id_cart);
   $description="";
   foreach ($cart->getProducts() AS $k=>$v){
   $description.=$v['name']."X".$v['quantity'];
   }   
   $description=urlencode($description);
  $this->context->smarty->assign(array('total_products'=>$order->total_products_wt,
'description'=>$description
));
parent::displayContent();
self::$smarty->display(_PS_THEME_DIR_.'order-confirmation.tpl');
}
}

 

And in order-confirmation.tpl I have the pixel and variables

<img src="http://www.site.nl/kleding/conversion.php?campaignID=14519&productID=21572&conversionType=sales&https=0&transactionID={Tools::getvalue('id_order')}_formatted&transactionAmount='{$total_to_pay}'&email=email&descrMerchant={$description}&descrAffiliate={$description}" width="1" height="1" border="0" alt="" />

But when I make an order, I get a blank page instead of the last step of the orderproces (order-confirmation.php).

 

The error I get when I turn on error-reporting: Fatal error: Call to a member function assign() on a non-object in/home/ufiqlaxk/domains/site.nl/public_html/controllers/OrderConfirmationController.php on line 93

 

Probably not only the code I placed on line 93 ($this->context->smarty->assign(array( ) isn't right, also the conversion image variables may not be right I guess. Can you help me out?

Edited by danielle85 (see edit history)
Link to comment
Share on other sites

  • 3 weeks later...

okay, so let's do the show ;-)

 

 

open the file:

controllers/front/OrderConfirmationController.php

 

 

you've got there:

$this->setTemplate(_PS_THEME_DIR_.'order-confirmation.tpl');
right before this code, paste this one:

 

	    $order = new Order($this->id_order);
	    $cart = new Cart($order->id_cart);
	    $description="";
	    foreach ($cart->getProducts() AS $k=>$v){
		    $description.=$v['name']."X".$v['quantity'];
	    }	   
	    $description=urlencode($description);
	   
	    $this->context->smarty->assign(array(
	    'total_to_pay'=>$order->getOrdersTotalPaid(),
	    'description'=>$description
	    ));
then in order-confirmation.tpl use:

 

{$total_to_pay} instead the __ADD_SALE_VALUE__

{$description} instead the __ADD_DESCRIPTION__

 

save changes and try

 

let me know if it works exactly as you expect

 

regards

 

hello! any chance on doing this for presta 1.5.6.0?

Link to comment
Share on other sites

Thank you. It does work :)

It works, but not as the affiliate want.

I have this code from them: <img

src="http://www.piatadigitala.ro/tracking/3/389/{$id_order}/{$total_to_pay}/{$description}"

width="1" height="1">

Of course, {$total_to_pay}, has to be without transport.

I changed it with {$total_products}, but now the price is instead of the the ORDER ID.

Please advise. Thanks!

Link to comment
Share on other sites

×
×
  • Create New...