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

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

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

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

More
3 years 10 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
3 years 10 months ago - 3 years 10 months ago #8139 by Женя Чугаев
Не получается извлечь данные о фильтрации.

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

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

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

More
3 years 10 months ago - 3 years 10 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: 3 years 10 months ago by Женя Чугаев.

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

More
3 years 10 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

    • Проблемы с JL Weather
    • This up-to-date world online map includes every continent and address. Useful for everyone to learn about the world, with a simple system. Want to know more about Africa? Online map of all the is available for free. Satellite map shows Nigeria, South Africa, Ethiopia, Morocco, Ghana, Tanzania, also Malawi, Algeria, Rwanda, Uganda, Kenya satellites, and Angola, Egypt, Cote d'Ivoire, Botswana, Namibia, Mozambique, Liberia, Libya sandy expanses and oases. Also available online map of Congo, Zambia, Central African Republic, Tunisia, Cameroon. Map of Eurasia includes live territories of Belarus, Armenia, Tajikistan, Kyrgyzstan, Kazakhstan, Ukraine, Azerbaijan, Uzbekistan, Turkmenistan, Georgia, also every city of Russia, China, Cyprus, Israel, Indonesia, India, Yemen, Mongolia, Japan. You can see address and boundary of North and South America countries. North America includes Antigua and Barbuda, Aruba, Barbados, Belize, Bermuda, British Virgin Islands, Canada, Cayman Islands maps. Every region and state is open for research. South America includes Trinidad and Tobago, Argentina, Bolivia, Brazil, Chile, Colombia, Ecuador, Guyana, Paraguay, Peru, Suriname, Uruguay, Venezuela, Ascension Island, Falkland Islands, South Sandwich Islands, French Guiana, the ABC islands, South Georgia, Panama maps. Every city of unique Australia and snowy territories of Antarctica shown on live satellite map. Satellites online map of France - <a href="satellites.pro">Map Of the Guinea-Bissau and its cities
    • In Component / JL Weather
    • JsCssManipulate для joomla 4
    • Здравствуйте! Подскажите пожалуйста, стоит ли ждать данный плагин JsCssManipulate для joomla 4? Если да, то какие сроки? Очень хотелось бы видеть данный релиз, на joomla 3 он работал идеально!
    • In Plugins Joomline / Other plugin
© 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.