• Resolved Majklas

    (@majklas)


    how is this possible? Page is proje.ct/store/shopping-cart/confirmation/
    I know this must be done after

    } else if ($type == 'confirmation') {

    but none of the variables ($_SESSION nor $mp) having order total figure. Also

    echo $mp->format_currency('', $total);

    there gives me 0.00 USD
    Is there any way to get total order sum from the table one step back?
    Very looking forward into this..

    https://www.ads-software.com/extend/plugins/wordpress-ecommerce/

Viewing 7 replies - 1 through 7 (of 7 total)
  • Hello there @majklas, I hope you’re well today!
    Have you tried any of the functions in the template-functions.php file?

    Thread Starter Majklas

    (@majklas)

    Hello aristath, this is an honor to see You here ??
    I’m not that good programmer and havent tried any of functions, I just think that information about order is not passed to the last page. How to get it – I can’t figure this out..

    Hello again @majklas!
    On closer investigation you can’t do it with the functions the template-functions.php file.

    Where exactly did you try to put the echo $mp->format_currency('', $total); code?
    What exactly are you trying to achieve?

    Please elaborate,
    Ari.

    Thread Starter Majklas

    (@majklas)

    I’m trying to show user payment details on the last, thank-you, page.
    This is the code I’m having now in template-functions.php:

    else if ($type == 'confirmation') {
    
        //if skipping a step
        if (empty($_SESSION['mp_payment_method'])) {
          //$content .= '<div class="mp_checkout_error">' . sprintf(__('Whoops, looks like you skipped a step! Please <a href="%s">go back and try again</a>.', 'mp'), mp_checkout_step_url('checkout')) . '</div>';
        }
    
        //gateway plugin message hook
        $content .= apply_filters( 'mp_checkout_payment_confirmation_' . $_SESSION['mp_payment_method'], '', $mp->get_order($_SESSION['mp_order']) );
    
        //tracking information
        $track_link = '<a href="' . mp_orderstatus_link(false, true) . $_SESSION['mp_order'] . '/' . '">' . mp_orderstatus_link(false, true) . $_SESSION['mp_order'] . '/' . '</a>';
    	$orderio_id = $_SESSION['mp_order'];
    	$content .= '<p>' . sprintf(__('Order id:%1$s <br/>You may track the latest status of your order(s) here:<br />%2$s', 'mp'), $orderio_id, $track_link) . '</p>';
    
        //add ecommerce JS
        $mp->create_ga_ecommerce( $mp->get_order($_SESSION['mp_order']) );
    
        //clear cart session vars
        unset($_SESSION['mp_payment_method']);
        unset($_SESSION['mp_order']);
      }

    How can add to sprintf total sum of all order (incl. shipment/taxes/payment/etc.)? I know it should be like:
    $content .= '<p>' . sprintf(__('Order id:%1$s <br/>Total sum:%3$s<br/>You may track the latest status of your order(s) here:<br />%2$s', 'mp'), $orderio_id, $track_link, $total_order_sum) . '</p>';
    how can I get $total_order_sum variable from order info?

    I haven’t tested this… but this was suggested by my colleague:

    $order = $mp->get_order($_SESSION['mp_order']);
    $total_order_sum = $order->mp_payment_info['total'];

    Try that and see if it does what you’re looking for.

    Thread Starter Majklas

    (@majklas)

    super! ?? You rock! Thank You for this code, it really gives me order total. Just to have it right way, pass it through format_currency:

    $total_order_sum = $mp->format_currency($order->mp_payment_info['currency'], $order->mp_payment_info['total']);

    Great! ?? (I learnt somethign new myself there! ?? )

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘get total sum or order in thank-you page?’ is closed to new replies.