Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Guide: How to add calendar in search filter #62

Open
uruk-hai-21 opened this issue Oct 26, 2021 · 1 comment
Open

Guide: How to add calendar in search filter #62

uruk-hai-21 opened this issue Oct 26, 2021 · 1 comment

Comments

@uruk-hai-21
Copy link

From 2.0 version:

  • plugins/system/jlcontentfieldsfilter/jlcontentfieldsfilter.php
    line 223 add
case 'calendar':
if(!empty($v)){
if(is_array($v)){
if(!empty($v['from']) && !empty($v['to'])){
$where = '(field_id = '.$k.' AND `value` BETWEEN "'.$v['from'].' 00:00:00" AND "'.$v['to'].' 00:00:00")';
}
else if(!empty($v['from'])){
$where = '(field_id = '.$k.' AND `value` >= "'.$v['from'].' 00:00:00")';
}
else if(!empty($v['to'])){
$where = '(field_id = '.$k.' AND `value` <= "'.$v['to'].' 00:00:00")';
}
}
else{
$where = '(field_id = '.$k.' AND value LIKE '.$db->quote('%'.$v.'%').')';
}
}
break;
  • plugins/system/jlcontentfieldsfilter/fields/jlcontentfieldsfilterfields.php
    line 83 add
case 'calendar':
$options = HTMLHelper::_('select.option', 'calendar', Text::_('PLG_JLCONTENTFIELDSFILTER_FILTER_CALENDAR'));
break;
  • /modules/mod_jlcontentfieldsfilter/layouts/mod_jlcontentfieldsfilter
    duplicate range.php file and rename in calendar.php
    in input type date change in "date"

  • modules/mod_jlcontentfieldsfilter/assets/javascript/jlcontentfilter.js
    line 46

form.find('input[type="text"], input[type="date"]').val('');
  • modules/mod_jlcontentfieldsfilter/assets/javascript/nojq_jlcontentfilter.js
    [code]var els = form.querySelectorAll('input[type="text"], input[type="date"]');[/code]
@uruk-hai-21
Copy link
Author

@chattago2002

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant