Persistent filter as Range OR Multi-value List

More
11 years 11 months ago #38499 by brandonking
Hello,

I guess this has been requested before but can not find it in forum.
Is it possible to use persistent filter for range of price field in categories menu?

If not, can you add something like below?
e.g. field_id23##0--10%%field_id23##11--50%%field_id23##51--100

Regards,

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

More
11 years 11 months ago #38504 by ggppdk
Hello,
better use 3 characters

--- for range value
and
+++ for multiple value list


Test this enhancement to existing code:
(Did not have time to test but it should work)

-- Edit the frontend category model file
components/com_flexicontent/models/category.php

Inside function _setFilters(...)
find line:
JRequest::setVar('filter_'.$filter_id, $filter_value);
and above it add:
Code:
if (strpos($filter_value, '---') !== false) { // Range value: value01---value02 $filter_value = explode('---', $filter_value); $filter_value[2] = $filter_value[1]; $filter_value[1] = $filter_value[0]; unset($filter_value[0]); } else if (strpos($filter_value, '+++') !== false) { // Multiple values: value01+++value02+++value03+++value04 $filter_value = explode('+++', $filter_value); }
[Edit] corrected the -- to be --- and ++ to be +++]

IMPORTANT NOTE: your field must be configured appropriately. So set your field to be a range filter, or a multi-value filter, otherwise the values will not be used as expected

Please report back and also you may suggest a fix or improvement

Regards


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

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

More
11 years 11 months ago #38505 by ggppdk
Hello,
i made more corrections to the above code

-- should be ---
and
++ should be +++

the range array must be [1] and [2]
and not [0] and [1]

... please use updated code


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

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

More
11 years 11 months ago #38506 by brandonking
So, for example, If I want to use price field(field20)

field20##0---10

is it ok?

field20 is text field and set as single value accepted(not used for multiple value).

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

More
11 years 11 months ago #38507 by ggppdk
Hello,

No, you need field ID and not field Name

so you try this:
20##0---10

and not this:
field20##0---10

the parameter description mentions filter(field) id and not filter(field) name?


-- Flexicontent is Free but involves a big effort on our part.
Like the our support? (for a bug-free FC, despite having a long list of functions) Like the features? Like the ongoing development and future commitment to FLEXIcontent?
-- Add your voice to the FLEXIcontent JED listing with a 5-star...

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

More
11 years 11 months ago #38508 by brandonking
Hmmmmm....not working..
I have added 109##40---60 but no result found..even if there is one item that has field(109)'s value is 50.

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

Moderators: vistamediajoomlacornerggppdk
Time to create page: 0.764 seconds
Cookies user preferences
We use cookies to ensure you to get the best experience on our website. If you decline the use of cookies, this website may not function as expected.
Accept all
Decline all
Essential
These cookies are needed to make the website work correctly. You can not disable them.
Display
Accept
Analytics
Tools used to analyze the data to measure the effectiveness of a website and to understand how it works.
Google Analytics
Accept
Decline
Save