Jump to content

Display Paypal Balance on Homepage


trappedatuf

Recommended Posts

Just thought I would show what I have done with this mod. I have modified the original code somewhat as well.

It uses Java to open and close the window of transactions.

I will get a chance to finish it off one of these days and add in the refund buttons.

 

 

The screens look LEET. Hoping to see an update ;)

Link to comment
Share on other sites

  • Replies 116
  • Created
  • Last Reply

Top Posters In This Topic

I might modify it so that I can show multiple currencies and also include another paypal the same way as a second box :)

 

as I have 2 different paypal accounts one for US one for EU customers (dont ask why its complicated).

 

if I get to do the modifications ill post them.

 

 

(Sorry for creating a second post but I wasn't able to edit it since 15 minutes had passed.)

Link to comment
Share on other sites

If you are getting a blank page it would mean that either the included file can't be found or that there is an error like cannot re declare a function.

 

Try removing the code for the old paypal mod and try it again.

To see the error put this line in your configuration.php file in your whmcs root

$display_errors = 'on';

Link to comment
Share on other sites

If you are getting a blank page it would mean that either the included file can't be found or that there is an error like cannot re declare a function.

 

Try removing the code for the old paypal mod and try it again.

To see the error put this line in your configuration.php file in your whmcs root

$display_errors = 'on';

 

Any way to get your code so that only Full Administrators can see the Paypal balance and not visible to any other operator.

Link to comment
Share on other sites

replace the added paypalbalance code in homepage.tpl with this

{php} 
$result = select_query("tbladminroles","id",array("id"=>$_SESSION['adminid']));
$data = mysql_fetch_array($result);
$this->assign('roleid', $data['id']);
{/php}
{if $roleid == "1"}
{literal}
<script language="javascript">
function togglepaypaltrans() {
   if (document.getElementById('paypaltrans').style.display=="none") {
       document.getElementById('paypaltrans').style.display="block";
   } else {
       document.getElementById('paypaltrans').style.display="none";
   }
}
</script>
{/literal}

{include_php file="PayPalBalance/GetBalance.php"}
<div align="right" style="position:absolute;top:25px;right:410px;width:200px;">
   <table width="100%" cellspacing="1" cellpadding="0" bgcolor="#8FBCE9">
       <tr>
           <td bgcolor="#ffffff">
               <table width=100% cellpadding=2>
                   <tr><td align="left" colspan="2" bgcolor="#EFF2F9" nowrap><img vspace="2" hspace="10" src="PayPalBalance/images/paypal_logo.png" align="left" /><strong>Account Balance</strong></td></tr>
                   <tr><td align="right" nowrap>Account Balance</td><td bgcolor="#EFF2F9"" nowrap><strong>{if $paypalfail} {$paypalfail}{else} ${$paypalbalance} {$paypalcurrency}{/if}</strong></td></tr>
                   <tr><td align="center" nowrap colspan="2">{$paypaltimestamp} GMT</td></tr>
                   <tr><td align="center" nowrap colspan="2"><a href="#" onclick="togglepaypaltrans(); return false;"><strong>{$paypaltransactiontext}</strong> »</a></td></tr>
               </table>
           </td>
       </tr>
   </table>
</div>

<div style="display:none;" id="paypaltrans">
   <div align="right" style="position:absolute;top:135px;left:110px;z-index:100;max-height:500px;overflow:auto;border:2px #ccc solid;">
       {$paypaltransactions}
   </div>
</div>
{/if}

Link to comment
Share on other sites

{php} 
$result = select_query("tbladminroles","id",array("id"=>$_SESSION['adminid']));
$data = mysql_fetch_array($result);
$this->assign('roleid', $data['id']);
{/php}
{if $roleid == "1"}
...
{/if}

Steve, I'm not sure, but I think the logic of the if statement is wrong. For me, I am only seeing the paypal box for the user id of 1, not the roleid of 1. For instance, I have a user that is id 3, but the roleid is set to 1. If I insert a debug line to print the value of $roleid for that user, I get 3. I'm new to embedding php in smarty, so I'm having a time figuring out the select_query function, but I'm not seeing where you select the roleid of the $_SESSION['adminid'].

 

Can someone verify and suggest a fix?

 

Thanks,

-Eric

Link to comment
Share on other sites

swap tbladminroles to tbladmins and it'll work :)

 

Thanks for pointing that out, Rob. Simple change, big help.

 

For those that want the right code, use this bit (slightly modified from the original post by Steve):

 

{php}
$result = select_query("tbladmins","roleid",array("id"=>$_SESSION['adminid']));
$data = mysql_fetch_array($result);
$this->assign('roleid', $data['roleid']);
{/php}
{if $roleid == "1"}
...

 

This will only show the PayPal balance to those users in the "Full Administrator" group. If you want to change it to show for users in another group, just change the logic in '{if $roleid == "1"}'.

 

-Eric

Link to comment
Share on other sites

If you haven't already done so, you need to log into Paypal and enable an API username and password, and along with that you will get an API signature. These are the items you will need to get the balance. It took me a few minutes of poking around on Paypal's site to just give up and use their search function. I searched for 'API' and I think the right page was the 3rd or 4th item down.

 

If you already are using the API username/password/signature, then the post doesn't answer your question this time.

 

-Eric

 

I looked at the APIs but which should I choose?

Link to comment
Share on other sites

  • 4 weeks later...

I need some help I have got Steve's code working but :

 

1, It is showing in as $000.00 GBP so how do I change the code to show it right as £000.00 GBP?

 

2, I have 2 Currencies setup in my paypal account

a, British Pound (Primary)

b, US Dollars

So how can I show them all?

 

3, and I also have in my Paypal account PayPal balance box at the top "Current Total in GBP:" so how can I show this to?

Link to comment
Share on other sites

I need some help I have got Steve's code working but :

 

1, It is showing in as $000.00 GBP so how do I change the code to show it right as £000.00 GBP?

 

2, I have 2 Currencies setup in my paypal account

a, British Pound (Primary)

b, US Dollars

So how can I show them all?

 

3, and I also have in my Paypal account PayPal balance box at the top "Current Total in GBP:" so how can I show this to?

1. In your homepage.tpl find this line and change the highlighted (bolded) character for your currency symbol

<tr><td align="right" nowrap>Account Balance</td><td bgcolor="#EFF2F9"" nowrap><strong>{if $paypalfail} {$paypalfail}{else} [b]$[/b]{$paypalbalance} {$paypalcurrency}{/if}</strong></td></tr>

2. & 3. By default the PayPal API I believe only retrieves the default currency set in your paypal account.

 

Is this working for 4.0?

Yes it works in V4

Link to comment
Share on other sites

1. In your homepage.tpl find this line and change the highlighted (bolded) character for your currency symbol

<tr><td align="right" nowrap>Account Balance</td><td bgcolor="#EFF2F9"" nowrap><strong>{if $paypalfail} {$paypalfail}{else} [b]$[/b]{$paypalbalance} {$paypalcurrency}{/if}</strong></td></tr>

 

Thanks for that i have just removed the symbol and it look better as you have the {$paypalcurrency} pulled in anyway.

 

Do you know the line in the GetBalance.php so I can take out the same symbol out of that page?

 

Thanks

 

P.s this forum should look at putting the "Thanks" mod on the forum so we could then see the post's to trust and the ones not to trust?

 

http://www.vbulletin.org/forum/showthread.php?t=165673

Edited by thehost5968
Link to comment
Share on other sites

it should be on line 115 in 3 places (have marked them in bold)

$tmptrans .= '<tr align="center" bgcolor="'.(($resArray["L_AMT".$ID] > 0) ? "#ffffff" : "#ffcccc").'"><td>'.$type.'</td><td>'.$transactionID.'</td><td nowrap>'.$timeStamp.'</td><td>'.$status.'</td><td>'.$payerName.'<br />'.$payerEmail.'</td><td nowrap>[b]$[/b]'.$amount.' '.$ppcurrency.'</td><td nowrap>[b]$[/b]'.$ppfee.' '.$ppcurrency.'</td><td nowrap>[b]$[/b]'.$net.' '.$ppcurrency.'</td></tr>';

Link to comment
Share on other sites

it should be on line 115 in 3 places (have marked them in bold)

$tmptrans .= '<tr align="center" bgcolor="'.(($resArray["L_AMT".$ID] > 0) ? "#ffffff" : "#ffcccc").'"><td>'.$type.'</td><td>'.$transactionID.'</td><td nowrap>'.$timeStamp.'</td><td>'.$status.'</td><td>'.$payerName.'<br />'.$payerEmail.'</td><td nowrap>[b]$[/b]'.$amount.' '.$ppcurrency.'</td><td nowrap>[b]$[/b]'.$ppfee.' '.$ppcurrency.'</td><td nowrap>[b]$[/b]'.$net.' '.$ppcurrency.'</td></tr>';

 

Thanks you are the best.

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