Roope Posted May 16, 2013 Share Posted May 16, 2013 Hello guys! I have a site where product template has Page field for Vendors and Product Families. All families allways belong under specific vendor so tree looks like this: Vendor 1Family A Family B Vendor 2Family C Family D I'd like to have only those families selectable that belong to selected vendor: If page has Vendor 1 selected, options for Families would be Family A and B. If there is no vendor set, then all families would be selectable. I've tried to set parent=$vendor, template=vendor and parent=$page->vendor, template=vendor for Custom selector in input tab but this throws error on page edit: Unknown Selector operator: '=$' -- was your selector value properly escaped? So variables don't seem to work here. I also tried $pages->find("parent=$page->vendor, template=vendor"); to Custom PHP field. This doesn't throw any errors but doesn't display any options either. Is this possible to achieve some way? Link to comment Share on other sites More sharing options...
Soma Posted May 16, 2013 Share Posted May 16, 2013 The $page var in the custom PHP field is "broken" in 2.3 as it doesn't return the page edited anymore but the process page edit. I just got a problem with this yesterday when updating a website to latest PW. I fixed it by using $_GET['id'] to get the id of the page being edited. $p = $pages->get($_GET['id']); 1 Link to comment Share on other sites More sharing options...
Roope Posted May 16, 2013 Author Share Posted May 16, 2013 It's working! I also noticed that I forgot to return value and was using wrong template selector at my previous attempt but this got the work done: $p = $pages->get($_GET['id']); return $pages->find("parent=$p->vendor, template=family"); Very nice. Thank you again Soma, you're always super helpful! 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