Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //This code goes in foxyshop-single-product.php in the custom code section
- ?>
- <script type="text/javascript">
- jQuery(document).ready(function($){
- $(".variation-payment-type").change(function() {
- update_payment_options();
- });
- //Set Defaults
- $("#fs_sub_frequency_<?php echo $product['id']; ?>").attr("name", "sub_frequency<?php echo foxyshop_get_verification("sub_frequency", "--OPEN--"); ?>");
- $("#fs_sub_enddate_<?php echo $product['id']; ?>").attr("name", "sub_enddate<?php echo foxyshop_get_verification("sub_enddate", "--OPEN--"); ?>");
- update_payment_options();
- });
- function update_payment_options() {
- var current_payment_option = $("select.variation-payment-type").val();
- if (current_payment_option.match(/Buy Now/gi)) {
- $("#fs_sub_frequency_<?php echo $product['id']; ?>").val("");
- $("#fs_sub_enddate_<?php echo $product['id']; ?>").val("");
- }
- if (current_payment_option.match(/3 Month/gi)) {
- $("#fs_sub_frequency_<?php echo $product['id']; ?>").val("3m");
- $("#fs_sub_enddate_<?php echo $product['id']; ?>").val("<?php echo date('Y-m-d', strtotime('+2 months +25 days')); ?>");
- }
- if (current_payment_option.match(/6 Month/gi)) {
- $("#fs_sub_frequency_<?php echo $product['id']; ?>").val("6m");
- $("#fs_sub_enddate_<?php echo $product['id']; ?>").val("<?php echo date('Y-m-d', strtotime('+5 months +25 days')); ?>");
- }
- }
- </script>
- <?php
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement