LostKobrakai Posted November 22, 2014 Posted November 22, 2014 I have a cart template, with a pagetable "cart" which holds all the products in the cart. But somehow my selector won't find the cart to a anonymous user, while Lister finds it and my second line of code clearly states, that there is a page with a product of the id 1035. Does somebody see what I miss? $pages->get("template=shop-cart, user=40, session=6b53ec96ea298445183c269bf0d51d54, cart.product=1035, include=all, check_access=0")->id // returns int(0) $pages->get("template=shop-cart, user=40, session=6b53ec96ea298445183c269bf0d51d54")->cart->first()->product->id // returns int(1035)
LostKobrakai Posted November 22, 2014 Author Posted November 22, 2014 I found that allowing people to get search results for the cart-item template solved the issue, but I thought check_access=0 would takes care about those restrictions.
Martijn Geerts Posted November 22, 2014 Posted November 22, 2014 get will get it, regardless of state. 4
Joss Posted November 22, 2014 Posted November 22, 2014 get will get it, regardless of state. I think that should be a metaphor for life 3
LostKobrakai Posted November 23, 2014 Author Posted November 23, 2014 get wil get it, regardless of state. But it only found something as superuser, but not as guest. Not until i changed the settings of the cart-item template (child of cart) to be findable by unallowed roles it worked. So the state is only ignored for the page itself, but not for subfields aka all the pagefields. Even with the check_access selctor.
Martijn Geerts Posted November 23, 2014 Posted November 23, 2014 $pages->get will not use check_access:$pages->get("template=shop-cart, user=40, session=6b53ec96ea298445183c269bf0d51d54, cart.product=1035, include=all, check_access=0")->id So sounds expected behaviour to me, as cart.product=1035 performs a find in the scope of the current user. And that find isn't allowed due to access rights. little note: When you do a find (not get) and use include=all there's no need to call check_access=0 as that is assumed by that. 1
LostKobrakai Posted November 24, 2014 Author Posted November 24, 2014 I just wanted to highlight that subpages aren't affected by your statement "get will get it, regardless of state". For the selector I tried both simply because it had not worked the way I was expecting it to work. But I never had an issue like this before, so in the beginning I wasn't really aware that the cart-item template could tamper with the result. 1
Martijn Geerts Posted November 24, 2014 Posted November 24, 2014 Actually I have been in the same situation but then in the context of inputfield Page. (Not showing pages for loggedin users except root). It was a real question for me then, but it makes sense after you get the concept. 1
LostKobrakai Posted November 24, 2014 Author Posted November 24, 2014 Yeah, that's why I wanted to make your statement a little bit more clear for potential other readers of this thread. 1
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