News:

Looking for documentation? Take a look on our wiki

Main Menu

Shopper Field type Date Bug

Started by sydneyartschool, December 06, 2016, 14:24:20 PM

Previous topic - Next topic

sydneyartschool

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.

GJC Web Design

GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

sydneyartschool

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?


GJC Web Design

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
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

easypony

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.

GJC Web Design

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
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation