Jump to content

Sorting children based on 2 instead of 1 field


Juergen
 Share

Recommended Posts

Hello @ all,

I have created a product page where all products and their lowest price should be visible.

Example:

Product 1 has

   -standardprice 1 (fe. small size) -> 5€

   -standardprice 2 (fe. medium size) -> 10€

   -standardprice 3 (fe. large size) -> 15€

Same product but 3 price variation for different sizes. In addition there is also a special offer price availiable for this product:

   -offerprice 1 (fe. a second hand used product with a special price ) -> 3€

My aim is to output the lowest price of all in the template. In this case the offerprice of 3€;

Every price is a own page, therefore I use this piece of code to find the child pages and sort it by the prices:

$productpriceitems    = $child->find("template=productpricelistitem, sort=-standardprice");

This piece of code sorts all the prices by the standardprice.

My problem:

How can I sort them combined with standard and offerprice? ????

$productpriceitems    = $child->find("template=productpricelistitem, sort=-standardprice AND offerprice");

This piece of code doesnt work.

Is there a possibility to sort children combinded with 2 fields?

Best regards Jürgen

Link to comment
Share on other sites

Yes but I got the following error message:

Error: Exception: Unknown Selector operator: '' -- was your selector value properly escaped? field='offertprice', value='', selector: 'has_parent=2392, template=productpricelistitem, sort=-standardprice,offertprice' (in /home/.sites/24/site1275/web/wire/core/Selectors.php line 283)
Link to comment
Share on other sites


Parse Error: syntax error, unexpected '"' (line 45 of /home/.sites/24/site1275/web/site/templates/inc/productitems/productsblogitem.inc)

It also doesnt work if the quotes are set correctly - but the error message ist not visible anymore.

Link to comment
Share on other sites

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
 Share

  • Recently Browsing   0 members

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