I am using shopper field with field type date to have the user enter the date of birth.
2 problems are that
1. the date picker only shows 2016. So user cannot pick the real birth year.
2. the date comes up on yy.mm.dd format. we want dd.mm.yy format.
I did find a post some time ago that showed how to fix these problems. But since most recent upgrade to 3.8.12 the fix was overwritten.
I can't seem to find the post again.
Please advise how to rectify this bug.
maybe:
http://forum.virtuemart.net/index.php?topic=132627.msg458994
http://forum.virtuemart.net/index.php?topic=133995.msg465102#msg465102
http://forum.virtuemart.net/index.php?topic=135273.msg470830#msg470830
Thanks GJC ... I finally found it here:
https://forum.virtuemart.net/index.php?topic=132619.0 (which by the way was your solution as well)
Needed to change in /administrator/components/com_virtuemart/helpers/vmjsapi.php
From
if ($yearRange) {
$yearRange = 'yearRange: "' . $yearRange . '",';
}
To
if ($yearRange) {
$yearRange = 'yearRange: "1930:2030",';
}
What puzzles me is why we need to go into a php file to set a year Range?
the year range should be a received function parameter
static function jDate($date='',$name="date",$id=NULL,$resetBt = TRUE, $yearRange='') {
or have a fallback I guess
e.g.
if ($yearRange) {
$yearRange = 'yearRange: "' . $yearRange . '",';
}else{
$yearRange = 'yearRange: "1980:2010"';
}
if called from a customfield then e.g. add to the function call
\components\com_virtuemart\sublayouts\customfield.php ~ 408
$customfield->display = '<span class="product_custom_date">' . vmJsApi::jDate ($customfield->customfield_value,$customProductDataName,'','','1980:2010') . '</span>';
not tested
Hi
This is insanity why are we having to delve into the core code for what I would call a mandatory field in a shop to get someones birth date. Surely there can be added some code to make it work with dates from the past to whatever the current date is or even better to have a config setting in the admin area.
Do we have to pay a developer to redo the code every time the software is updated?
Surely this basic task can be rectified.
Quoteif called from a customfield then e.g. add to the function call
\components\com_virtuemart\sublayouts\customfield.php ~ 408
$customfield->display = '<span class="product_custom_date">' . vmJsApi::jDate ($customfield->customfield_value,$customProductDataName,'','','1980:2010') . '</span>';
not tested
sublayouts can be simply over ridden in your template - but yes.. should at least have a fallback in the core