Osclass forums
Support forums => Plugins => Plugin Payments => Topic started 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?
$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');
}
-
amounts in the database are multiplied by 1000000 (2 digits for cents + 4 decimals required by most accounting software)
-
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?
-
Change
$credit_msg = __('You don't have enough to promote . Buy some credit.', 'payment_pro');
to
$credit_msg = __('You don\'t have enough to promote . Buy some credit.', 'payment_pro');
Forr the amounts, just multiply by 1000000, for example
$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');
}
-
Thanks _Conejo, It's working now ;D