Mantas
Mantas

Reputation: 83

Facebook pixel for Prestashop

How in Prestashop get total to pay value on

order-confirmation.tpl page.

i have this

    <script>
    {literal}
    fbq('track', 'Purchase', {value: ????, currency: 'Eu'});
</script>{/literal}

How i can get total to pay value ? It's for facebook pixel. I'm new on Prestashop.

Upvotes: 1

Views: 718

Answers (2)

DigitalDot
DigitalDot

Reputation: 11

if you want to make it easier, you can use the free facebook pixel prestashop module compatible for version 1.6 and 1.7.

https://www.digitaldot.es/modulo-en-prestashop-para-el-pixel-de-facebook/

Regards

Upvotes: 0

Georgi Atanasov
Georgi Atanasov

Reputation: 28

Open the order confirmation controller (should be in \controllers\front\OrderConfirmationController.php)

Look at the code, there should be a part where the variables are assigned to the smarty tpl, you are looking for something like this:

 $this->context->smarty->assign(array(
        'HOOK_ORDER_CONFIRMATION' => $this->displayOrderConfirmation($order),
        'HOOK_PAYMENT_RETURN' => $this->displayPaymentReturn($order),
        'order' => $presentedOrder,
        'register_form' => $register_form,
    ));

Try adding a new variable there (i think that should work, because there should be already a variable "$order" defined with the current order information):

'total_paid' => $order->total_paid

Then you should be able to use it in order-confirmation.tpl :

<script>
{literal}
fbq('track', 'Purchase', {value: {/literal}$total_paid{literal}, currency: 'EUR'});
</script>
{/literal}

Note you should use the ISO 4217 standard for the currency, so for Euro its EUR

Upvotes: 1

Related Questions