Tagged: prefilter
-
AuthorPosts
-
fabiojordan Friend
fabiojordan
- Join date:
- August 2014
- Posts:
- 48
- Downloads:
- 20
- Uploads:
- 2
- Thanks:
- 8
- Thanked:
- 5 times in 5 posts
September 6, 2016 at 4:13 am #965946Hi there.
I’m trying to make an menu to show the user all the items with an specific extra field (in this case, its a textfield, that I’m using to insert some code numbers). The problem is that when I try to pre-filter it, JA K2 Filter only let me filter items by inserting the codes, and thats not what I want.
So, I want to know if there’s a way (and if there’s not, if it would be possible to develop something like that) to just make JA K2 Filter verify if the item has a value on that field (just as K2 make verifies) so that we can show the items without having to tell the module all the code numbers.
Furthermore, I’m wondering if its possible to insert pre-filter right on the menu options? I mean, its bad have to make a lot of modules just to pre-filter. I guess it would be smarter to do it right on the menu, if its possible, of course.
Last, I’m thinking if its too hard to show all the dates in an extra field date type, so the user can select the date on a list, without having to use the calendar. I mean, its pretty easier than trying to figure out the dates. And to make it better, it would be great to filter that specific list by month or period.
Any help is appreciated.
Thanks in advance!
Keep the good work.
Mo0nlight ModeratorMo0nlight
- Join date:
- September 2014
- Posts:
- 707
- Downloads:
- 38
- Uploads:
- 107
- Thanked:
- 99 times in 97 posts
September 8, 2016 at 3:53 am #966619Hi.
- The extra field text field pre-filter show up all the existing data so you can choose one of them, that will help the admin choose the right data for the field. If he can put another value to it, the page will auto filter no result. But if you want to change the way (make a textfield to input what you want.) you can do this:
edit the file /modules/mod_jak2filter/elements/prek2extrafield.php Edit the code:
$html[] = ' <div> <select class="jform_params_range" id="jform_params_'.$option->value.'" name="' . $this->name . '[xf_'.$option->value.$ex_fieldname.']'.$arr_value.'" '.$multiple.'> '.$defaultop.' '.implode($optex,' ').' </select> '.$to_option.' </div>';
To :
$html[] = ' <div> '.($option->type == 'textfield' ? '<input style="float:none;" value="'.$pre_filter_by_extrafield->{'xf_'.$option->value}.'" class="form-control" id="jform_params_'.$option->value.'" name="' . $this->name . '[xf_'.$option->value.$ex_fieldname.']'.$arr_value.'" />' : '<select class="jform_params_range" id="jform_params_'.$option->value.'" name="' . $this->name . '[xf_'.$option->value.$ex_fieldname.']'.$arr_value.'" '.$multiple.'> '.$defaultop.' '.implode($optex,' ').' </select>'.$to_option).' </div>';
-
It’s possible, we will consider adding the feature to jak2filter in future. It takes time to do so I can’t explain here. If you need the feature you should hire someone to do custom work.
-
It’s possible, but but it will take a long time to do so. If you want to make it to menu right away you should hire someone to do custom work.
- Yeah. we will consider adding this new feature, then again it takes time to do. If you want it right away then you should hire someone to do custom work.
Thanks for your suggestion. Well. Please stay tune and wait for the update.
Regards.
fabiojordan Friendfabiojordan
- Join date:
- August 2014
- Posts:
- 48
- Downloads:
- 20
- Uploads:
- 2
- Thanks:
- 8
- Thanked:
- 5 times in 5 posts
September 9, 2016 at 3:51 pm #967052Hi Mo0nlight.
Thanks for the reply. I tried your solution, but with no luck. But there’s no problem.
I’m developing a solution with Module K2 Content (while we dont have the feature in JA K2 Filter). Check how I’m doing:
<ul> <?php foreach ($items as $key=>$item): ?> <?php if($item->extraFields->NAMEOFEXTRAFIELD->value): ?> <?php if(count($item)): ?> <a class="NameofClass" href="<?php echo $item->link; ?>"> <li> <div><?php echo $item->title; ?></div> </li> </a> <?php endif; ?> <?php endif; ?> <?php endforeach; ?> </ul>
It’s working this way, but the problem is that it’s showing only one item (instead of five, as I inserted in the parameters of the module), because for some reason it’s counting first the five items and than showing only the ones with the specific extrafield (in this case, there’s only one in the five recent items with that extrafield). I’m gonna find a way to make it works as workaround, but I’m hoping for a better solution from JA K2 Filter (maybe the code above can help you).
Anyway, thanks for your reply and time.
Keep the good work!
Mo0nlight ModeratorMo0nlight
- Join date:
- September 2014
- Posts:
- 707
- Downloads:
- 38
- Uploads:
- 107
- Thanked:
- 99 times in 97 posts
September 13, 2016 at 3:06 am #967789Hi.
I saw your code. and could not figure it out what you trying to do. could you explain more about what you want to achieve here ? And which file that your code place at ?
Regards.
-
AuthorPosts
This topic contains 3 replies, has 2 voices, and was last updated by Mo0nlight 8 years, 2 months ago.
We moved to new unified forum. Please post all new support queries in our New Forum