Advertisement:

Author Topic: [Solved]Credit Message modification  (Read 744 times)

goodisme

  • Newbie
  • *
  • Posts: 24
[Solved]Credit Message modification
« on: August 22, 2017, 02:37:12 pm »
Hi Guys,

i have been trying to modify Payment Pro credit message with three different messages instead of the normal two.

can somebody take a look and tell me what is wrong with my code?

Code: [Select]
$wallet = ModelPaymentPro::newInstance()->getWallet(osc_logged_user_id());
    if(isset($wallet['i_amount']) && $wallet['i_amount'] > 4) {
        $credit_msg = sprintf(__('Top up your credit [Balance:%s]', 'payment_pro'), osc_format_price($wallet['i_amount'], payment_pro_currency()));
    } elseif(isset($wallet['i_amount']) && $wallet['i_amount'] > 0 && $wallet['i_amount'] < 5) {
        $credit_msg = __('You don't have enough to promote . Buy some credit.', 'payment_pro');
    } else {
        $credit_msg = __('Your wallet is empty. Buy some credit.', 'payment_pro');
    }
« Last Edit: August 23, 2017, 06:30:57 pm by goodisme »

_CONEJO

  • Administrator
  • Hero Member
  • *****
  • Posts: 4689
Re: Credit Message modification
« Reply #1 on: August 22, 2017, 02:45:10 pm »
amounts in the database are multiplied by 1000000 (2 digits for cents + 4 decimals required by most accounting software)

goodisme

  • Newbie
  • *
  • Posts: 24
Re: Credit Message modification
« Reply #2 on: August 23, 2017, 12:26:08 pm »
Hi _Conejo,

thanks for your response. First of all, this is the error code i receive when i run the code:

Parse error: syntax error, unexpected 't' (T_STRING), expecting ',' or ')' in /home/xxxxxxx/public_html/oc-content/plugins/payment_pro/user/packs.php on line 9

Secondly, is there a way to work around the amounts?

_CONEJO

  • Administrator
  • Hero Member
  • *****
  • Posts: 4689
Re: Credit Message modification
« Reply #3 on: August 23, 2017, 12:31:07 pm »
Change

Code: [Select]
$credit_msg = __('You don't have enough to promote . Buy some credit.', 'payment_pro');

to

Code: [Select]
$credit_msg = __('You don\'t have enough to promote . Buy some credit.', 'payment_pro');

Forr the amounts, just multiply by 1000000, for example

Code: [Select]
$wallet = ModelPaymentPro::newInstance()->getWallet(osc_logged_user_id());
    if(isset($wallet['i_amount']) && $wallet['i_amount'] > 4000000) {
        $credit_msg = sprintf(__('Top up your credit [Balance:%s]', 'payment_pro'), osc_format_price($wallet['i_amount'], payment_pro_currency()));
    } elseif(isset($wallet['i_amount']) && $wallet['i_amount'] > 0 && $wallet['i_amount'] < 5000000) {
        $credit_msg = __('You don'\t have enough to promote . Buy some credit.', 'payment_pro');
    } else {
        $credit_msg = __('Your wallet is empty. Buy some credit.', 'payment_pro');
    }

goodisme

  • Newbie
  • *
  • Posts: 24
Re:[Solved] Credit Message modification
« Reply #4 on: August 23, 2017, 06:30:14 pm »
Thanks _Conejo, It's working now  ;D