Advertisement
sparkweb

FoxyShop: Custom End Date With Dropdown Selector

Nov 19th, 2012
195
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.86 KB | None | 0 0
  1. <script type="text/javascript">
  2. //Setup your product with an end date of SOMETHING (like +1 day)
  3. jQuery(document).ready(function($){
  4.     //Setup
  5.     $("#fs_sub_enddate_<?php echo $product['id'] ?>").attr('name', 'sub_enddate<?php echo foxyshop_get_verification('sub_enddate', '--OPEN--'); ?>').val('');
  6.     $("select.variation-subscription-end-date").change(function() {
  7.         if ($(this).val().indexOf("No End Date") >= 0) {
  8.             $("#fs_sub_enddate_<?php echo $product['id'] ?>").val('');
  9.         } else if ($(this).val().indexOf("End After 3 Months") >= 0) {
  10.             $("#fs_sub_enddate_<?php echo $product['id'] ?>").val('<?php echo Date("Ymd", strtotime("+2 months +1 day")); ?>');
  11.         } else if ($(this).val().indexOf("End After 6 Months") >= 0) {
  12.             $("#fs_sub_enddate_<?php echo $product['id'] ?>").val('<?php echo Date("Ymd", strtotime("+5 months +1 day")); ?>');
  13.         }
  14.     });
  15. });
  16. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement