Results 1 to 2 of 2
  1. #1
    Join Date
    Sep 2008
    Posts
    4
    Plugin Contributions
    0

    Default How can I get subtotal value at the checkout success page?

    I did some looking around and have found and examined the $orders object at the checkout success page. What I am doing is including a tracking pixel into the checkout success page so that the pixel will send a bit of information to an external program I wish to use. The pixel will report the amount of the sale and the sale ID to the external system. I used the Define Pages Editor and selected "define_checkout_success.php" page.

    In here, I would include piece of HTML like this:

    <img src="http://mysite.com/tracking_sales/my_code/<?= $orders->fields['total_amount']; ?>/<?= $orders->fields['orders_id']; ?>/">

    This is almost perfect, except that the total_amount field includes the products as well as shipping costs. I looked through the $orders->fields array and it doesn't even have the shipping amount as a separate field so that I could subtract shipping total from order total to get my subtotal. I need to be able to report the order total without shipping included. Does anyone know if this is available at this page somehow? Or if there's at least a way to get the shipping total to do math to get my subtotal?

    Thanks in advance.

  2. #2
    Join Date
    Sep 2008
    Posts
    4
    Plugin Contributions
    0

    Default Re: How can I get subtotal value at the checkout success page?

    Well, I couldn't come up with any better solution for this, so I am just going to query the subtotal from the database within the checkout success template like so:

    Code:
    // $st_result = $db->Execute("SELECT ROUND(value, 2) subtotal FROM orders_total WHERE class='ot_subtotal' AND orders_id = '{$orders->fields['orders_id']}'");
    $st_result->fields['subtotal']; // <- this is the subtotal pre-shipping

 

 

Similar Threads

  1. How do I format the Checkout Success page?
    By rcnenni in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 20 Jan 2014, 01:19 AM
  2. subtotal in the checkout page
    By keneso in forum General Questions
    Replies: 2
    Last Post: 20 Jun 2011, 06:14 PM
  3. How to get Order Summary on checkout success?
    By jenbullfrog in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 7 Jan 2010, 07:18 PM
  4. How do I display Postback results on the Checkout Success Page?
    By toboldlygo in forum Built-in Shipping and Payment Modules
    Replies: 0
    Last Post: 12 Jan 2008, 04:29 AM
  5. Passing Subtotal to Checkpout Success Page?
    By Picci in forum General Questions
    Replies: 3
    Last Post: 30 Oct 2007, 12:42 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg