Thanks page not displaying user information

Discussion in 'Troubleshooting' started by dereck_j2, Jan 15, 2009.

  1. dereck_j2

    dereck_j2 Member

    Joined:
    Aug 22, 2006
    Messages:
    42
    Hi all,

    I am trying to display user information along with the payment info on the thanks.html page.

    I have read a lot of posts regarding this and I have follow all the advise given, but I am still having problems.

    To test the thanks.php script I removed:

    {if $payment.amount > "0.0"}
    and
    {/if}{* END Of receipt display *}

    so I can est with zero amounts.

    The script will not display uers or payment information. Can anyone put some light on this.

    Below is the thanks.php and thanks.html scripts.
    ++++++++++++++++++++++++++++++++++++++
    <?php

    $rd = dirname(__FILE__);
    include($rd.'/config.inc.php');



    $t = & new_smarty();
    $error = '';
    $vars = & get_input_vars();

    if (!strlen($paysys_id))
    $paysys_id = $vars['paysys_id'];

    if ($paysys_id){ //should be passed from url or plugins/payment/../thanks.php
    //process plugin work if payment system pass info to thanks page
    if (($error = plugin_validate_thanks($paysys_id, $vars))
    || ($error = plugin_process_thanks($paysys_id, $vars))
    ){
    $t->assign('error', $error);
    $t->display('thanks_error.html');
    exit();
    }
    }

    if (!$vars['member_id']) $vars['member_id'] = $_GET['member_id'];
    if (!$vars['product_id']) $vars['product_id'] = $_GET['product_id'];
    if (!$vars['payment_id']) $vars['payment_id'] = $_GET['payment_id'];

    if ($vars['member_id']){
    $t->assign('member', $db->get_user($vars['member_id']));
    }
    if ($vars['product_id']){
    $t->assign('product', $db->get_product($vars['product_id']));
    }

    if (!$vars['payment_id'])
    $vars['payment_id'] = $_SESSION['_amember_payment_id'];

    if ($vars['payment_id']){
    $pm = $db->get_payment($vars['payment_id']);
    /// iterate until we receive paypal postback
    $count = 0;
    while (($pm['paysys_id'] == 'paypal_r') && ($pm['receipt_id'] == '')){
    sleep(1);
    $pm = $db->get_payment($vars['payment_id']);
    if (++$count > 15) break;
    }

    $t->assign('payment', $pm);
    if ($pm) {
    $t->assign('product', $db->get_product($pm['product_id']));
    $t->assign('member', $db->get_user($pm['member_id']));
    }
    if (!($prices = $pm['data'][0]['BASKET_PRICES'])){
    $prices = array($pm['product_id'] => $pm['amount']);
    }
    $pr = array();
    $subtotal = 0;
    foreach ($prices as $product_id => $price){
    $v = $db->get_product($product_id);
    // $v['price'] = $price;
    $subtotal += $v['price'];
    $pr[$product_id] = $v;
    }
    $t->assign('subtotal', $subtotal);
    $t->assign('total', array_sum($prices));
    $t->assign('products', $pr);
    }
    $t->display("thanks.html");

    ?>
    ++++++++++++++++++++++++++++++++++++++
    ++++++++++++++++++++++++++++++++++++++
    {assign var="title" value=$smarty.const._TPL_THX_TITLE}
    {include file="header.html"}

    <strong>#_TPL_THX_ENJOY|<a href="{$config.root_url}/login.php">|</a>#</strong>
    <br />

    <!-- display payment receipt -->
    {if $payment.amount > "0.0"}

    #_TPL_THX_PAYPROC# <br />
    #_TPL_THX_ORDERREF|{$payment.payment_id}|{$payment.receipt_id}#<br />
    #_TPL_THX_DATETIME|{$payment.tm_completed|date_format:$config.time_format}#<br />

    <br /><br />

    <table class="receipt">
    <tr>
    <th>#_TPL_THX_PRDTITLE#</th>
    <th style="width: 10%; text-align: right;">#_TPL_THX_PRICE#</th>
    </tr>
    {foreach from=$products item=p}
    <tr>
    <td>{$p.title}</td>
    <td style="text-align: right">{$config.currency|default:"$"}{$p.price}</td>
    </tr>
    {/foreach}
    <tr>
    <td class="total"><strong>#_TPL_THX_SUBTOTAL#</strong></td>
    <td class="total" style="text-align: right"><strong>{$config.currency|default:"$"}{$subtotal|string_format:"%.2f"}</strong></td>
    </tr>
    {if $payment.data.COUPON_DISCOUNT ne "" }
    <tr>
    <td><strong>#_TPL_THX_DISCOUNT#</strong></td>
    <td style="text-align: right"><strong>{$config.currency|default:"$"}{$payment.data.COUPON_DISCOUNT|string_format:"%.2f"}</strong></td>
    </tr>
    {/if}
    {if $payment.tax_amount ne ""}
    <tr>
    <td><strong>#_TPL_THX_TAX#</strong></td>
    <td style="text-align: right"><strong>{$config.currency|default:"$"}{$payment.tax_amount|string_format:"%.2f"}</strong></td>
    </tr>
    {/if}
    <tr>
    <td class="total"><strong>#_TPL_THX_TOTAL#</strong></td>
    <td class="total" style="text-align: right"><strong>{$config.currency|default:"$"}{$total|string_format:"%.2f"}</strong></td>
    </tr>
    </table>
    <br /><br />


    {/if}{* END Of receipt display *}

    <p class="powered">#_TPL_POWEREDBY|<a href="http://www.amember.com/">|</a>#</p>

    {include file="footer.html"}
    ++++++++++++++++++++++++++++++++++++++

    Very best regards

    Dereck
  2. dereck_j2

    dereck_j2 Member

    Joined:
    Aug 22, 2006
    Messages:
    42
    Hi Zinta and thank you for your reply.

    Should not the aMember scripts display the value of the variables, after all, thats what they were wriiten for.

    Any other ideas

    Best regards

    Dereck

Share This Page