bernhard Posted January 1, 2017 Share Posted January 1, 2017 happy new year to everybody! what is wrong with my selector? or is this a bug? as soon as i add the has_parent statement it shows entries of 2016... template=booking,created>1483225200,sort=-renr // works, timestamp = 1.1.2017 template=booking,has_parent=3643|5992|7537|7548|8409|8653|8664|8675|11126,created>1483225200,sort=-renr // does NOT work... shows entries of 2016 edit: i can't reproduce this on another website... any hints what could be the reason? Link to comment Share on other sites More sharing options...
tpr Posted January 1, 2017 Share Posted January 1, 2017 I might be wrong but as I remember has_parent only works with one value. Edit: the docs says "Note however that at present, you can only specify one page at a time here (meaning no has_parent=1|2|3)." 1 Link to comment Share on other sites More sharing options...
bernhard Posted January 1, 2017 Author Share Posted January 1, 2017 that is interesting because it works as expected and this does not seem to be the reason, because on another site it works also with has_parent=1|2 i solved it by adding an if statement ala $lastBooking = $pages->findOne(...); if($lastBooking->id AND date('Y', $lastBooking->created) == date('Y')) return $lastBooking->renr + 1; else return 1; but i would still be interested in the reason for the wrong result on my selector and why the docs say has_parent=1|2|3 does not work while it seems to work well in this case... i hope someone knows the reason Link to comment Share on other sites More sharing options...
adrian Posted January 1, 2017 Share Posted January 1, 2017 In a rush, so no help on the selector, but here is the info on has_parent now supporting multiple values: https://processwire.com/blog/posts/processwire-core-and-profields-updates-2.5.22/#has_parent-selectors-now-support-multi-value 2 Link to comment Share on other sites More sharing options...
tpr Posted January 1, 2017 Share Posted January 1, 2017 Do you have spaces around " = " in the "timestamp"? Link to comment Share on other sites More sharing options...
bernhard Posted January 1, 2017 Author Share Posted January 1, 2017 thank you adrian, that is a good reason why it is working @tpr no, exactly like pasted above created>12345 i guess if there is no obvious reason i would have to investigate further. but as i solved my problem in a different way i guess i will not have time for that at the moment Link to comment Share on other sites More sharing options...
LostKobrakai Posted January 1, 2017 Share Posted January 1, 2017 has_parent doesn't work (or at least not correctly) with OR pipes. The only way to make that work is with OR groups like so: branch=(has_parent=1234), branch=(has_parent=1237) Link to comment Share on other sites More sharing options...
bernhard Posted January 1, 2017 Author Share Posted January 1, 2017 @LostKobrakai did you see adrians link to the blog post? https://processwire.com/blog/posts/processwire-core-and-profields-updates-2.5.22/#has_parent-selectors-now-support-multi-value anyhow, i don't really understand your selector. i've never seen syntax like branch=(has_parent=123) i would have expected (has_parent=123), (has_parent=321) do you have more info on that? Link to comment Share on other sites More sharing options...
adrian Posted January 1, 2017 Share Posted January 1, 2017 2 minutes ago, bernhard said: do you have more info on that? You can read more about that here: https://processwire.com/api/selectors/#or-groups Link to comment Share on other sites More sharing options...
LostKobrakai Posted January 1, 2017 Share Posted January 1, 2017 I know that blog post, but having had so many issues with it on 2.7.3 I know for sure it doesn't work at least in that version. Link to comment Share on other sites More sharing options...
bernhard Posted January 1, 2017 Author Share Posted January 1, 2017 23 minutes ago, adrian said: You can read more about that here: https://processwire.com/api/selectors/#or-groups wow, i totally missed that! thank you! 18 minutes ago, LostKobrakai said: I know that blog post, but having had so many issues with it on 2.7.3 I know for sure it doesn't work at least in that version. ok, i see.. 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now