Skip to main content

Date Picker date range

More
12 years 3 months ago #161268 by abasel
I am using the date picker addon for a custom field. It works well except that it doesn't go back far enough e.g. The year drown allows users to choose years from 2014 to 2004. unfortunately they need to go back further. Currently they can only do this by selecting 2004 and then choosing the dropdown again to get lower options.

Any way of changing this but getting the default year to be 10 years earlier, or using some other method?

Please Log in or Create an account to join the conversation.

More
12 years 3 months ago #161290 by Jerome
Replied by Jerome on topic Date Picker date range
Hi,

I don't understand what you are talking about.
There is no year limitation in the date picker.

Regards,

Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Please Log in or Create an account to join the conversation.

More
12 years 3 months ago #161322 by abasel
Replied by abasel on topic Date Picker date range
Hi, the following screen cast shows the issue for clearly :)

youtu.be/NxlnyPT9R7w

Please Log in or Create an account to join the conversation.

More
12 years 3 months ago #161328 by nicolas
Replied by nicolas on topic Date Picker date range
Hi,

Thanks for the video.

You would have to add the line:
Code:
$dateOptions[] = 'yearRange: \'c-20:c+20\'';
after the line:
Code:
$dateOptions[] = 'changeYear:true';
in the file plugins/hikashop/datepickerfield/datepickerfield.php
c-20 means 20 years before current year. And c+20 means 20 years after current year. so you can adapt if you want.

Please Log in or Create an account to join the conversation.

More
12 years 3 months ago #161474 by abasel
Replied by abasel on topic Date Picker date range
Thanks for that but I am not sure where to put these lines as I can't find
Code:
$dateOptions[] = 'changeYear:true';

See the code for the file below:
Code:
<?php /** * */ class plgHikashopDatepickerfield extends JPlugin { /** * */ public function __construct(&$subject, $config) { parent::__construct($subject, $config); $this->loadLanguage('plg_hikashop_datepickerfield', JPATH_ADMINISTRATOR ); } /** * */ public function onFieldsLoad(&$fields, &$options) { $me = new stdClass(); $me->name = 'datepickerfield'; $me->text = JText::_('DATE_PICKER'); $me->options = array('required', 'default', 'columnname', 'format', 'allow', 'datepicker_options'); $fields[] = $me; $opt = new stdClass(); $opt->name = 'datepicker_options'; $opt->text = JText::_('DATE_PICKER_OPTIONS'); $opt->obj = 'fieldOpt_datepicker_options'; $options[$opt->name] = $opt; } } if(defined('HIKASHOP_COMPONENT')) { /** * */ require_once( dirname(__FILE__).DS.'datepickerfield_class.php' ); }

Please Log in or Create an account to join the conversation.

More
12 years 3 months ago #161490 by nicolas
Replied by nicolas on topic Date Picker date range
Hi,

Sorry it's in the file plugins/hikashop/datepickerfield/datepickerfield_class.php that you want to do that change
The following user(s) said Thank You: abasel

Please Log in or Create an account to join the conversation.

More
12 years 3 months ago #161559 by abasel
Replied by abasel on topic Date Picker date range
Worked like a dream :-)
Code:
if(!empty($datepicker_options['change_year'])) { $dateOptions[] = 'changeYear:true'; $dateOptions[] = 'yearRange: \'c-20:c+20\''; }

Please Log in or Create an account to join the conversation.

Time to create page: 0.197 seconds
Powered by Kunena Forum