Jump to content

Recommended Posts

Hi Vekia.

 

I am sorry to say it is not working for me...but I guess it is me doing something wrong.

 

Here is the affiliate iframe

 

<!-- Offer Conversion: Whatbunkers.com - Poloer i høj kvalitet -->
<iframe src="http://online.digital-advisor.com/aff_l?offer_id=314&amount=AMOUNT" scrolling="no" frameborder="0" width="1" height="1"></iframe>
<!-- // End Offer Conversion -->
 
I changed this to 
 
<!-- Offer Conversion: Whatbunkers.com - Poloer i høj kvalitet -->
<iframe src="http://online.digital-advisor.com/aff_l?offer_id=314&amount={$total_products}" scrolling="no" frameborder="0" width="1" height="1"></iframe>
<!-- // End Offer Conversion -->
 
I added the below to orderconfirmationcontroller just before the line You specified.
 
    $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(),
   'description'=>$description
   ));
 
 
1) I want to send just product price excluding vat
2) also is there anyway I can always send the eur price even if the customer checks out with my other currency option Danish kroner?
 
I hope You can help, I have a ton of products that i would like to sell :-)
 
best regards
 
Martin
 

Share this post


Link to post
Share on other sites

Hi Vekia

 

I am having the same question on this mater.

 

I want to add affiliate tracking on my site while using paypal module.

I need to pass on the total order value without tax and shipping value but including any voucher or discount.

 

How can this be done?

 

Thank

/Alex

Share this post


Link to post
Share on other sites

I have a similar issue.

 

I need to add the Commission Junction tracking pixel code:

 

<img src="https://www.emjcd.com/u?AMOUNT=<AMOUNT>&DISCOUNT=<DISCOUNT>&CID=123456&OID=<OID>&TYPE=2345678&CURRENCY=USD&METHOD=IMG" height="1" width="20">

 

Where...

<AMOUNT> = Subtotal (total_products)

<OID> = Order ID (maybe this value: id_order_formatted)

<DISCOUNT> = discounr amount

 

How would I get those values into the tracking code above?

 

Share this post


Link to post
Share on other sites

and what if order will not have discount? what kind of data provide then?

Share this post


Link to post
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

 

hello vekia

 

this works fine with 1.5.6.2 (affilinet), but price is WITH tax. if i change to total_products, it is WITHOUT tax, but also WITHOUT discounts.

 

any ideas?

 

thx in advance

Share this post


Link to post
Share on other sites

the question is what kind of price you want to display? with tax? without tax? with discounts? without discounts? with delivery ? without?

Share this post


Link to post
Share on other sites

Hi Vekia,

 

Have read trough this interesting thread, but couldn't find the answer I'm looking for.

 

I'm looking for variables to put in this part of the code (will be placed on order-confirmation page):

 

<script type="text/javascript">
var vmt_pi = { '

shopId' : XXXX,

'type' : 'confirmed',

'amount' : 20.49,

'skus' : ['12345-05-WHT-XL', '12345-05-WHT-L', '12345-05-WHT-S'],

'prices' : [5.49,10.00,5.00]

};
</script>

 

Marked in red (not solved):

'amount' = total net shopping cart value (excl. tax)

'skus' = comma separated list of the SKUs of the purchased products (I think I will use the product's reference here instead)

'prices' = comma separated list of the net prices in the same order

 

Marked in green is static and no problems to insert.

I'm using PS 1.6.

 

Any ideas?

 

Thanks in advance!

Edited by tomped (see edit history)

Share this post


Link to post
Share on other sites

In 1.6 I used vekia`s code and it worked, but made the cart add random prodcts alongside the really chosen one. Anyone got has thay issue,too?

Share this post


Link to post
Share on other sites

Hi all, we successfully added tracking code on our website (prestashop 1.3.4.0).
Now we would need only advise - in code we must write text for adding the following parameters:

{Product-ID}
{Product-IDs}

{Price of Product}
{Category Name}
{Category ID}
{Brand}
{Related Product-IDs}
{Product Quantities}

{Order-ID}
{Sale Amount}

 

For last two (what are green) we know what we need write into code.
{Order-ID} ---> {$id_order}
{Sale Amount} ---> {$order->total_products}

But on first eight not (red), is here someone who know code for this please?

Thank you in advance for help.

Edited by P3PeCZ (see edit history)

Share this post


Link to post
Share on other sites

Here is it the right code for last versions 1.6.x.x. And thank you for this post really help after i write all day for codes..

 

I use it for my website http://sensuals.ro

 

Pentru ID Comanda:    {Tools::getvalue('id_order')}

Pentru Descriptie:        {$description}

Pentru pretul total platit fara cost transport:     {$total_products}   - total pay withowt shipping

Pret platit cu transport: {$total_to_pay}  - total pay

 

Pentru valori trebuie modificat /controllers/front/OrderConfirmationController.php - modify this with code below

 

Imediat deasupra codului”  $this->setTemplate(_PS_THEME_DIR_.'order-confirmation.tpl');  “trebuie pus acest cod:

 

  $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(),

                                'total_products'=>$order->total_products,

                    'description'=>$description

                    ));

 

 

Save and working 100%.

Edited by ilisiaraul (see edit history)

Share this post


Link to post
Share on other sites

Hi Vekia,

 

I have to add this code in order-confirmation.tpl for my affiliate program:

 

<script type="text/javascript">

var purchase = new AttrPurchase();

purchase.setMerchantId('**************************');

purchase.setOrderId('ORDER_ID');

purchase.setTotalCost(ORDER_TOTAL);

purchase.register();

</script>

 

Can I use your metod here and how to use variable here - for order_id and order_total (without tax and shipping)

PrestaShop 1.5.4.1

 

Thank you!

Share this post


Link to post
Share on other sites

I have followed the instruction but the affiliate side did not received the order, I am using prestashop version 1.6 and the payment mode i am using paypal version 3.81. 

Share this post


Link to post
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

 

in 1.4.9 I have this in orderconfirmationcontroller.php 

 
public function displayContent()
{
parent::displayContent();
self::$smarty->display(_PS_THEME_DIR_.'order-confirmation.tpl');
}
}
 
where would i put the above code?

Share this post


Link to post
Share on other sites

awesome smile.png

 

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

 

i got this

 

Order Object ( [id_address_delivery] => [id_address_invoice] => [id_cart] => [id_currency] => [id_lang] => [id_customer] => [id_carrier] => [secure_key] => [payment] => [module] => [conversion_rate] => [recyclable] => 1 [gift] => 0 [gift_message] => [shipping_number] => [total_discounts] => [total_paid] => [total_paid_real] => [total_products] => [total_products_wt] => [total_shipping] => [carrier_tax_rate] => [total_wrapping] => [invoice_number] => [delivery_number] => [invoice_date] => [delivery_date] => [valid] => [date_add] => [date_upd] => [tables:protected] => Array ( [0] => orders ) [fieldsRequired:protected] => Array ( [0] => conversion_rate [1] => id_address_delivery [2] => id_address_invoice [3] => id_cart [4] => id_currency [5] => id_lang [6] => id_customer [7] => id_carrier [8] => payment [9] => total_paid [10] => total_paid_real [11] => total_products [12] => total_products_wt ) [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 [carrier_tax_rate] => isFloat [total_wrapping] => isPrice [shipping_number] => isUrl [conversion_rate] => isFloat ) [webserviceParameters:protected] => Array ( [objectMethods] => Array ( [add] => addWs ) [objectNodeName] => order [objectsNodeName] => orders [fields] => Array ( [id_address_delivery] => Array ( [xlink_resource] => addresses ) [id_address_invoice] => Array ( [xlink_resource] => addresses ) [id_cart] => Array ( [xlink_resource] => carts ) [id_currency] => Array ( [xlink_resource] => currencies ) [id_lang] => Array ( [xlink_resource] => languages ) [id_customer] => Array ( [xlink_resource] => customers ) [id_carrier] => Array ( [xlink_resource] => carriers ) [module] => Array ( [required] => 1 ) [invoice_number] => Array ( ) [invoice_date] => Array ( ) [delivery_number] => Array ( ) [delivery_date] => Array ( ) [valid] => Array ( ) [current_state] => Array ( [getter] => getCurrentState [setter] => setCurrentState [xlink_resource] => order_states ) ) [associations] => Array ( [order_rows] => Array ( [resource] => order_row [setter] => [virtual_entity] => 1 [fields] => Array ( [id] => Array ( ) [product_id] => Array ( [required] => 1 ) [product_attribute_id] => Array ( [required] => 1 ) [product_quantity] => Array ( [required] => 1 ) [product_name] => Array ( [setter] => ) [product_price] => Array ( [setter] => ) ) ) ) ) [table:protected] => orders [identifier:protected] => id_order [_taxCalculationMethod:protected] => 0 [id] => [fieldsSize:protected] => Array ( ) [fieldsRequiredLang:protected] => Array ( ) [fieldsSizeLang:protected] => Array ( ) [fieldsValidateLang:protected] => Array ( ) [image_dir:protected] => [image_format:protected] => jpg ) 1 

 

 

 

 

now what?

Share this post


Link to post
Share on other sites

dear vekia.i am using prestashop v1.6 with paypal module as payment gateway , i follow the steps as below but but my affiliate did  not received the order.Below are the steps that i have done.

 

$this->setTemplate(_PS_THEME_DIR_.'order-confirmation.tpl'); right before this code, i 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(),

     'total_products'=>$order->total_products,
     'description'=>$description
    
));

 

THEN i paste my affiliate tracking pixel at the bottom of the code under themes/my_theme/order-confirmation.tpl

<iframesrc="https://affinatestore.go2cloud.org/aff_l?offer_id=40&adv_sub={Tools::getvalue(id_order')}&amount={$total_products}"

width="1" height="1" />

 

These are the steps i have done and the affiliate side did not received the order and i am using paypal as the only payment gateway.I need help urgently.Thanks

Share this post


Link to post
Share on other sites

anyone will know how to resolve this problem?or is it the affiliate tracking pixel i should paste somewhere else due to paypal redirect the link?

Share this post


Link to post
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?

did you sort this out?

Share this post


Link to post
Share on other sites

Im getting this error, after pasting the code in order confirmation tpl. anyone know whats the issue?

 

Fatal error: Uncaught --> Smarty Compiler: Syntax error in template "/home/public_html/themes/default-bootstrap/order-confirmation.tpl" on line 62 "window._fbq.push(['track', 'xxxx', {'value':'0.01','currency':'USD'}]);" - Unexpected ":", expected one of: "}" <-- thrown in /home/public_html/tools/smarty/sysplugins/smarty_internal_templatecompilerbase.php on line 62

Edited by xiaochunn (see edit history)

Share this post


Link to post
Share on other sites

Thank you Vekia for this quick, clean and helpful intervention.

My code works nicely after following the instructions here.

But my code has one more variable (we work with the same affiliate program: "2parale").
I made a separate thread for it, but because it's closely tied to this one, I will write here the problematic variable for redirecting others who, like me, have an incomplete tracking code.

So if anyone has a mind block with the __ADD_AFFILIATE_SALE_COMMISSION_PERCENT__ variable, there is another thread for it (or maybe an admin can merge threads?) :

https://www.prestashop.com/forums/topic/430862-variable-sale-commission-percent-in-affiliate-tracking-code/?p=2007089

Edited by Attrexx (see edit history)

Share this post


Link to post
Share on other sites

In order to substract the discount from $total_products I used the following code

/************************** AFFILIATE NETWORK SCRIPT VALUES ****************************/
   $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);
   
   $total_wt_disc = round(($order->total_products - $order->total_discounts) , 2);

   $this->context->smarty->assign(array(
   'total_to_pay'=>$order->getOrdersTotalPaid(),
   'total_products'=>$total_wt_disc,
   'description'=>$description
   ));
/************************** AFFILIATE NETWORK SCRIPT VALUES END ****************************/

Share this post


Link to post
Share on other sites

Hey Vekia

 

I also have some problems with the trackingcodes, but it seems that the variables from 1.3 or 1.5 did not work on 1.6.0.11

 

What I get is the order ID with {Tools::getvalue(id_order')}

but i absolutly can't get the value of the total products ... not with oder even not without tax.

 

What I need is the total amount of the products without taxes and without shipping and also the variable of the currency because the shop is running in EUR and U$

Any hint for me?

Share this post


Link to post
Share on other sites

We just added paypal as payment gateway. The script does not work with paypal.

 

Any help?

Share this post


Link to post
Share on other sites

Update:

 

Just fixed the total amount without tax and shipping, but searching for how to get the currency out there.

For PayPal, i haven't tested it, but i think it's clear that it is not working this way because after going out to payPal, the orderconfirmationcontroller.php can't delivery the datas.

 

joss54 - i think we have to store the data in a cookie ... ???

Share this post


Link to post
Share on other sites

I'am getting closer to the problem and also fixed the problem with the currency.

I can get it out with {$currency->iso_code}

 

But the problem with paypal is somewhere else. I just made a testorder via paypal and the final page wil be like this:

..../de/module/paypal/submit?key=c5842c59...

 

I took a look at the controllers in the paypal module and there is a reference to the order-confirmation.tpl ... take a look:

 

if ($this->context->getMobileDevice() == true)
            $this->setTemplate('order-confirmation-mobile.tpl');
        else
            $this->setTemplate('order-confirmation.tpl');

    }

 

related to this I change the code like vekia said before in the OrderConfirmationController.php to this in the submit.php in Paypal.

 

if ($this->context->getMobileDevice() == true)
            $this->setTemplate('order-confirmation-mobile.tpl');
        else

$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);
   
   $total_wt_disc = round(($order->total_products - $order->total_discounts) , 2);

   $this->context->smarty->assign(array(
   'total_to_pay'=>$order->getOrdersTotalPaid(),
   'total_products'=>$total_wt_disc,
   'description'=>$description
   ));
            $this->setTemplate('order-confirmation.tpl');

    }

 

But I did not get any data out??

Any idea to that?

Share this post


Link to post
Share on other sites

EDIT: FOUND THE SOLUTION

Go to /modules/paypal/views/templates/front/order-confirmation.tpl

and put your affiliate tracking code. Mine is like:

<script type="text/javascript">
    affiliate.load_action("11628", "{Tools::getvalue('id_order')}", "1::{$total_products_wt}", "", "pending");
</script>

Then go to /modules/paypal/controllers/front/submit.php

near line 67, says

$price = Tools::convertPriceFull($paypal_order['total_paid'], $order_currency, $display_currency);

at the next line insert (prices include tax and subtract discounts)

$total_products_wt = round(($order->total_products_wt - $order->total_discounts), 2);

and also at the next array (lines 72-80) put one more line to send to tpl.

'total_products_wt' => $total_products_wt,

This is it!

 

 

 

I'am getting closer to the problem and also fixed the problem with the currency.

I can get it out with {$currency->iso_code}

 

But the problem with paypal is somewhere else. I just made a testorder via paypal and the final page wil be like this:

..../de/module/paypal/submit?key=c5842c59...

 

I took a look at the controllers in the paypal module and there is a reference to the order-confirmation.tpl ... take a look:

 

if ($this->context->getMobileDevice() == true)
            $this->setTemplate('order-confirmation-mobile.tpl');
        else
            $this->setTemplate('order-confirmation.tpl');

    }

 

related to this I change the code like vekia said before in the OrderConfirmationController.php to this in the submit.php in Paypal.

 

if ($this->context->getMobileDevice() == true)
            $this->setTemplate('order-confirmation-mobile.tpl');
        else

$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);
   
   $total_wt_disc = round(($order->total_products - $order->total_discounts) , 2);

   $this->context->smarty->assign(array(
   'total_to_pay'=>$order->getOrdersTotalPaid(),
   'total_products'=>$total_wt_disc,
   'description'=>$description
   ));
            $this->setTemplate('order-confirmation.tpl');

    }

 

But I did not get any data out??

Any idea to that?

Edited by joss54 (see edit history)

Share this post


Link to post
Share on other sites

in addition, i tested it also in 1.6.0.4 release - it works too

so, conclusion is simple, we have got universal solution :)

 

Hi - Does this work in v1.6.0.14 

 

I have tried this solution and if I look in firebug I get the error '$total_to_pay is not defined' from order-confirmation.tpl

 

I have inserted 'var_dump('testing');' in order-confirmation.php to ensure that the overriden php file is processing and this displays correctly.

 

Please ignore the above - it does work in v1.6.0.14 

 

My problem was that I was trying to pass a Smart variable into javasxript using:

var google_conversion_value = {$total_to_pay};

Whereby I should have been using:

var google_conversion_value = {/literal}{$total_to_pay}{literal};
Edited by skinnybloke (see edit history)

Share this post


Link to post
Share on other sites

How can i get  Total Price with tax including discounts in 1.6.x.x?

 

does this variable is with  discounts? As i made some tests and i see it includes price drops..

$order->total_products_wt

if not what variable is for discounts in controller as

 

this code below always shows 0 is it right?

$order->total_discounts
Edited by dolec (see edit history)

Share this post


Link to post
Share on other sites

I'm trying to implement the pixel since two days. I read the whole thread and followed the steps but it still doesn't work. It seems like pixel is not firing at all.
Let me explain how it's implemented at the moment:

/movokshop/prestashop/themes/newyork/order-confirmation.tpl:

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

<img src="https://plus.go2cloud.org/aff_l?offer_id=3061&adv_sub={Tools::getvalue(id_order')}&amount={$total_products}" width="1" height="1" />

<h1 class="page-heading title_font">{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}

{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>
    <p class="cart_navigation exclusive">
    <a class="button-exclusive btn btn-default title_font" href="{$link->getPageLink('guest-tracking', true, NULL, "id_order={$reference_order|urlencode}&email={$email|urlencode}")|escape:'html':'UTF-8'}" title="{l s='Follow my order'}"><i class="icon-chevron-left"></i>{l s='Follow my order'}</a>
    </p>
    
{else}
<p class="cart_navigation exclusive">
    <a class="button-exclusive btn btn-default title_font" href="{$link->getPageLink('history', true)|escape:'html':'UTF-8'}" title="{l s='Go to your order history page'}"><i class="icon-chevron-left"></i>{l s='View your order history'}</a>
</p>
{/if}

/movokshop/prestashop/controllers/front/OrderConfirmationController.php:


        $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
        ));
        
        $this->setTemplate(_PS_THEME_DIR_.'order-confirmation.tpl');
 

......

I would appreciate if you could take a look at the implementation and maybe figure out the problem. I think I made somewhere a big mistake as the affiliate don't see anything. There is no response from prestashop at all thats why I think that pixel is not firing. I'm using prestashop 1.6

Looking forward to your response!

Regards

Edited by plusperformance (see edit history)

Share this post


Link to post
Share on other sites

I'm using prestashop 1.6 as well, and while my code is work well, I'm trying to use an affiliate tracking program to optimize my stuff, and couldn't figure our how to set up prosper202 to prestashop.  I just signed up for Clicker Ticker but I would prefer to use the free option.

Share this post


Link to post
Share on other sites

can anybody tell me which files need to change?  i want to add sharesale  Affiliate Tracking Code:

 

my website: prestashop_1.6.1.1, and v3.10.2-PayPal Europe - Official.

 

because the v1.3.9-PayPal USA & Canada has bug,  no orders in BO  via paypal standard payment, so i have to use v3.10.2-PayPal Europe.

 

 

A: add Affiliate Tracking Code to :

/modules/paypal/views/templates/front/order-confirmation.tpl

/modules/paypal/controllers/front/submit.php

 

 

or

 

B:

themes/theme/order-confirmation.tpl
controllers/front/OrderConfirmationController.php.

 

 

Do i need set paypal IPN?  

i don't know which real IPN Return url?

is this  http://www.website/paypal/ipn.php ?  

 

or

 

http://www.website/paypal/controllers/front/submit.php

 

someone said paypal IPN return url  set to  :

http://yoursitedomain.com/module/paypal/validation.php

 

but i can't find  this file in /module/paypal/

 

this mywebsite made payment url

http://www.mywebsite.com/index.php?key=b153d2f78543a8450b67e17577dc665b&id_module=72&id_cart=15&id_order=10&fc=module&module=paypal&controller=submit

 

 

 

@vekia

 

thank you .

 

Best,

 

Share this post


Link to post
Share on other sites

what to do if we use prestashop on the cloud and have only read access to controllers/ .... ?

Share this post


Link to post
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

 

Hi, can you please help me? I need this 'total_to_pay'=>$order->getOrdersTotalPaid() but my shop is in cloud, co i have no access to this controller, only to order_confirmation.tpl. I am asking help in this thread:

https://www.prestashop.com/forums/topic/504273-putting-provision-tracking-code-to-confirmed-order-thank-you-page/?hl=%2Bcloud+%2Band+%2Btracking&do=findComment&comment=2247915

Share this post


Link to post
Share on other sites

hello

 

thanks for information, so the affiliate network accept everything?

Hello
please help me and me with Traking code.
I did all the steps of implementation but the code does not work

Share this post


Link to post
Share on other sites

Hello Everything is working, thanks a lot for help. I just have 1 problem to get "voucher code" variable to put it in the tracking code. by voucher oce i mean car_rules code, like "12345".

 

Can somebody know what to write in OrderConfirmationController.php

Share this post


Link to post
Share on other sites

Hi All,

 

I need your help i have no experience on programming I followed your instructions and it looks like it worked.  

I need to add a level of complexity .

 

I arranged with my affiliate network that for example if they help me to sell a premium product they will get lets say 10 percent but if is a basic product they will get 5 percent.   this segmentation is the same as the category of the products.. but i have no idea how to get a total of sales of category one and the total of category two in one order,

 

 

this is the code

 

<img src="//action.metaffiliation.com/trk.php?
mclic=IDKWANKO&argmon=AMOUNT&argann=EVENTID&standard=AMOUNT1&premium=AMOUNT2&argmodp=PAYNAME&nacur=
CURRENCY" width="1" height="1" border="0" />
 
where Amount is the total of the order , event id is the order id,      Amount1 is total of basic products and amount2 is total sales of premium products,
 
 
I appreciate if you could help me,
 
Thanks

Share this post


Link to post
Share on other sites

Hi Guys

 

I've tried using this solution (Version 1.6.1.4)

When testing, the confirmation page returns blank.

 

Can anyone help? 

 

Thanks

Edited by thabisomak (see edit history)

Share this post


Link to post
Share on other sites

blank page = errors

turn on error reporting and paste your error code here,

will see whats up there

Share this post


Link to post
Share on other sites

Hi, does $order->getOrdersTotalPaid() contain shipping cost?

 

If so, how can I remove/exclude the shipping cost?

 

In addition, what is the format of the return value of getOrdersTotalPaid()? Example, for $15.20, does it return "$15.20" or just "15.20" (w/o money sign)?

 

Thanks!

Edited by bomby (see edit history)

Share this post


Link to post
Share on other sites

It's without currency sign.

you can use vekia's answer at the first page.

 

so use the:

'total_products'=>$order->total_products,
or with tax included:
'total_products'=>$order->total_products_wt,

 

 

Hi, does $order->getOrdersTotalPaid() contain shipping cost?

 

If so, how can I remove/exclude the shipping cost?

 

In addition, what is the format of the return value of getOrdersTotalPaid()? Example, for $15.20, does it return "$15.20" or just "15.20" (w/o money sign)?

 

Thanks!

Share this post


Link to post
Share on other sites

I want to exclude non valid orders from affiliate script (in case there is a problem with payment in credit card payment module)

 

After asking the module creator, he said that the following is executed after the customer returns to the shop:

Tools::redirect('index.php?controller=order-confirmation&id_cart='.$cart_id.'&id_module='.$modirumeb->id.'&id_order='.$modirumeb->currentOrder.'&key='.$secure_key);

 
and that I have to query the orders table using the cartid, a success transaction updates the record 'valid' to 1.
 
Since I cannot do it in tpl file, how should I modify the OrderConfirmationController.php in order to achieve that?
 
Thanks all!

 

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

 

Share this post


Link to post
Share on other sites

Hi,

 

I heard that Google Analytics module from Prestashop has covered this issue. Is that correct?

 

I'd like to add eCommerce tracking by adding this actually:

<script>
dataLayer.push({
		'event':'ecomm_event',
    'transactionId': 'XXXXX', // Transaction ID - this is normally generated by your system.
    'transactionAffiliation': 'XXXXXXX', // Affiliation or store name
    'transactionTotal': 'XX.XX', // Grand Total
    'transactionTax': 'XX.XX' , // Tax.
    'transactionShipping':'XX.XX', // Shipping cost
    'transactionProducts': [
	{
        'sku': 'XXXXXX', // SKU/code.
        'name': 'XXXXXXXX', // Product name.
        'category': 'XXXXXXXX', // Category or variation.
        'price': 'XX.XX', // Unit price.
        'quantity': 'X'
    }]
});
</script>

I am not sure whether this one is included in the module. Anybody can help? Thanks.

  • Like 1

Share this post


Link to post
Share on other sites

 

<script>
dataLayer.push({
		'event':'ecomm_event',
    'transactionId': 'XXXXX', // Transaction ID - this is normally generated by your system.
    'transactionAffiliation': 'XXXXXXX', // Affiliation or store name
    'transactionTotal': 'XX.XX', // Grand Total
    'transactionTax': 'XX.XX' , // Tax.
    'transactionShipping':'XX.XX', // Shipping cost
    'transactionProducts': [
	{
        'sku': 'XXXXXX', // SKU/code.
        'name': 'XXXXXXXX', // Product name.
        'category': 'XXXXXXXX', // Category or variation.
        'price': 'XX.XX', // Unit price.
        'quantity': 'X'
    }]
});
</script>

 

I also need this!

now we have solution for prestashop 1.3

Hello, Vekia! Can you help us? Do you have a solution for Prestashop 1.6? Edited by trace (see edit history)

Share this post


Link to post
Share on other sites

Hello,

 

Shareasale requested us that we send price without shipping cost, the code Vekia provided only send price with shipping cost.

 

I tried also many other solutions on this topic without success, I would like the tracking code to send only product price without shipping cost...

 

If someone can help... below are the two files that I have modified : 

 

 

/modules/paypal/views/templates/front/order-confirmation.tpl

<img src="https://shareasale.com/sale.cfm?amount={$order.total_products}&tracking={$order.id_order}&transtype=sale&merchantID=74223" width="1" height="1">

/controllers/front/OrderConfirmationController.php

$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,
   'description'=>$description
   ));

Iam using Prestashop 1.6.0.11 with PayPal official module v3.8.1

 

PS : the below code sucessfully send price (order price + shipping)

<img src="https://shareasale.com/sale.cfm?amount={$order.total_paid}&tracking={$order.id_order}&transtype=sale&merchantID=74223" width="1" height="1"> 
Edited by CWB (see edit history)
  • Like 1
  • Confused 1

Share this post


Link to post
Share on other sites

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More