Answer the question
In order to leave comments, you need to log in
Why doesn't counting work in php and smarty?
Hello, I have such a problem, there
is the same output in the template on 3 pages
{if isset($credits_allowed) && $credits_allowed && !$nologin}
<div class="option clearfix" id="div_credits" {if !$total}style="display: none;"{/if}>
<input type="hidden" name="credit_value" id="credit_value" value="{$credits_settings.unit}"/>
<input type="hidden" name="current_credits" id="current_credits" value="{$current_credits}"/>
<div class="option_left">{$lng.credits.balance}</div>
<div class="option_right"><b>{if $current_credits>0}{$lng.credits.you_currently_have} <span class="price">
{$current_credits}
{if $current_credits==1}{$lng.credits.scredit}{else}{$lng.credits.scredits}{/if}</span>{else}
{$lng.credits.you_currently_have_no_credits}{/if}</b><br/>
<br/>
<label style="line-height: 30px;" class="freeradiog">
<input type="radio" class="noborder" name="processor" value="credits"
{if $current_credits>=$needed_credits}checked="checked"{else}disabled="disabled"{/if}/>
<div class="radio__textg"></div>
{$lng.credits.pay_using_credits}<span id="not_enough_credits" {if $current_credits==0 ||
$current_credits>=$needed_credits}style="display: none;"{/if}>
( {$lng.credits.not_enough_credits} )</span>
<!--<span id="no_credits" {if $current_credits==0 || $current_credits<$needed_credits}style="display: none;"
{/if}> ( <span id="needed_credits">{$needed_credits}</span> <span id="scredit"
{if $needed_credits>1}style="display: none;"{/if}>{$lng.credits.scredit}</span>
<span id="scredits" {if $needed_credits==1}style="display: none;"{/if}>{$lng.credits.scredits}</span> )-->
</span>
</label>
</div>
</div>
{/if}
<!--<span id="no_credits" {if $current_credits==0 || $current_credits<$needed_credits}style="display: none;"
{/if}> ( <span id="needed_credits">{$needed_credits}</span> <span id="scredit"
{if $needed_credits>1}style="display: none;"{/if}>{$lng.credits.scredit}</span>
<span id="scredits" {if $needed_credits==1}style="display: none;"{/if}>{$lng.credits.scredits}</span> )-->
$needed_credits
, if more points are selected than the user has, then it should instead of numbers, the inscription "not enough points" appears here {$lng.credits.pay_using_credits}
and all this should happen without refreshing the page, but this does not happen. The current value of how many points the user has is this line $current_credits
with which the required points are compared $needed_credits
. $needed_credits
But for some reason, the script cannot add the selected values to , respectively, and cannot compare with $current_credits
either. But php knows for sure that points are still not enough, so further actions are impossible.<!--<span id="no_credits" {if $current_credits==0 || $current_credits<$needed_credits}style="display: none;"
{/if}> ( <span id="needed_credits">{$needed_credits}</span> <span id="scredit"
{if $needed_credits>1}style="display: none;"{/if}>{$lng.credits.scredit}</span>
<span id="scredits" {if $needed_credits==1}style="display: none;"{/if}>{$lng.credits.scredits}</span> )-->
Answer the question
In order to leave comments, you need to log in
there should be errors in the logs, most likely not all variables were transferred. It's easier to use "{if (!empty($needed_credits))}" instead of "{if $needed_credits==1}" and "{if $needed_credits>1}"
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question