Support » Themes and Templates » [Resolved] Getting correct Sum to show up on Danko Theme Fundraising Counter

[Resolved] Getting correct Sum to show up on Danko Theme Fundraising Counter

  • Got a complicated question!

    On our website: coastalfootprint.org

    There is a big and proud counter for the funds that have been raised. While it is awesome, it is doubling our total on us (giving us a false sense of accomplishment!)

    Here is what I found for the outputs for the numbers:

    global $wpdb;
    $querystr = “SELECT SUM(mc_gross) FROM ” . $wpdb->prefix . “paypal_transactions”;
    $pageposts = $wpdb->get_results($querystr, ARRAY_A);
    $transaction_sum = $pageposts[0] [“SUM(mc_gross)”];
    $transaction_sum = round($transaction_sum,0);
    $transaction_sum_str =(string)$transaction_sum;
    $transaction_array = str_split($transaction_sum_str);’

    The thing is, the “paypal_transactions” table that it is pulling its sum from has “completed” and “pending” entries – the pending doesn’t get deleted when a transaction is completed. So, for instance, if a person donates $100, the resulting sum would spit out $200, because the formula is totaling both the “completed” and “pending” transaction entries. But I don’t have a clue on how to change the formula to just total the “completed” transactions.

    Any ideas?

Viewing 5 replies - 1 through 5 (of 5 total)
  • esmi


    Forum Moderator

    I’m sorry but as you are using a commercially supported theme, you need to seek support from the theme’s developers. We only support themes downloaded from wordpress.org.

    esmi – thanks for the information! I did get this theme outside of wordpress.org but there are specific sections throughout the back-end where the creators specify what is/isn’t okay to edit – I am under the opinion that the section I am referring to is editable. At any rate (for those poor souls looking for knowledge scrapes) here is what I implemented to get the right SUM to show up:

    ”SELECT SUM(mc_gross)’
    . ‘ FROM wp_paypal_transactions’
    . ‘ WHERE payment_status=\’Completed\”
    . ‘ GROUP BY payment_status’;’

    i have this same problem. thanks for posting the code that makes it work. I’m not totally understanding your syntax, so i may repost for some guidance if i can’t get it working… thanks again.

    Moderator Andrew Nevins


    Forum moderator

    You ought to discuss your findings in your own thread because this is marked resolved.

    to other poor souls: on header.php, replace line 180 with

    $querystr = ("SELECT SUM(mc_gross) FROM wp_paypal_transactions  WHERE payment_status='Completed'  GROUP BY payment_status");

    and in front-page.php, replace line 230 with the same.
    works great!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘[Resolved] Getting correct Sum to show up on Danko Theme Fundraising Counter’ is closed to new replies.