DimaK Posted July 17, 2018 Share Posted July 17, 2018 Hello, For Google Conversion Tracking I have to add code to "complate.tpl". Also I think we should use var google_conversion_value = {$amount}; to get sale amount. But my site have 3 currencies! {$amount} - show just digits in any currency, but to Google, for statistics I alwas must submit only one USD. How to get {$amount} converted from any currency to USD ? Thanks. 0 Quote Link to comment Share on other sites More sharing options...
Kian Posted July 17, 2018 Share Posted July 17, 2018 (edited) Use ClientAreaPage action hook to recalculate {$amount} in complete.tpl. <?php use WHMCS\Database\Capsule; function somePrefix_ClientAreaPage($vars) { if ($vars['filename'] == 'cart' AND $_GET['a'] == 'complete') { $convertTo = 'USD'; // It's set to USD since Google needs it $clientCurrencyID = $vars['clientdetails']['currency']; $currency = Capsule::table('tblcurrencies')->select(['code', 'rate', 'default'])->where('id', '=', $clientCurrencyID)->first(); if ($currency->code != $convertTo AND $currency->default == '0') { $output['amount'] = $vars['amount'] / $currency->rate; return $output; } } } add_hook('ClientAreaPage', 1, 'somePrefix_ClientAreaPage'); Edited July 17, 2018 by Kian 1 Quote Link to comment Share on other sites More sharing options...
DimaK Posted July 17, 2018 Author Share Posted July 17, 2018 Thank you ! I have put this code to my Actionhooks.php and will test. 0 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.