Tech Support Posted April 5, 2021 Share Posted April 5, 2021 (edited) Due to the complexity of AJAX filtering in the default theme, we won't explain this in details. Using this advanced filtering requires deep understanding of default theme JS internals. This is just a working example that can be configured in default theme. Step 1. In Website UI -> Pages run a search by list_videos to filter out only list_videos blocks. Open every list_videos block and activate the following parameters: var_duration_from = duration_from var_duration_to = duration_to var_is_hd = is_hd It is recommended to ignore list_videos block named Related Videos and Player Related Videos, as these anyway won't render filtering and changing their parameters may result to performance overload for some period of time. Step 2. In Website UI -> Page components -> include_list_videos_block_common.tpl add the following code under <div class="headline"> after header display: {{if $duration_from>0}} {{assign var="list_videos_custom_sort_parameters" value="`$list_videos_custom_sort_parameters`;duration_from:$duration_from"}} {{/if}} {{if $duration_to>0}} {{assign var="list_videos_custom_sort_parameters" value="`$list_videos_custom_sort_parameters`;duration_to:$duration_to"}} {{/if}} {{if $is_hd==1}} {{assign var="list_videos_custom_sort_parameters" value="`$list_videos_custom_sort_parameters`;is_hd:$is_hd"}} {{/if}} <div class="sort"> <span class="icon type-hd"></span> <strong>{{if $is_hd==1}}HD{{else}}All{{/if}}</strong> <ul id="{{$block_uid}}_hd_list"> {{if $is_hd==1}} <li> <a data-action="ajax" data-container-id="{{$block_uid}}_hd_list" data-block-id="{{$block_uid}}" data-parameters="{{if $list_videos_custom_sort_parameters!=''}}{{$list_videos_custom_sort_parameters}};{{/if}}sort_by:{{$sort_by}};is_hd:">All</a> </li> {{/if}} {{if $is_hd==0}} <li> <a data-action="ajax" data-container-id="{{$block_uid}}_hd_list" data-block-id="{{$block_uid}}" data-parameters="{{if $list_videos_custom_sort_parameters!=''}}{{$list_videos_custom_sort_parameters}};{{/if}}sort_by:{{$sort_by}};is_hd:1">HD</a> </li> {{/if}} </ul> </div> <div class="sort"> <span class="icon type-duration"></span> <strong>{{if $duration_to==600}}0-10{{elseif $duration_to==1800}}10-30{{elseif $duration_from==1800}}30+{{else}}Duration{{/if}}</strong> <ul id="{{$block_uid}}_duration_list"> {{if $duration_to>0 || $duration_from>0}} <li> <a data-action="ajax" data-container-id="{{$block_uid}}_duration_list" data-block-id="{{$block_uid}}" data-parameters="{{if $list_videos_custom_sort_parameters!=''}}{{$list_videos_custom_sort_parameters}};{{/if}}sort_by:{{$sort_by}};duration_from:0;duration_to:0">All</a> </li> {{/if}} {{if $duration_to!=600}} <li> <a data-action="ajax" data-container-id="{{$block_uid}}_duration_list" data-block-id="{{$block_uid}}" data-parameters="{{if $list_videos_custom_sort_parameters!=''}}{{$list_videos_custom_sort_parameters}};{{/if}}sort_by:{{$sort_by}};duration_from:0;duration_to:600">0-10</a> </li> {{/if}} {{if $duration_to!=1800}} <li> <a data-action="ajax" data-container-id="{{$block_uid}}_duration_list" data-block-id="{{$block_uid}}" data-parameters="{{if $list_videos_custom_sort_parameters!=''}}{{$list_videos_custom_sort_parameters}};{{/if}}sort_by:{{$sort_by}};duration_from:600;duration_to:1800">10-30</a> </li> {{/if}} {{if $duration_from!=1800}} <li> <a data-action="ajax" data-container-id="{{$block_uid}}_duration_list" data-block-id="{{$block_uid}}" data-parameters="{{if $list_videos_custom_sort_parameters!=''}}{{$list_videos_custom_sort_parameters}};{{/if}}sort_by:{{$sort_by}};duration_from:1800;duration_to:0">30+</a> </li> {{/if}} </ul> </div> Step 3. In Website UI -> Page components -> include_pagination_block_common.tpl add the following code in the template beginning: {{if $duration_from>0}} {{assign var="pagination_custom_parameters" value="`$pagination_custom_parameters`;duration_from:$duration_from"}} {{/if}} {{if $duration_to>0}} {{assign var="pagination_custom_parameters" value="`$pagination_custom_parameters`;duration_to:$duration_to"}} {{/if}} {{if $is_hd==1}} {{assign var="pagination_custom_parameters" value="`$pagination_custom_parameters`;is_hd:$is_hd"}} {{/if}} Edited October 25, 2021 by Tech Support Bugfix for pagination not working correctly 1 Quote Link to comment Share on other sites More sharing options...
davex Posted April 5, 2021 Share Posted April 5, 2021 hi, thanks, but adding this section shows in all sites, index, new videos in all sites. and the 1 part only putting in 1 site. var_duration_from = duration_from var_duration_to = duration_to var_is_hd = is_hd Quote Link to comment Share on other sites More sharing options...
Tech Support Posted April 6, 2021 Author Share Posted April 6, 2021 6 hours ago, davex said: but adding this section shows in all sites, index, new videos in all sites. Right, it is expected that this filtering will appear everywhere. 6 hours ago, davex said: and the 1 part only putting in 1 site. Please read this step carefully, it says that you should activate those parameters in all list_videos blocks in all pages, except related videos. Quote Link to comment Share on other sites More sharing options...
Jim Posted February 22 Share Posted February 22 Please could you clarify the exact insertion point of the step2 instruction copied below ie the existing line above and the line below where the new code is to be inserted? Step 2. In Website UI -> Page components -> include_list_videos_block_common.tpl add the following code under <div class="headline"> after header display: Quote Link to comment Share on other sites More sharing options...
Jim Posted February 22 Share Posted February 22 And step 3, understand the additonal code goes before any existing code in this block - correct? Step 3. In Website UI -> Page components -> include_pagination_block_common.tpl add the following code in the template beginning: Quote Link to comment Share on other sites More sharing options...
Tech Support Posted February 22 Author Share Posted February 22 5 hours ago, Jim said: Please could you clarify the exact insertion point of the step2 instruction copied below ie the existing line above and the line below where the new code is to be inserted? Step 2. In Website UI -> Page components -> include_list_videos_block_common.tpl add the following code under <div class="headline"> after header display: After this block on top: {{if $total_count>0 && $list_videos_show_more_link!='' && $total_count>$items_per_page}} <a class="more" href="{{$list_videos_show_more_link}}"> <span>{{$lang.common_list.link_more_items|replace:"%1%":$total_count}}</span> </a> {{/if}} 5 hours ago, Jim said: And step 3, understand the additonal code goes before any existing code in this block - correct? Step 3. In Website UI -> Page components -> include_pagination_block_common.tpl add the following code in the template beginning: Yes, at the very beginning of pagination template. Quote Link to comment Share on other sites More sharing options...
Jim Posted February 22 Share Posted February 22 Seems to have worked, thank you! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.