joer80 Posted July 18, 2014 Share Posted July 18, 2014 I want to get pages where the price is not empty, and not the same as retail. So it needs to act on a value I give, and compare itself to another field. ie. Price!=, Price!=RetailPrice So far, my tests show that the second one does not do anything! Is this possible? Thanks! Link to comment Share on other sites More sharing options...
diogo Posted July 18, 2014 Share Posted July 18, 2014 Not possible, you can only have field names on the left of the operand. Alternatively you could either find all the pages where price is not empty, and then remove the ones where retail price is the same inside a foreach: // not tested $result = $pages->find('Price!='); foreach ($result as $r) { $result->remove($result->get("RetailPrice=$r->Price")); } or create a new field that holds the diference of those two fields by hooking on page save to populate it. 1 Link to comment Share on other sites More sharing options...
adrian Posted July 18, 2014 Share Posted July 18, 2014 Or you can use SQL directly as per Ryan's suggestion to a similar question I had: https://processwire.com/talk/topic/3053-possible-to-select-modifiedcreated/?p=30093 It always feels dirty to me to query and then truncate 1 Link to comment Share on other sites More sharing options...
diogo Posted July 18, 2014 Share Posted July 18, 2014 Eheh, I give an example for my second suggestion on that thread, thanks Adrian Hey diogo - cool idea and a great example of how easy it is to create a module. Looking forward to finding a little time to start creating my own soon. http://modules.processwire.com/authors/adrian/ 2 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