VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: OriyanJ on December 28, 2015, 17:15:19 PM

Title: Date picker not showing years (VM3)
Post by: OriyanJ on December 28, 2015, 17:15:19 PM
Suddenly my drop down year picker isn't showing year no more, on any page. Any ideas what has happened?
Title: Re: Date picker not showing years (VM3)
Post by: GJC Web Design on December 28, 2015, 18:22:18 PM
is set in the call (vm3.0.12)

vmjsapi.php

// Virtuemart Datepicker script
   static function jDate($date='',$name="date",$id=NULL,$resetBt = TRUE, $yearRange='') {

      if ($yearRange) {
         $yearRange = 'yearRange: "' . $yearRange . '",';
      }

where are you calling it?

the sublayouts/customfields.php doesn't seem to have a date range call.  :(

$customfield->display =  '<span class="product_custom_date">' . vmJsApi::jDate ($customfield->customfield_value,$customProductDataName) . '</span>';

Title: Re: Date picker not showing years (VM3)
Post by: OriyanJ on December 29, 2015, 08:23:17 AM
I'm not quite sure I get your question, but I'm using VirtueMart 3.0.11.4. The script looks like (/components/com_virtuemart/helpers/vmjsapi.php) -

// Virtuemart Datepicker script
static function jDate($date='',$name="date",$id=NULL,$resetBt = TRUE, $yearRange='') {

if ($yearRange) {
$yearRange = 'yearRange: "' . $yearRange . '",';
}


The year picker wont work on front-end nor back-end.
Title: Re: Date picker not showing years (VM3)
Post by: GJC Web Design on December 29, 2015, 10:33:46 AM
well .. that's what I told you.....

and I asked where you are calling it because in the custom field sublayouts there is no value for $yearRange that I can see

vmJsApi::jDate ($customfield->customfield_value,$customProductDataName)

try "2015:2019"

vmJsApi::jDate ($customfield->customfield_value,$customProductDataName,NULL,TRUE,"2015:2019")
Title: Re: Date picker not showing years (VM3)
Post by: OriyanJ on December 29, 2015, 13:02:32 PM
Oh, I'm sorry. I call it with a shopper field (such as birth date).

I've tried using vmJsApi::jDate ($customfield->customfield_value,$customProductDataName,NULL,TRUE,"2015:2019") but that didn't work.
Title: Re: Date picker not showing years (VM3)
Post by: OriyanJ on December 29, 2015, 13:08:27 PM
SOLVED:

Changed administrator/components/com_virtuemart/helpers/vmjsapi.php
694 : $yearRange = 'yearRange: "1980:2030",';

Thanks for guiding me.
Title: Re: Date picker not showing years (VM3)
Post by: GJC Web Design on December 29, 2015, 14:17:34 PM
I think there is a case for a fallback there

if ($yearRange) {
         $yearRange = 'yearRange: "' . $yearRange . '",';
      }else{

                      $yearRange = 'yearRange: "2015:2020",';
}

or what ever (use current date() etc)
Title: Re: Date picker not showing years (VM3)
Post by: OriyanJ on December 29, 2015, 14:57:41 PM
Yeah, that's a good idea, I think I'll just make it use date('Y')-80 and date('Y')+15 as range.
Title: Re: Date picker not showing years (VM3)
Post by: GJC Web Design on December 29, 2015, 16:29:27 PM
a bit discriminatory against 90 year olds..  ;)
Title: Re: Date picker not showing years (VM3)
Post by: OriyanJ on December 30, 2015, 10:36:34 AM
Or time travelers  :o