Jump to content

Selector Question: Price!=Retailprice, Is This Possible?


Recommended Posts

Posted

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!

Posted

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.

  • Like 1

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
  • Recently Browsing   0 members

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