Support Forums - Classified Ads Script Osclass
Osclass plugin support => Osclass Pay Plugin => Topic started by: atba on January 30, 2022, 08:39:30 AM
-
Hello. Help insert the balance in the required place in the code...
<?php echo $credit_msg; ?>
Here she is in index.php:
function osp_user_sidebar () {
if(osc_current_web_theme() == 'veronika' || osc_current_web_theme() == 'stela' || osc_current_web_theme() == 'starter' || @USER_MENU_ICONS == 1 ) {
echo '<li class="opt_osp_payment"><a href="' . osc_route_url('osp-item') . '" >' . __('Wallet', 'osclass_pay') . '</a></li>';
}
else {
echo '<li class="opt_osp_payment"><a href="' . osc_route_url('osp-item') . '" >' . __('Promotions', 'osclass_pay') . '</a></li>';
}
}
It turned out everywhere, in this case I tried everything, but the browser eventually comments on part of the code and the balance is not displayed.
-
@atba
what is behind variable $credit_msg ?
-
$user_id = osc_logged_user_id();
$currency = osp_currency();
$symbol = osp_currency_symbol();
$packs = osp_get_user_packs($user_id);
$wallet = osp_get_wallet();
$style = (osp_param('pack_style') == 1 ? 'gallery' : 'list');
$group = ModelOSP::newInstance()->getGroup(osp_get_user_group());
@$user = User::newInstance()->findByPrimaryKey($user_id);
if($currency == 'BTC') {
$amount = isset($wallet['formatted_amount']) ? $wallet['formatted_amount'] : 0;
$formatted_amount = osp_format_btc($amount);
$credit_msg = sprintf(__('Buy Credit pack to save time with checkout. Your current credit is %s', 'osclass_pay'), '<strong>' . $formatted_amount . '</strong >');
} else {
$amount = isset($wallet['i_amount']) ? $wallet['i_amount'] : 0;
if($amount != 0) {
$formatted_amount = osp_format_price(osp_price_divide($amount)/1000000);
$credit_msg = sprintf(__('%s', 'osclass_pay'), '<strong style="margin:0 0 0 10px;clear: none;display:inline-block;font-size:14px;text-decoration:none;font-family:Open Sans,Arial,Helvetica,Verdana,sans-serif!important;font-weight: 500!important;">' . $formatted_amount . '</strong>');
} else {
$credit_msg = __('<strong style="margin:0 0 0 10px;clear: none;display:inline-block;font-size:14px;text-decoration:none;font-family: Open Sans,Arial,Helvetica,Verdana,sans-serif!important;font-weight: 500!important;">0.00 р. </strong>', 'osclass_pay');
}
}
function osp_user_sidebar() {
if(osc_current_web_theme() == 'veronika' || osc_current_web_theme() == 'stela' || osc_current_web_theme() == 'starter' || @USER_MENU_ICONS == 1 ) {
echo '<li class="opt_osp_payment"><a href="https://test-site-test.com/payment/pack" ><i class="fas fa-wallet"></i> ' . __('<p style="color:#fff;">Wallet</p>', 'osclass_pay') . ' <strong style="font-family: Open Sans,Arial,Helvetica,Verdana,sans-serif!important;font-weight: 500!important;">
<?php echo $credit_msg; ?>
</strong></a></li>';
}
else {
echo '<li class="opt_osp_payment"><a href="' . osc_route_url('osp-item') . '" >' . __('Promotions', 'osclass_pay') . '</a></li>';
}
}
-
Sorry I am lost.
-
@atba
what is behind variable $credit_msg ?
Maybe I didn't understand your question?
-
@atba
Not sure what you want to achieve, seems you already have all needed codes.
-
Yes, I understand) It works everywhere I put it, except index.php (Osclass Pay). The balance is not displayed and is automatically commented by the browser. What if <?php echo $credit_msg; ?> i take out the quotes, it works, but of course it is not displayed in the right place.
-
@atba
This should do it:
<?php echo osp_get_wallet(osc_logged_user_id()); ?>
-
That solved the problem.
<?php
if(osc_is_web_user_logged_in()) {
$wallet = osp_get_wallet(osc_logged_user_id());
$credit = osp_format_price($wallet['formatted_amount']);
echo $credit;
}
?>
Thanks for the help
-
Cool :)