Skip Navigation

[Resolved] A view is pulling wrong items

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
- 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 9:00 – 12:00 -
- 13:00 – 18:00 13:00 – 18:00 13:00 – 18:00 14:00 – 18:00 13:00 – 18:00 -

Supporter timezone: America/Jamaica (GMT-05:00)

This topic contains 12 replies, has 2 voices.

Last updated by Shane 3 years, 9 months ago.

Assisted by: Shane.

Author
Posts
#2207659

We have CTP Package
It has a nested repeater field "Package Itinerary". For some reason, I can not figure out, the view that is supposed to display the content is displaying the wrong content (it adds extra content). The bug happened after a recent updated.

e.g hidden link

#2208059

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Anna,

Thank you for getting in touch.

Would you mind allowing me to have admin access to the sit so that I can have a more detailed look at this one for you ?

I've enabled the private fields for your next response.

Thanks,
Shane

#2209021

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Anna,

Can you let me know which view is not displaying the Correct information and what should it actually be displaying.

From there I should be able to let you know what the issue is.

Thanks,
Shane

#2217373

Hi
The issue is in the "Itinerary Days For Nested Items" view
It has a conditional:

[wpv-conditional if="( '[wpv-found-count]' eq '1' )"]  //If the  Itinerary Days found is 1
//Show one day
[wpv-conditional if="( '[wpv-found-count]' gte '2' )"] //If the  Itinerary Days found 2 or more
//Show all day

When a post have more then one day - content is displayed twice
eg
hidden link

#2217735

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Anna,

I see a fundamental problem with how you've setup your view. I don't believe it's an issue solely based on your conditional.

For e.g in your content template you have the 2 views.

  <div class="itinerary">
    <h2>[wpml-string]Itinerary[/wpml-string]</h2>
	<div class="itinerary-item-wrap">
		[wpv-view name="itinerary-days"]
      	[wpv-view name="itinerary-day-nested"]
	</div>
  </div>

Based on your structure i'm assuming you want to display the nested field group that is inside the Itinerary days field group itself.
So if youre displaying the following:
Day 1
-item1
-item2
-item3

If this is correct then how you've set it up is not going to provide this because in order for you to display the items that are related to the current itinerary day then the Itinerary Day Nested view must be placed inside the Itinerary days views inside the <wpv-loop> tags.

Secondly I see your Itinerary Day Nested view is set to display "Itinerary Day" which essentially won't let your view display the items for the itinerary. What needs to be selected is the " Itinerary Item" given that this is what you want to display under each of the Itinerary Dates.

Finally you will need to change the Relationship filter in the Itinerary Day Nested view to "The current post in the loop" so that it can get the related items for the day being displayed.

Based on your setup now I would recommend that you revert your views to displaying the Basics such as the post title of each of the repeating fields so that you can get an idea of what the view is displaying in its simplest form.

Please let me know if this helps.
Thanks,
Shane

#2218177

I put [wpv-view name="itinerary-day-nested"] inside Itinerary Days <wpv-loop> tags.

in [Itinerary Days For Nested Items] I set Content Selection to Itinerary Item.

in [Itinerary Days For Nested Items] I set Query Filter to
Select items in any relationship > The current post in the loop

Now noting is showing...

hidden link

What is going on?

#2218539

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Anna,

The view in its simplest form works. Here i a backup of you view's content area.

[/php]
[wpv-conditional if="( '[wpv-found-count]' eq '1' )"]
<div class="eq-1">[wpv-post-body view_template="loop-item-in-itinerary-days-for-nested-items"]</div>
[/wpv-conditional]
[wpv-conditional if="( '[wpv-found-count]' gte '2' )"]
[wpv-item index=1]
<div class="eq-2 i-1 package-itinerary tab-pane fade active show tab-one" id="tab-[wpv-post-id]" role="tabpanel" aria-labelledby="tab-[wpv-post-id]">
[wpv-post-body view_template="loop-item-in-itinerary-days-for-nested-items"]</div><!--/tab-pane-->
[wpv-item index=other]
<div class="eq-2 i-other package-itinerary tab-pane fade show tab-one" id="tab-[wpv-post-id]" role="tabpanel" aria-labelledby="tab-[wpv-post-id]">
[wpv-post-body view_template="loop-item-in-itinerary-days-for-nested-items"]</div><!--/tab-pane-->
[/php]

Given this you may need to end up remaking this view because i'm finding that its loading "No Items Found" whenever there is a content template being loaded for the post body template. However when the template is added directly to the loop it works. Can you go ahead and remake this entire view as you can now see it is loading the correct relational data.

Thanks,
Shane

#2218545

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Anna,

The view in its simplest form works. Here i a backup of you view's content area.

[/php]
[wpv-conditional if="( '[wpv-found-count]' eq '1' )"]
<div class="eq-1">[wpv-post-body view_template="loop-item-in-itinerary-days-for-nested-items"]</div>
[/wpv-conditional]
[wpv-conditional if="( '[wpv-found-count]' gte '2' )"]
[wpv-item index=1]
<div class="eq-2 i-1 package-itinerary tab-pane fade active show tab-one" id="tab-[wpv-post-id]" role="tabpanel" aria-labelledby="tab-[wpv-post-id]">
[wpv-post-body view_template="loop-item-in-itinerary-days-for-nested-items"]</div><!--/tab-pane-->
[wpv-item index=other]
<div class="eq-2 i-other package-itinerary tab-pane fade show tab-one" id="tab-[wpv-post-id]" role="tabpanel" aria-labelledby="tab-[wpv-post-id]">
[wpv-post-body view_template="loop-item-in-itinerary-days-for-nested-items"]</div><!--/tab-pane-->
[/php]

Given this you may need to end up remaking this view because i'm finding that its loading "No Items Found" whenever there is a content template being loaded for the post body template. However when the template is added directly to the loop it works. Can you go ahead and remake this entire view as you can now see it is loading the correct relational data.

Thanks,
Shane

#2218559

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Anna,

The view in its simplest form works. Here i a backup of you view's content area.

[/php]
[wpv-conditional if="( '[wpv-found-count]' eq '1' )"]
<div class="eq-1">[wpv-post-body view_template="loop-item-in-itinerary-days-for-nested-items"]</div>
[/wpv-conditional]
[wpv-conditional if="( '[wpv-found-count]' gte '2' )"]
[wpv-item index=1]
<div class="eq-2 i-1 package-itinerary tab-pane fade active show tab-one" id="tab-[wpv-post-id]" role="tabpanel" aria-labelledby="tab-[wpv-post-id]">
[wpv-post-body view_template="loop-item-in-itinerary-days-for-nested-items"]</div><!--/tab-pane-->
[wpv-item index=other]
<div class="eq-2 i-other package-itinerary tab-pane fade show tab-one" id="tab-[wpv-post-id]" role="tabpanel" aria-labelledby="tab-[wpv-post-id]">
[wpv-post-body view_template="loop-item-in-itinerary-days-for-nested-items"]</div><!--/tab-pane-->
[/php]

Given this you may need to end up remaking this view because i'm finding that its loading "No Items Found" whenever there is a content template being loaded for the post body template. However when the template is added directly to the loop it works. Can you go ahead and remake this entire view as you can now see it is loading the correct relational data.

Thanks,
Shane

#2218567

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Anna,

The view in its simplest form works. Here i a backup of you view's content area.

[/php]
[wpv-conditional if="( '[wpv-found-count]' eq '1' )"]
<div class="eq-1">[wpv-post-body view_template="loop-item-in-itinerary-days-for-nested-items"]</div>
[/wpv-conditional]
[wpv-conditional if="( '[wpv-found-count]' gte '2' )"]
[wpv-item index=1]
<div class="eq-2 i-1 package-itinerary tab-pane fade active show tab-one" id="tab-[wpv-post-id]" role="tabpanel" aria-labelledby="tab-[wpv-post-id]">
[wpv-post-body view_template="loop-item-in-itinerary-days-for-nested-items"]</div><!--/tab-pane-->
[wpv-item index=other]
<div class="eq-2 i-other package-itinerary tab-pane fade show tab-one" id="tab-[wpv-post-id]" role="tabpanel" aria-labelledby="tab-[wpv-post-id]">
[wpv-post-body view_template="loop-item-in-itinerary-days-for-nested-items"]</div><!--/tab-pane-->
[/php]

Given this you may need to end up remaking this view because i'm finding that its loading "No Items Found" whenever there is a content template being loaded for the post body template. However when the template is added directly to the loop it works. Can you go ahead and remake this entire view as you can now see it is loading the correct relational data.

Thanks,
Shane

#2222123

You removed the day filtering e.g hidden link it needs to be there. That is the source of the issue
I need:
when there is only one day on tour - don't show day filtering
when there is more than one day - day filtering should appear, and work.
Please fix

#2222485

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Anna,

Would it be possible to gain access to the site that you've just sent? This way I can make a comparison between both sites.

I've enabled the private fields for your next response.

Thanks,
Shane

#2223281

Shane
Supporter

Languages: English (English )

Timezone: America/Jamaica (GMT-05:00)

Hi Anna,

Please check now and let me know the view is displaying the correct informaiton.

Thanks,
Shane