Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tvFilters and includeTVList conflict #62

Closed
pdincubus opened this issue May 9, 2014 · 2 comments
Closed

tvFilters and includeTVList conflict #62

pdincubus opened this issue May 9, 2014 · 2 comments

Comments

@pdincubus
Copy link

Using "pdoResources" & "pdoPage" with "includeTVList" and "tvFilters" parameters causes "includeTVList" to be ignored and the only TVs used are those in the tvFilters list.
Removing tvFilters from the snippet call fetches the correct tv list.

E.g:

This works and returns all the TVs in the includeTVList option.

[[!pdoPage?
        &elementClass=`modSnippet`
        &element=`pdoResources`
        &parents=`[[*id]]`
        &limit=`12`
        &showHidden=`1`
        &includeContent=`0`
        &includeTVs=`1`
        &processTVs=`1`
        &includeTVList=`tv1,tv2,tv3`
        &where=`{"template:IN":[id list]}`
        &tpl=`chunkname`
      ]]

But this does not, and returns only filter and filter2 but not tv1, tv2 and tv3

[[!pdoPage?
        &elementClass=`modSnippet`
        &element=`pdoResources`
        &parents=`[[*id]]`
        &limit=`12`
        &showHidden=`1`
        &includeContent=`0`
        &includeTVs=`1`
        &processTVs=`1`
        &includeTVList=`tv1,tv2,tv3`
        &where=`{"template:IN":[id list]}`
        &tpl=`chunkname`
        &tvFilters=`filter==value,filter2==value`
      ]]

Switching out pdoResources for getResources works fine.

@bezumkin
Copy link
Collaborator

bezumkin commented May 9, 2014

pdoResources is not getResources.

See http://docs.modx.pro/en/components/pdotools/general-settings for right use of snippet parameters.

@bezumkin bezumkin closed this as completed May 9, 2014
@pdincubus
Copy link
Author

Thanks for your reply. I think I didn't explain the issue very well before. I read through the documentation and it doesn't say that &includeTVList and &tvFilters are mutually exclusive.

In getResources I can specify a list of TVs to fetch for the resources, and filter using a different list of TVs.

In pdoResources can I not do this? The only workaround I can see is to include a list of all TVs I want as part of the tvFilters option.

I did a test page to try and show what I mean.

I set up a page with two template variables: An image and a "section name". I want to find the resources with a certain "section" and show the image from it.

I noticed that getResources uses &parents=-1 to specify specific resources, pdoResources uses &parents=0 to do the same.

##pdoResources

The snippet call:

 [[!pdoResources?
  &parents=`0`
  &resources=`79`
  &processTVs=`1`
  &includeTVList=`mainImage`
  &tvFilters=`sectionClass==guides`
  &tpl=`test`
]]
  • Image: BLANK
  • Section: guides

##getResources

The call:

[[!getResources?
  &parents=`-1`
  &resources=`79`
  &includeTVs=`1`
  &processTVs=`1`
  &includeTVList=`mainImage`
  &tvFilters=`sectionClass==guides`
  &debug=`1`
  &tpl=`test`
 ]]
  • Image: assets/images/ofp.jpg
  • Section: BLANK

In this test, the getResources call returns the correct data, but pdoResources doesn't. The only way I seem to be able to get the output I expect from pdoResources is to do this:

 [[!pdoResources?
  &parents=`0`
  &resources=`79`
  &processTVs=`1`
  &tvFilters=`sectionClass==guides,mainImage==%`
  &tpl=`test`
]]

Which part of my pdoResources call is incorrect? Did I miss something obvious in the documentation?

Many thanks.
:)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants