mikelexp Posted August 24, 2014 Share Posted August 24, 2014 Hi! I've read the selectors documentation but I can't find how to deal with a situation where you need to do something like this, but with PW pages: SELECT * FROM products WHERE product_name = 'Computer' OR product_category = 'Electronics' There are 2 OR operators documented, "matching one field or another" ("field1|field2=value") and "matching more than one value in the same field" ("field=value1|value2"), but none of them can do what I need. I tried something like this: "field1=value1|field2=value2", but of course it didn't work. I know I could filter the resulting array, but I would be pulling unwanted data from the db and it would break the pagination system. Link to comment Share on other sites More sharing options...
Soma Posted August 24, 2014 Share Posted August 24, 2014 Or groups are in dev since couple months and then 2.5. https://processwire.com/talk/topic/3768-processwire-dev-branch/?p=64049 Link to comment Share on other sites More sharing options...
Pete Posted August 24, 2014 Share Posted August 24, 2014 Soma beat me to it (couldn't find the info in time ). Your code might look something like this: $products = $pages->find("template=product, (product_name=computer, product_category=electronics)"); Link to comment Share on other sites More sharing options...
Soma Posted August 24, 2014 Share Posted August 24, 2014 Soma beat me to it (couldn't find the info in time ). Your code might look something like this: $products = $pages->find("template=product, (product_name=computer, product_category=electronics)"); I think it would be rather $products = $pages->find("template=product, (product_name=computer), (product_category=electronics)"); 4 Link to comment Share on other sites More sharing options...
Pete Posted August 24, 2014 Share Posted August 24, 2014 You are correct, as usual Link to comment Share on other sites More sharing options...
mikelexp Posted August 24, 2014 Author Share Posted August 24, 2014 Wow, thanks guys! I was already using the dev branch but I didn't know it was already there. 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