VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: palandre on March 25, 2018, 13:12:02 PM

Title: Date field not working for shopper field
Post by: palandre on March 25, 2018, 13:12:02 PM
Hi mates,

I've added a new field "Data di nascita" for shoppers, with type "date". It appears when the user wants to register, but not with date picker, but with a simple text-area, even if in the firebug I can see the class datepicker.

The link is here:
http://shop.gallerialamongolfiera.it/shop/user/editaddresscartBT

Do you have any idea for this?

I use Joomla 3.8.6 and VM 3.2.13

Thanks a lot in advance,
Andrea
Title: Re: Date field not working for shopper field
Post by: Studio 42 on March 26, 2018, 03:38:35 AM
You have perhaps disabled datepicker file loading, because all code is here but datepicker or jquery.ui  is missing
Title: Re: Date field not working for shopper field
Post by: palandre on April 04, 2018, 21:49:07 PM
Hi Studio 42,
Thanks for your feedback!

I was actually able to show the datepicker by checking "Use Virtuemart jQuery libraries". But I can see only future dates.

Can you suggest me where to setup datepicker inside Virtuemart jQuery?

Thanks again and regards,
Andrea
Title: Re: Date field not working for shopper field
Post by: palandre on April 04, 2018, 22:35:28 PM
Found:

administrator/components/com_virtuemart/helpers/vmjsapi.php

Before:
self::addJScript('datepicker','
      jQuery(document).ready( function($) {
         $(document).on( "focus",".datepicker", function() {
            $( this ).datepicker({
               changeMonth: true,
               changeYear: true,
               '.$yearRange.'
               '.$minMax.'
               dateFormat:"'.$jsDateFormat.'",
               altField: $(this).prev(),
               altFormat: "yy-mm-dd"
            });


add:
$yearRange = 'yearRange: "1918:2018",';
$minMax = 'minDate: "-100Y", maxDate: "+1Y",';
Title: Re: Date field not working for shopper field
Post by: Milbo on April 06, 2018, 13:39:00 PM
Please check the new version, I did changes there.