Juergen Posted August 19, 2015 Posted August 19, 2015 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
Wanze Posted August 19, 2015 Posted August 19, 2015 Hi Juergen, Did you try: $productpriceitems = $child->find("template=productpricelistitem, sort=-standardprice, offerprice");
Juergen Posted August 19, 2015 Author Posted August 19, 2015 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)
Wanze Posted August 19, 2015 Posted August 19, 2015 Sorry, I wanted to write the following: $productpriceitems = $child->find("template=productpricelistitem, sort=-standardprice, sort=offerprice");
Juergen Posted August 19, 2015 Author Posted August 19, 2015 No error anymore, but it doesnt grab the lowest price of the offer (3 €). It only grabs the lowest standardprice (5 €).
Wanze Posted August 19, 2015 Posted August 19, 2015 $productpriceitems = $child->find("template=productpricelistitem, sort=-standardprice")->sort("-offerprice");
Juergen Posted August 19, 2015 Author Posted August 19, 2015 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.
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