Hi
I have Joomla 3.4.4 and VM 3.0.10 running with a template from yootheme.
Since we have a renting shop we use a customer field during checkout where the customer needs to pick the rental date (From - until).
Now the datepicker only reaches until the end of this year 31.12.2015. How can I change that? Any help is highly appreciated.
http://www.eventmaterial.ch/de/material-mieten/cart
Regards
Hi, does no one have this problem?
The display is partly coded in
administrator/components/com_virtuemart/models/userfields.php
case 'date':
case 'age_verification':
You can see here that they both use the same code for setting the calendar selection
You can modify this BUT it will be overwritten when you update VM
To get a selection for current year to current year +1 the code below might work for you
case 'date':
$currentYear= date('Y');
$_return['fields'][$_fld->name]['formcode'] = vmJsApi::jDate($_return['fields'][$_fld->name]['value'], $_prefix.$_fld->name,$_prefix.$_fld->name . '_field',false,$currentYear.':'. ($currentYear+1));
break;
case 'age_verification':
// Year range MUST start 100 years ago, for birthday
$yOffset = 100;
case 'date':
$currentYear= date('Y');
$_return['fields'][$_fld->name]['formcode'] = vmJsApi::jDate($_return['fields'][$_fld->name]['value'], $_prefix.$_fld->name,$_prefix.$_fld->name . '_field',false,($currentYear-$yOffset).':'.$currentYear);
break;
and of course also after
foreach ($_selection as $_fld) {
$yOffset = 0;
Next version will have it.
Thank you very much. I changed the code and it works.
Thank you also when this is changed in the new version of Virtuemart!
have a nice day!
@max has made the change to the core code.
It will be available in the next official release (not sure whne that might be)
:)
Hi
Is it possible that this fix was not included in the latest release as promised?
Regards, Jonas
I can see it in my version
http://virtuemart.net/news/latest-news/473-security-release-virtuemart-3-0-12 (http://virtuemart.net/news/latest-news/473-security-release-virtuemart-3-0-12)
Ok, strange! I tried it my self and when I move forward in months in the datepicker with the arrow the month changes from december to january but the year stays the same (2015). When I click on a date in january the field is filled correctly with the date and year 2016. It seems to me that only the year in the dropdown doesn't. Is that possible?
Regards, Jonas
P.S.: The hack you posted is not possible anymore since the code changed much, correct?
the code should be the hack, which I posted, which is based on AHs.
this code work only for one year, because offset is set for startting year only.
And if you activate php debug $yOffset is not set in case of 'date' !
case 'age_verification':
// Year range MUST start 100 years ago, for birthday
$yOffset = 100;
case 'date':
$currentYear= date('Y');
$_return['fields'][$_fld->name]['formcode'] = vmJsApi::jDate($_return['fields'][$_fld->name]['value'], $_prefix.$_fld->name,$_prefix.$_fld->name . '_field',false,($currentYear-$yOffset).':'.$currentYear);
break;
should be:
case 'age_verification':
// Year range MUST start 100 years ago, for birthday
$yOffset = 100;
$currentYear= date('Y');
$_return['fields'][$_fld->name]['formcode'] = vmJsApi::jDate($_return['fields'][$_fld->name]['value'], $_prefix.$_fld->name,$_prefix.$_fld->name . '_field',false,($currentYear-$yOffset).':'.$currentYear);
break;
case 'date':
$currentYear= date('Y');
$_return['fields'][$_fld->name]['formcode'] = vmJsApi::jDate($_return['fields'][$_fld->name]['value'], $_prefix.$_fld->name,$_prefix.$_fld->name . '_field',false,($currentYear).':'.$currentYear+10);
break;
This permit 10 years after
unfortunately your code didn't work 100% since the default year is then 2025 und the dropdown is empty.
Is it not possible that when you move forward with the arrows that the year changes automatically to 2016.....?
You can change this :
$_return['fields'][$_fld->name]['formcode'] = vmJsApi::jDate($_return['fields'][$_fld->name]['value'], $_prefix.$_fld->name,$_prefix.$_fld->name . '_field',false,($currentYear).':'.$currentYear+10);
to
$_return['fields'][$_fld->name]['formcode'] = vmJsApi::jDate($_return['fields'][$_fld->name]['value'], $_prefix.$_fld->name,$_prefix.$_fld->name . '_field',false);
to have no limits.
But this dont prevent backward dates.
The problem is perhaps $_return['fields'][$_fld->name]['value'] because it's empty and should be set to current date
in php : $current_date = date("Y-m-d H:i:s") is a way to get the current date
$current_date = date("Y-m-d H:i:s");
$_return['fields'][$_fld->name]['formcode'] = vmJsApi::jDate($current_date, $_prefix.$_fld->name,$_prefix.$_fld->name . '_field',false,($currentYear).':'.$currentYear+10);
Hi there,
I have now updated virtuemart to 3.2.14.
The dropdown lists 2018 & 2019.
How can I change the field, that there is more than just 2019....?
I have tried to edit the administrator/components/com_virtuemart/models/userfields.php on line 967
old: $currentYear+1
new: $currentYear+5
Is that not correct?
Or is it on line 966 $maxmin = 'minDate: -0, maxDate: "+1Y",';
This one didnt work either.
Your help is highly appreciated.
Kind regards, Jonas
Check https://shop.st42.fr/en/products/date-for-cart-with-picker.htm, you can set all as you want .
Configuration for the date picker in the released version VM.3.2.14.9808 has configuration options for year start/range in custom field additional parameters.
Hi!
I'm running the latest version of Virtuemart 3 and Joomla 3.8.7 and now the calendar on the Age Verification field doesn't show any dates before the present day.
QuoteConfiguration for the date picker in the released version VM.3.2.14.9808 has configuration options for year start/range in custom field additional parameters.
regards
Jörgen @ Kreativ Fotografi
Thanks, but that's the version I have on my site. I've updated yesterday, updated Joomla yesterday too and the date picker on the user account creation only shows dates from the present day, not before.
On the backend in Virtuemart > Customer Fields I can't see those new parameters you've mentioned
EDIT: I can see now those parameters, but that's on the custom fields for products. My issue is with the birthdate selector on the customer fields. When a customer tries to create an account this fields only shows dates from present day and ahead, not before.
yes, me too!
its for the birthdate.
on line 794 of administrator\components\com_virtuemart\models\userfields.php file, you will see $yOffset = 0;
I just changed now to be 80;
I've tried it and it's not taking any effect.
After looking more carefully, i see on line 966 :
$maxmin = 'minDate: -0, maxDate: "+1Y",';
I just changed this to:
$maxmin = 'minDate: "-80Y", maxDate: "+1Y",';
and I get the ability to choose the year between +1 and -80 (1938-2019 at time of this post)
I also saw that we can activate the User profile plugin for Joomla 3.8, which gives us ability to use dateofbirth native fields from Joomla, instead of having to mess about creating a date of birth field as a Billing information field...
But i doubt that we can link up to this when using virtuemart login/registration...