Answer the question
In order to leave comments, you need to log in
How to dynamically get the cost based on the checked checkbox?
Hello! In general, an extraordinary task arose here, seemingly simple as two times two, but - I sat down in a puddle with it. So, the bottom line is this:
There is a button that, when clicked, opens the bootstrap 4 modal window. This form contains the yoomoney payment form, + 2 radio buttons, by switching which / you can select the payment option:
<form method="POST" action="https://yoomoney.ru/quickpay/confirm.xml">
<input id="radio-1" class="radio" type="radio" name="radioname" value="radio-block-1" /><label for="radio-1">Купить шаблон</label>
<input id="radio-2" class="radio" type="radio" name="radioname" value="radio-block-2" /><label for="radio-2">Купить шаблон + помощь по установке</label>
<div id="radio-block-1" class="radio-blocks" style="display:none">К оплате <strong><?php echo number_format($item['price'], 0, '', ' '); ?></strong> руб.</div>
<div id="radio-block-2" class="radio-blocks" style="display:none">К оплате <strong><?php echo number_format($item['price'] + 2000, 0, '', ' '); ?></strong> руб.</div>
<input type="hidden" name="receiver" value="4100117625208247"/>
<input type="hidden" name="formcomment" value="Покупка"/>
<input type="hidden" name="short-dest" value="товара"/>
<input type="hidden" name="label" value="$order_id"/>
<input type="hidden" name="quickpay-form" value="donate"/>
<input type="hidden" name="targets" value="<?php echo $item['title']; ?>"/>
<input type="hidden" name="sum" value="" data-type="number"/>
<input type="hidden" name="comment" value="Комментарий к платежу"/>
<input type="hidden" name="need-fio" value="true"/>
<input type="hidden" name="need-email" value="true"/>
<input type="hidden" name="need-phone" value="false"/>
<input type="hidden" name="need-address" value="false"/>
<input type="submit" value="Купить" class="item-btn btn-fill" style = "width: 100%; margin-top: 15px;" />
</form>
<input type="hidden" name="sum" value="ЗДЕСЬ ЦЕНА" data-type="number"/>
data from radio button 1 or radio button 2, whichever is checked. Answer the question
In order to leave comments, you need to log in
<input id="radio-1" class="radio" type="radio" name="sum" value="ЗДЕСЬ ЦЕНА">
<input id="radio-2" class="radio" type="radio" name="sum" value="ЗДЕСЬ ЦЕНА 2">
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question