First I check IF the queryString.Get("gender") isn't null.
Great, it isn't null and there's a price-filter applied so now it renders out the products in the first selectedItems with the gender & price.
Second In the else I say that if there's NO price filtering applied it should check AGAIN if the queryString.Get("gender") exist. If it does, it renders out all products but only those in the selected gender.
Default with NO selected gender if there ISN'T any queryString.Get("gender") applied it looks in bool isMale in the top of the code and takes it default True value. How do I prevent this? How do I make the first bool isMaletrue AND false?
Bool property show True & False items
Hey guys,
I'm trying to display products based on a
boolean
.But by default I'd like it to display products in both
true
andfalse
.TLDR
I declare my isMale to be
true
which by default ONLY displays all products which istrue
. This is not the point, I also wan'tfalse
products.I tried writing it like this:
But that returns a error telling me the
Value cannot be null.
when no gender is selected.Live example here
EXPLAINING THE CODE:
First I check
IF
thequeryString.Get("gender")
isn't null. Great, it isn't null and there's a price-filter applied so now it renders out the products in the firstselectedItems
with the gender & price.Second In the
else
I say that if there's NO price filtering applied it should check AGAIN if thequeryString.Get("gender")
exist. If it does, it renders out all products but only those in the selected gender.Default with NO selected gender if there ISN'T any
queryString.Get("gender")
applied it looks inbool isMale
in the top of the code and takes it defaultTrue
value. How do I prevent this? How do I make the firstbool isMale
true
ANDfalse
?ALL CODE: Prettier code snippet here
I asked the same question on stack overflow. I think I wrote my question a lot better there: See the thread here
The solution to show both true and false products?
Credit's to Thomas Ayoub
is working on a reply...