Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Paste this code into your foxyshop-single-product.php file right before the </form>
- //Create a text-field variation called "Start Date" for this to grab
- //-----------------------------------------------------------------------------------
- //Code to display a Date Picker On a Field
- ?>
- <script type="text/javascript">
- var disabledDays = <?php foxyshop_get_excluded_dates(); ?>;
- function setupExcludedDates(date) {
- var m = date.getMonth(), d = date.getDate(), y = date.getFullYear();
- for (i = 0; i < disabledDays.length; i++) {
- if($.inArray((m+1) + '-' + d + '-' + y,disabledDays) != -1 || new Date() > date) return [false];
- }
- return [true];
- }
- function getExcludedDates(date) {
- //var noWeekend = jQuery.datepicker.noWeekends(date);
- //return noWeekend[0] ? setupExcludedDates(date) : noWeekend;
- return setupExcludedDates(date);
- }
- jQuery(document).ready(function($){
- //Remove Existing Start Date, Add New One
- if ($("#foxyshop_product_form_<?php echo $product['id']; ?> label.variation-start-date").length) {
- $("#fs_sub_startdate_<?php echo $product['id']; ?>").remove();
- $("#foxyshop_product_form_<?php echo $product['id']; ?>").prepend('<input type="hidden" name="sub_startdate<?php echo foxyshop_get_verification("sub_startdate", "--OPEN--"); ?>" id="fs_sub_startdate_<?php echo $product['id']; ?>" value="" />')
- $("#foxyshop_product_form_<?php echo $product['id']; ?> .variation-start-date").val("<?php echo date("Y-m-d"); ?>").datepicker({
- dateFormat: 'yy-mm-dd',
- numberOfMonths: 2,
- constrainInput: true,
- beforeShowDay: getExcludedDates,
- altField: "#fs_sub_startdate_<?php echo $product['id']; ?>",
- showAnim: "slideDown"
- <?php foxyshop_get_min_max_date(); ?>
- });
- }
- });
- </script>
- <?php
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement