Skip Navigation

[Resolved] One View for Various Pages

This support ticket is created 3 years, 10 months ago. There's a good chance that you are reading advice that it now obsolete.

This is the technical support forum for Toolset - a suite of plugins for developing WordPress sites without writing PHP.

Everyone can read this forum, but only Toolset clients can post in it. Toolset support works 6 days per week, 19 hours per day.

Sun Mon Tue Wed Thu Fri Sat
- 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 10:00 – 13:00 -
- 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 14:00 – 18:00 -

Supporter timezone: Asia/Kolkata (GMT+05:30)

This topic contains 55 replies, has 2 voices.

Last updated by Pete 3 years, 9 months ago.

Assisted by: Minesh.

Author
Posts
#1688847

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Well - with your current view: hidden link

This was not Toolset issue or the issue from the code I've added at all

You need to adjust the custom JS code you added to your view.

The code was added as to your current view with ID 32068 as given under:

jQuery( document ).on( 'js_event_wpv_pagination_completed', function( event, data ) {
jQuery('html, body').animate({ scrollTop: (jQuery(".js-wpv-view-layout-26622").offset().top) - 180 }, 'slow');
});

And I've changed to:

jQuery( document ).on( 'js_event_wpv_pagination_completed', function( event, data ) {
jQuery('html, body').animate({ scrollTop: (jQuery(".js-wpv-view-layout-32068").offset().top) - 180 }, 'slow');
});

And I can see the pagination scrip working now. Please make sure to adjust your custom scripts you added where required.

#1688857

Hi Minesh,

Ok, I understand.

However I'm going to call quits on this, it's not working, I do however appreciate this turned into a story and you have spent a lot of time on this.

On the page in question: hidden link

Its set yo location - Wells-next-the-Sea.
Yet when you click pagination to '2' the grid resets to show all properties.

Lucky I can restore to a point before we started this. Very frustrating however understand this was pushing the function of Toolset.
It'll be far easier just to create numerous Views.

Have a look and see for yourself. It's def no right.

#1688895

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

We are really near to fix the issue. Can you please do not change anything and I'm sharing the fix so that pagination should work without any issue.

I would like to offer you solution 🙂

#1688897

Sure, I'll leave it as it is however I'm aware this has taken far more of your time and may not work.

Let me know and I'll come back to it.

However happy to quit this if not.

#1688905

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

Can you please check now: hidden link

I've adjusted the code added to "Custom Code" section as given under:

add_filter( 'wpv_filter_query', 'func_filter_post_based_on_current_page_tax', 10, 3 );
function func_filter_post_based_on_current_page_tax($query, $setting, $view_id){
 
  if($view_id == 32068 and (empty($_REQUEST) or wp_doing_ajax())) {
  
  global $post;
  $assigned_area = wp_get_object_terms( $post->ID,'area',array('fields'=>'slugs'));
  $assigned_locatiion = wp_get_object_terms( $post->ID,'location',array('fields'=>'slugs'));
    
    
   $fstatus =  0;
  
   if(isset($_POST['search']['dps_general'])){
   		foreach($_POST['search']['dps_general'] as $k=>$v):
     		if($v['value'] == 0 and $v['name'] !== 'wpv-location'){
              	$fstatus = 1;
            }else if($assigned_locatiion==$v['value']) {
              $assigned_locatiion = $v['value'];
            }	
     		 
        endforeach;
   }
   
      if($fstatus) {
  
        $query['tax_query'][] = array( 
             array(
            'taxonomy' => 'area',
            'field' => 'slug',
            'terms' =>  $assigned_area,
            'operator' => 'IN'
        ),
            array(
            'taxonomy' => 'location',
            'field' => 'slug',
            'terms' => $assigned_locatiion,
            'operator' => 'IN'));
        $query['tax_query']['relation'] = 'AND';
 }
    
    
    }
    return $query;
}

Now, pagination issue is fixed, can you please confirm. And finally please do not forget to mark resolve this ticket 🙂

#1688913

Hi there,

Saw you had done something and yeah, cool works great for the location selected.

However, if you select another location filter on the left in the drop-down, it shows nothing.
It did do prior to you making your recent changes.

Happy to quit this, just say the word.

Again, appreciate your time with this.

#1689063

Minesh,

Surely you're not still working on this?

I have noticed every time I open a web page from the site I'm getting a warning/ de bug pop up. Is this you?
It's new and this is a live site.

#1689193

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

It seems there is some kind of caching going on on your server.

Can you please check now: hidden link

I've adjusted the code to "Custom Code" section of Toolset.

Please note that when you change the location filter, you need to keep in mind that area taxonomy value will be automatically added to the query. So, you will find that the query will always run with clause area and selected location and it will display the matching post where area (whose value come from the page) and location filter value if you change it from the page.

#1689215

Hey Minesh.

Yes Caching kicks in again after a certain time. I refreshed it and tested.

Ok, tested and changing location breaks it. I tried removing the Location filter from the side bar so people can't navigate away from the area selected and this broke it further.

It's just not working and too glitchy as it is, you change Location and it isn;t working that's why I tried removing it.

I'll retest it tomorrow morning however we can't use it as it is, which is a shame considering your time.

Sorry, but if we test and it wont work tomorrow we'll have to leave it.

Thank you again for your efforts.

#1689625

Minesh
Supporter

Languages: English (English )

Timezone: Asia/Kolkata (GMT+05:30)

So this is the last solution and I hope it works for you: hidden link

Can you please check now and let me know if this solution works for you?

I had to disable the ajax pagination and use option " Pagination enabled with manual transition and page reload" - but it almost works as expected now. Can you please check and confirm it works at your end.

I've checked - pagination, location filter as well as other filters all works as expected.
[You need to keep in mind that Area value you selected from the page where the view is added is always hooked in to query]

#1689921

My issue is resolved now. Thank you!

This ticket is now closed. If you're a WPML client and need related help, please open a new support ticket.