Skip Navigation

[Resolved] View not returning [wpv-no-items-found] output

This support ticket is created 4 years, 7 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)

Tagged: 

This topic contains 6 replies, has 2 voices.

Last updated by nicolaS-3 4 years, 7 months ago.

Assisted by: Shane.

Author
Posts
#1621173

Hi
I have a very simple view that loops over categories (custom taxonomy) to which I pass an ID as URL parameter (cid) in order to get the passed ID taxonomy title. It works fine if the ID exists, but if I pass a not existing code (eg: 000) it returns the title of first ID in the taxonomy instead of whatever I enter in the [wpv-no-items-found] section (I'd like to display nothing). It looks like it doesn't go into the [wpv-no-items-found], can you explain why ?
thanks
Regards
Nicola?

#1621761

Shane
Supporter

Languages: English (English )

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

Hi Nicola,

Thank you for getting in touch.

You are saying that if you pass an ID that doesn't exist into your View then it still returns a result ?

Does this only happen with this particular view or does it happen with your other views as well .

Please let me know .

Thanks,
Shane

#1622375

Hi Shane,

You are saying that if you pass an ID that doesn't exist into your View then it still returns a result ?
Yes. I found out that if you pass a string like xxx it returns nothing (ok) but if you pass a numeric id like 0000 it returns whatever first category item depending on the chosen sort criteria. To solve this case I can pass xxx, but in other cases one might need to pass a numeric value.
You already have access to my site, use this page to test: MY_SITE/test-title/?cid=000000 and you can use the last page starting with zzz to list the category codes.
I didn't test it with other views, but this one is very simple.
Thanks
Regards
Nicola

#1622503

Hi Shane
referring to what above, I checked that on the live page I cannot pass xxx, I do need that when the parameter isn't passed the view returns nothing, otherwise other selections would go belly up.
I have tried this solution:
[wpv-conditional if="( '[wpv-attribute name='catg']' ne '' )"][wpv-view name="pseudoarchive-title-cat"][/wpv-conditional]
[wpv-conditional if="( '[wpv-attribute name='xtag']' ne '' )"][wpv-view name="pseudoarchive-title-tags"][/wpv-conditional]
[wpv-filter-meta-html]
[wpv-layout-meta-html]
but the condition is not working, the two titles are both displayed, the one passed by parameter is correct, the other one gets the first item in the taxonomy instead of returning nothing. Consequence is that it shows two titles instead of one ! Can you suggest a different condition ?
Thanks
Regards

#1622897

Ooops sorry, I made a mistake, this is the updated code:
[wpv-conditional if="( '[wpv-attribute name='xtag']' eq '' )"][wpv-view name="pseudoarchive-title-cat"][/wpv-conditional]
[wpv-conditional if="( '[wpv-attribute name='catg']' eq '' )"][wpv-view name="pseudoarchive-title-tags"][/wpv-conditional]
[wpv-filter-meta-html]
[wpv-layout-meta-html]

#1623081

Shane
Supporter

Languages: English (English )

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

Hi Nicola,

The correct code should be.

CATEGORY VIEW
{!{wpv-conditional if="( '{!{wpv-search-term param='cid'}!}' ne '' )"}!}

{!{wpv-view name='pseudoarchive-title-cat'}!}

{!{/wpv-conditional}!}

TAG VIEW
{!{wpv-conditional if="( '{!{wpv-search-term param='xtag'}!}' ne '' )"}!}

{!{wpv-view name='pseudoarchive-title-tags'}!}

{!{/wpv-conditional}!}

If you take a look at my testing here
/test-title/?cid=144

You should see it working. The correct shortcode to use to get the value from the URL is the [wpv-search-term]

Finally to clear up the issue with the "no results found" section not showing when a URL parameter isn't providing is that views will default to displaying the content when no filter parameter is provided.

Please let me know if this helps.
Thanks,
Shane

#1623185

My issue is resolved now. Thank you!