Предупредить посетителя, что материалы отфильтрованы

More
5 years 2 months ago - 5 years 2 months ago #8136 by Женя Чугаев
Подскажите, каким образом я могу отследить, применен ли на странице фильтр? Мне это нужно, чтобы сформировать сообщение на странице о том, что материалы отфильтрованы. Сейчас это возможно только непосредственно после фильтрации, поскольку передаются параметры запросом, однако если покинуть страницу, а потом на нее вернуться, запросы отследить уже нельзя, а материалы остаются отфильтрованными, и пользователь видит не все материалы, а сообщения, что они отфильтрованы, не видит.

Пока на ум приходит только js скриптом пробежаться по всем полям и проверить, установлен ли хоть один чекбокс и совпадают ли значения min-max диапазонов со значениями from-to. Но это костыль. Как вообще фильтр запоминает, какие значения установлены? Где хранится эта информация?
Last edit: 5 years 2 months ago by Женя Чугаев.

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

More
5 years 2 months ago #8137 by JoomLine
Данные о фильтрации хранятся в сессии, если конкретно в userState
The following user(s) said Thank You: Женя Чугаев

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

More
5 years 2 months ago - 5 years 2 months ago #8139 by Женя Чугаев
Не получается извлечь данные о фильтрации.

$session = JFactory::getSession();
$state = $session->get('userState');
print_r($state);

Приведенный код ничего не выводит, переменная $state пуста. Подскажите пожалуйста, как извлечь данные о фильтрации?
Last edit: 5 years 2 months ago by Женя Чугаев.

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

More
5 years 2 months ago - 5 years 2 months ago #8140 by Женя Чугаев
Пытался отследить состояние переменной $jlContentFieldsFilter, в которую записываются все установленные фильтры. Но так как у меня в фильтре используются, диапазоны, то даже после сброса параметров значение is_filter все равно равняется 1! Получается, отследить, использован ли на странице фильтр, если в нем есть хотя бы один диапазон, нельзя, система думает, что фильтр установлен.

Array (
[3] => Array ( [from] => 2100 [to] => 9000 )
[9] => Array ( [from] => 20000 [to] => 85000 )
[is_filter] => 1
)
Last edit: 5 years 2 months ago by Женя Чугаев.

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

More
5 years 2 months ago #8142 by JoomLine
Попробуйте тут github.com/Joomline/JlContentFieldsFilte...ieldsfilter.php#L125

вставить то что вам требуется: что то типа $app->enqueueMessage()

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

Powered by Kunena Forum

Last from the forum

    • gotopbestblogger
    •   In it for the long run, during 2024 Nexon has taken the web3 extension of its MapleStory IP not just wider, but also deeper. Garnering 400,000 users during a single day in its latest MapleStory N playtest showcases Nexon’s growing understanding on sustainable ecosystem building. The release of its NXPC token model makes MapleStory Universe users even more excited about where the project is heading as we’re on the verge of a new year.
    • In Plugins Joomline / JL Comments / JL Comments PRO
    • voip phone
    • One day, a monkey drove his car near a lake. Sudden, he saw a tiger under a tree. The tiger saw him, too. The tiger ran very fast at the monkey. The monkey was very afraid and he and his car fell into the lake. The monkey couldn't swim and he shouted. A rabbit came and he jumped into the lake. The abbit swam to the monkey but did not help him. Both of them shouted forhelp. Luckily, a giraffe came along. He was very tall. He helped the rabbit and the monkey.  
    • In Component / JL Mail
    • bloggingaboutanythingonline
    • One day, a monkey drove his car near a lake. Sudden, he saw a tiger under a tree. The tiger saw him, too. The tiger ran very fast at the monkey. The monkey was very afraid and he and his car fell into the lake. The monkey couldn't swim and he shouted. A rabbit came and he jumped into the lake. The abbit swam to the monkey but did not help him. Both of them shouted forhelp. Luckily, a giraffe came along. He was very tall. He helped the rabbit and the monkey.  
    • In Component / JL Mail
© 2010- JoomLine
The Joomla!® name is used under a limited license from Open Source Matters in the United States and other countries. joomline.net is not affiliated with or endorsed by Open Source Matters or the Joomla! Project.

email: This email address is being protected from spambots. You need JavaScript enabled to view it.