aliman Posted October 10, 2017 Share Posted October 10, 2017 Hello, we are using whmcs V7 with SIX template, we are trying to retrieve the variable order amount (total) and show it on the complete order page, unfortunately we only can get invoiceid variable, can you please help me regards 0 Quote Link to comment Share on other sites More sharing options...
aliman Posted October 12, 2017 Author Share Posted October 12, 2017 any one can help !!!!! 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted October 12, 2017 Share Posted October 12, 2017 On 10/10/2017 at 4:04 PM, aliman said: we are using whmcs V7 with SIX template, we are trying to retrieve the variable order amount (total) and show it on the complete order page, unfortunately we only can get invoiceid variable, can you please help me if the total isn't available in the complete.tpl (and off-hand I can't remember one way or the other), then with the invoiceID, you could always query the db to get the total... or you could use the ShoppingCartCheckoutCompletePage action hook to display your total. your first step might be to add {debug} to the end of the code in complete.tpl and when you next load the page, it should contain a popup window of available variables - if you're in luck, there will be a total / amount variable for you to use. 0 Quote Link to comment Share on other sites More sharing options...
aliman Posted October 12, 2017 Author Share Posted October 12, 2017 16 minutes ago, brian! said: if the total isn't available in the complete.tpl (and off-hand I can't remember one way or the other), then with the invoiceID, you could always query the db to get the total... or you could use the ShoppingCartCheckoutCompletePage action hook to display your total. your first step might be to add {debug} to the end of the code in complete.tpl and when you next load the page, it should contain a popup window of available variables - if you're in luck, there will be a total / amount variable for you to use. thank you Brian, i have already used {debug} to get page variable, the popup shows that i can't get order amount, so i have tried to use ShoppingCartCheckoutCompletePage action hook as you said using this code in my hook: <?php add_hook('ShoppingCartCheckoutCompletePage', 1, function($vars) { /** * Redirect all orders to a different page after the order complete page is loaded. */ $amount = Capsule::table('tblinvoices')->select('name', 'email')->where('id', '=', $invoiceid)->get(); return $amount; }); but i get empty value. 0 Quote Link to comment Share on other sites More sharing options...
aliman Posted October 12, 2017 Author Share Posted October 12, 2017 correct code is <?php add_hook('ShoppingCartCheckoutCompletePage', 1, function($vars) { /** * Redirect all orders to a different page after the order complete page is loaded. */ $amount = Capsule::table('tblinvoices')->select('total')->where('id', '=', $invoiceid)->get(); return $amount; }); 0 Quote Link to comment Share on other sites More sharing options...
brian! Posted October 13, 2017 Share Posted October 13, 2017 technically, because you only want one value and not an array, you could do this too... $amount = Capsule::table('tblinvoices') ->where('id', $invoiceid) ->value('total'); 0 Quote Link to comment Share on other sites More sharing options...
aliman Posted October 13, 2017 Author Share Posted October 13, 2017 thank you Brian, unfortunately, as i forward directly to the payment gateway, I discovered that my complete order page is only the content of forwardpage.tpl so i can't use any hook !! any suggestion please ? 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.