Osclass forums

Support forums => Plugins => Plugin Payments => Topic started by: goodisme on August 22, 2017, 02:37:12 pm

Title: [Solved]Credit Message modification
Post by: goodisme 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');
    }
Title: Re: Credit Message modification
Post by: _CONEJO 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)
Title: Re: Credit Message modification
Post by: goodisme 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?
Title: Re: Credit Message modification
Post by: _CONEJO 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');
    }
Title: Re:[Solved] Credit Message modification
Post by: goodisme on August 23, 2017, 06:30:14 pm
Thanks _Conejo, It's working now  ;D