Jump to content

Retirive order amount in complete page


aliman

Recommended Posts

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.

Link to comment
Share on other sites

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.

 

 

Link to comment
Share on other sites

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;
});

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated