Advertisement:

Author Topic: Display user wallet credit on user dashboard  (Read 2409 times)

ezybusy

  • Full Member
  • ***
  • Posts: 193
Display user wallet credit on user dashboard
« on: June 01, 2016, 03:29:31 am »

Hi everyone,
i am using the plugin Payment pro on my website. I have turned on the option Allow users's wallets which is the only payment option for my website that allow users to set their ads as premium.

Now i want to display users credit balance on the user dashboard, so that they can have a constant look at their credit balance anytime they log into their account. Something similar to the following:
- You have $100 of premium credit into your account. (To display if the user has credit)
- Insufficient premium credit, contact the admin to load your account.  (To display in case the user credit is 0).

I contacted the support team for the plugin regarding the above, and got the following answer:

You could use the following code to display user's credit:
Code: [Select]
$wallet = ModelPaymentPro::newInstance()->getWallet(osc_logged_user_id());
    if(isset($wallet['i_amount']) && $wallet['i_amount']>0) {
        $credit_msg = sprintf(__('Your current credit is %s', 'payment_pro'), osc_format_price($wallet['i_amount'], osc_get_preference('currency', 'payment_pro')));
    } else {
        $credit_msg = __('Your wallet is empty. Buy some credits.', 'payment_pro');
    }
[/b]

Then i tried inserting the above code on the user-dashboard.php page as a php code (in between <?php and ?>) but got an error.
Upon contacting the support team to let them know about the error, i was told the following:
You need to later print/echo the $credit_msg variable to display the text.

However i don't know how to do the above. Can someone help me out?

regards,

_CONEJO

  • Administrator
  • Hero Member
  • *****
  • Posts: 4689
Re: Display user wallet credit on user dashboard
« Reply #1 on: June 01, 2016, 11:52:45 am »
With

Code: [Select]
echo $credit_msg;

ezybusy

  • Full Member
  • ***
  • Posts: 193
Re: Display user wallet credit on user dashboard
« Reply #2 on: June 01, 2016, 12:35:46 pm »
Thank you for the reply _CONEJO .
Can you please describe the whole process of what I have to do.
Where do I place the code that the support tem gave me?
Where do I place the single line of code that you gave me?

_CONEJO

  • Administrator
  • Hero Member
  • *****
  • Posts: 4689
Re: Display user wallet credit on user dashboard
« Reply #3 on: June 01, 2016, 12:41:45 pm »
First, It was me who gave you support, as it's me who did the plugin. We offer support for bugs and errors, but we can not offer customization work for free.

If you don't know the very basic of PHP, your best shot is to hire a professional to do the changes for you, less time waste.

You could put the code wherever you want it to appear,, be it user-dashboard.php if or any other file in your theme.

Code: [Select]
$wallet = ModelPaymentPro::newInstance()->getWallet(osc_logged_user_id());
    if(isset($wallet['i_amount']) && $wallet['i_amount']>0) {
        $credit_msg = sprintf(__('Your current credit is %s', 'payment_pro'), osc_format_price($wallet['i_amount'], osc_get_preference('currency', 'payment_pro')));
    } else {
        $credit_msg = __('Your wallet is empty. Buy some credits.', 'payment_pro');
    }
echo $credit_msg;

ezybusy

  • Full Member
  • ***
  • Posts: 193
Re: Display user wallet credit on user dashboard
« Reply #4 on: June 01, 2016, 05:48:15 pm »
Alright _CONEJO.
Thank you for your help.

campusmart

  • Newbie
  • *
  • Posts: 34
Re: Display user wallet credit on user dashboard
« Reply #5 on: January 30, 2017, 03:24:56 pm »
Thanks, it works!!!

_CONEJO

  • Administrator
  • Hero Member
  • *****
  • Posts: 4689
Re: Display user wallet credit on user dashboard
« Reply #6 on: May 06, 2017, 11:12:29 am »
Dear webhostpune,

Please, do not hijack a thread to ask questions not related to it, open a new one.

Payments Pro doesn't include PayuMoney, but there's already a plugin in the market for it, take a look a : https://market.osclass.org/plugins/payments/payumoney_549

Regards