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.
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