Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- global $foxyshop_settings;
- $product = array("code" => "donation");
- ?>
- <form action="https://<?php echo esc_attr($foxyshop_settings['domain']); ?>/cart" method="post" accept-charset="utf-8">
- <input type="hidden" name="name<?php echo foxyshop_get_verification('name', 'Donation'); ?>" value="Donation" />
- <input type="hidden" name="code<?php echo foxyshop_get_verification('code', 'donation'); ?>" value="donation" />
- <label for="donate_500"><input type="radio" name="__donation" id="donate_500" value="500" />$500</label>
- <label for="donate_250"><input type="radio" name="__donation" id="donate_250" value="250" />$250</label>
- <label for="donate_100"><input type="radio" name="__donation" id="donate_100" value="100" />$100</label>
- <label for="donate_50"><input type="radio" name="__donation" id="donate_50" value="50" />$50</label>
- <label for="donate_0"><input type="radio" name="__donation" id="donate_0" value="0" />Other</label>
- <label class="donate_other" for="price">Please specify</label>
- <input type="text" name="price<?php echo foxyshop_get_verification('price', '--OPEN--'); ?>" id="price" class="donate_other" value="0" />
- <input type="submit" value="Add To Cart">
- </form>
- <script type="text/javascript" charset="utf-8">
- jQuery(function($) {
- $(".donate_other").hide();
- $("input[name='__donation']").change(function() {
- toggle_donation();
- });
- // Update the price based on preselected donation value if there is one
- if ($("input[name='__donation']:checked").length > 0) {
- toggle_donation();
- }
- });
- function toggle_donation() {
- var cur_donation = jQuery("input[name='__donation']:checked").val();
- if (cur_donation > 0) {
- jQuery("#price").val(cur_donation);
- jQuery(".donate_other").hide();
- } else {
- jQuery("#price").val("");
- jQuery(".donate_other").show();
- }
- }
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement