Jump to content

what is wrong with this selector? bug?


bernhard
 Share

Recommended Posts

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

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)."

  • Like 1
Link to comment
Share on other sites

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

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

@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

23 minutes ago, adrian said:

You can read more about that here: https://processwire.com/api/selectors/#or-groups

wow, i totally missed that! :o 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..

  • Like 1
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...