Сортировка по предопределенным полям

More
6 years 1 month ago #7845 by Видео мотылек
Добрый день.
Я переопределил макет вашего модуля.
<?php foreach($fields as $v) : ?>
		<div class="jlmf-section">
            <?php if($fields['0']==$v) {echo "<div style='display:none;'>
        <input type='checkbox' value='Россия (АВС)' id='pakety-3-89' name='jlcontentfieldsfilter[6][]'checked='checked'  class='jlmf-checkbox'>
        <label class='jlmf-sublabel' for='pakety-3-89'>Россия (АВС)</label>
    </div>"; } else {if($fields['2']==$v){} else {echo $v;}};?>
		</div>	
        <?php endforeach; ?>
Видите мои изменения в шаблоне.
Задача была на разных страницах выводить Блог Категорий , отсортированный по разным полям.
Работает, но не так , как хотелось бы.
Выводится весь материал Блока Категорий и лишь после сортировки по другому полю появляется правильно отсортированный материал.
Как сделать, чтобы при первичной загрузке материал сразу правильно фильтровался?

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

More
6 years 1 month ago #7846 by Видео мотылек
Думаю в mod_jlcontentfieldsfilter.xml вставить поле для вода значение поля для первичной фильтрации.
И в файл helper.php ставить фильтрацию по params взятому из mod_jlcontentfieldsfilter.xml
Нужна ваша помощь, что и в какое место Хелпера вставлять?

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

More
6 years 1 month ago - 6 years 1 month ago #7848 by JoomLine
Не совсем понял вашу задачу, Вы хотите, чтоб при переходе в категорию, уже были отсортированы по заданным параметрам статьи?
Для этого вы можете включить режим get и получить уже ссылку со всеми параметрами.
Ну и эти параметры можете передавать post если вам необходимо сразу отсортировать без изменения url.
Last edit: 6 years 1 month ago by JoomLine.

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

More
6 years 3 weeks ago - 6 years 3 weeks ago #7850 by Видео мотылек
ссылка не устраивает. И нужен только метод POST без Ajax (это связано в шаблонизацией блока категории с привязкой модальных окон).
Нужно создать несколько модулей на базе фильтра и привязать их к разным пунктам меню. Каждый модуль фильтрует по заранее выбранному и указанному в модуле (.xml файл) полю материала.
Мои попытки
В mod_jlcontentfieldsfilter.xml
<field name="field_paket" type="text" default="скопипастите из полей" label="Название поля..." description="" size="10"  filter="integer"/>
В mod_jlcontentfieldsfilter.php вставил
$field_paket = $params->get('field_paket');//моя вставка
В checkboxes.php это отредактировал
<?php
    $i = 1;
    $groups = array_chunk($options, ceil(count($options) / $count_cols));
    foreach($groups as $options) {
        echo '<div>';
        foreach($options as $k => $v) {
            $checked = in_array($v->value, $value) ? ' checked="checked"' : '';
if ($v->value==$field_paket) {$checked='checked="checked"';};
    ?>
но файл ХЕЛПЕР не получает переменную $field_paket из mod_jlcontentfieldsfilter.php
Last edit: 6 years 3 weeks ago by Видео мотылек.

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

More
6 years 3 weeks ago - 6 years 3 weeks ago #7851 by Видео мотылек

Видео мотылек wrote: ссылка не устраивает. И нужен только метод POST без Ajax (это связано в шаблонизацией блока категории с привязкой модальных окон).
Нужно создать несколько модулей на базе фильтра и привязать их к разным пунктам меню. Каждый модуль фильтрует по заранее выбранному и указанному в модуле (.xml файл) полю материала.
Мои попытки
В mod_jlcontentfieldsfilter.xml вставил строку

<field name="field_paket" type="text" default="скопипастите из полей" label="Название поля..." description="" size="10"  filter="integer"/>
В mod_jlcontentfieldsfilter.php вставил строку
$field_paket = $params->get('field_paket');//моя вставка
В checkboxes.php это отредактировал часть блока
<?php
    $i = 1;
    $groups = array_chunk($options, ceil(count($options) / $count_cols));
    foreach($groups as $options) {
        echo '<div>';
        foreach($options as $k => $v) {
            $checked = in_array($v->value, $value) ? ' checked="checked"' : '';
if ($v->value==$field_paket) {$checked='checked="checked"';};
    ?>
но файл checkboxes.php не получает переменную $field_paket из mod_jlcontentfieldsfilter.php

Last edit: 6 years 3 weeks ago by Видео мотылек.

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

More
6 years 3 weeks ago #7853 by Видео мотылек
Ну хоть подскажите место в коде, где формируется первоначальная загрузка всего блока категории (всего материала для фильтрации)!
Я ХЕЛПЕР смотрю и не могу найти это место.

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

More
6 years 3 weeks ago #7861 by JoomLine
я признаться так и не понял, что вы хотите эти сделать. Если вам нужно передать POST это все не нужно.
Ну либо я не понимаю сокровенного смысла.

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

More
6 years 3 weeks ago #7862 by JoomLine
Если я правильно все таки понял, то вам просто надо значения устанавливать по умолчанию поля... в зависимости от пунктам меню.
Может быть просто воспользоваться этой опцией? s.mail.ru/FvvF/bxdb6TT1z

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

More
6 years 3 weeks ago #7863 by Видео мотылек
Нет, редактировать по "по умолчанию" - это не то.
Нечто вроде ссылки мне нужно. Но только ссылка дает уродливый URL и не позволяет менять шаблон модуля фильтрации.
Поэтому мне хочется внести изменения в модуль.
В файл XML я добавил позицию с выбором значения поля для фильтрации.
В результате , установив модуль с этим значением, я получаю то , что надо. Но первичная загрузка материала идет без предварительной фильтрации - это не устраивает.
ВОПРОС. В каком месте кода задать первичную фильтрацию при загрузке страницы (не меняя URL) по параметру из XML?

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

More
6 years 3 weeks ago #7864 by JoomLine
если вам нужно задать значения фильтру для фильтрации шлите post js скриптом с фронта.

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

More
6 years 3 weeks ago #7868 by Видео мотылек
Тогда ответьте , пожалуйста , на такой вопрос.
1)Вначале загрузка контента и лишь после выбора "чекбокса" идет фильтрация?
2)Или возможно настроить модуль так, чтобы до загрузки страницы происходила фильтрация по полю? (ссылка не подходит)
Если второй пункт возможет, то где в модуле менять код?

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

More
6 years 2 weeks ago - 6 years 2 weeks ago #7881 by JoomLine
Мы решили облегчить создание SEF ссылок на гитхаб есть компонент который позволит конструировать sef ссылки github.com/Joomline/JlContentFieldsFilter

только это тестовая версия пока, что.
Last edit: 6 years 2 weeks ago by JoomLine.
The following user(s) said Thank You: Видео мотылек

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

Powered by Kunena Forum

Last from the forum

    • One day, a curious boy named Sam move
    • One day, a curious boy named Sam moved into the house with his family. As he explored the property, he noticed a rusty, old key lying under a bush. Sam picked it up, wondering what it might unlock. After searching the house and finding nothing, Sam decided to try the key on the garden gate. To his surprise, the key fit perfectly. With a turn of the key and a creak of the hinges, the gate slowly swung open. Inside the garden, Sam was greeted by a sight of wonder. The garden was overgrown but full of vibrant flowers, exotic plants, and a small, sparkling pond. In the middle of the garden stood a beautiful stone statue of a unicorn. As Sam explored further, he discovered a small plaque next to the statue. It read: "To whoever finds this garden, may you always find joy in the beauty of nature and the magic of discovery." Sam spent hours in the garden, exploring every corner and marveling at the hidden beauty. The garden seemed to have a magical quality that made Sam feel at peace and incredibly happy. From that day on, Sam made it a habit to visit the garden every day, taking care of it and sharing its beauty with his friends and family. The once-forgotten garden became a place of joy and wonder for everyone who visited. And so, Sam learned that sometimes, the greatest treasures are not just the secrets we uncover but the beauty and joy we find in them.
    • In Component / Afisha Joomla
    • how much money does a sponsor give
    • 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 TV
    • virtual 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 TV
© 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.