Hi Guys
I have three dropdown filters for a property project that I’m working on that filters bedrooms, bathrooms and parking. I’ve created three different dynamic pages, one if someone selects only the first value, one if someone selects the first and second value and one if someone selects all 3.
Navigation seems to work, however it works with very random results. For instance, if I choose 1 bedroom & 1 bathroom, I will get to the page for 1 bedroom and 2 bathrooms. I can redo the exact same search and then get to a completely different result.
Values are stored in the dropdown ‘field value’.
Can anybody tell me what I’m doing wrong?
import wixLocation from ‘wix-location’;
export function button1_click(event) {
if ($w('#selection1').value === '1') {
wixLocation.to('/Property/rooms/1');
}
if ($w('#selection1').value === '2') {
wixLocation.to('/Property/rooms/2');
}
if ($w('#selection1').value === '3') {
wixLocation.to('/Property/rooms/3');
}
if (($w('#selection1').value === '1')+($w('#selection2').value === '1')) {
wixLocation.to('/Property/rooms/1/bathrooms/1');
}
if (($w('#selection1').value === '2')+($w('#selection2').value === '1')) {
wixLocation.to('/Property/rooms/2/bathrooms/1');
}
if (($w('#selection1').value === '3')+($w('#selection2').value === '1')) {
wixLocation.to('/Property/rooms/3/bathrooms/1');
}
if (($w('#selection1').value === '1')+($w('#selection2').value === '2')) {
wixLocation.to('/Property/rooms/1/bathrooms/2');
}
if (($w('#selection1').value === '2')+($w('#selection2').value === '2')) {
wixLocation.to('/Property/rooms/2/bathrooms/2');
}
if (($w('#selection1').value === '3')+($w('#selection2').value === '2')) {
wixLocation.to('/Property/rooms/3/bathrooms/2');
}
if (($w('#selection1').value == '1')+($w('#selection2').value == '1')+($w('#selection3').value == '1')) {
wixLocation.to('/Property/rooms/1/bathrooms/1/parking/1');
}
if (($w('#selection1').value == '2')+($w('#selection2').value == '1')+($w('#selection3').value == '1')) {
wixLocation.to('/Property/rooms/2/bathrooms/1/parking/1');
}
if (($w('#selection1').value == '3')+($w('#selection2').value == '1')+($w('#selection3').value == '1')) {
wixLocation.to('/Property/rooms/3/bathrooms/1/parking/1');
}
if (($w('#selection1').value == '1')+($w('#selection2').value == '2')+($w('#selection3').value == '1')) {
wixLocation.to('/Property/rooms/1/bathrooms/2/parking/1');
}
if (($w('#selection1').value == '2')+($w('#selection2').value == '2')+($w('#selection3').value == '1')) {
wixLocation.to('/Property/rooms/2/bathrooms/2/parking/1');
}
if (($w('#selection1').value == '3')+($w('#selection2').value == '2')+($w('#selection3').value == '1')) {
wixLocation.to('/Property/rooms/3/bathrooms/2/parking/1');
}
if (($w('#selection1').value == '1')+($w('#selection2').value == '1')+($w('#selection3').value == '2')) {
wixLocation.to('/Property/rooms/1/bathrooms/1/parking/2');
}
if (($w('#selection1').value == '2')+($w('#selection2').value == '1')+($w('#selection3').value == '2')) {
wixLocation.to('/Property/rooms/2/bathrooms/1/parking/2');
}
if (($w('#selection1').value == '3')+($w('#selection2').value == '1')+($w('#selection3').value == '2')) {
wixLocation.to('/Property/rooms/3/bathrooms/1/parking/2');
}
if (($w('#selection1').value == '1')+($w('#selection2').value == '2')+($w('#selection3').value == '2')) {
wixLocation.to('/Property/rooms/1/bathrooms/2/parking/2');
}
if (($w('#selection1').value == '2')+($w('#selection2').value == '2')+($w('#selection3').value == '2')) {
wixLocation.to('/Property/rooms/2/bathrooms/2/parking/2');
}
if (($w('#selection1').value == '3')+($w('#selection2').value == '2')+($w('#selection3').value == '2')) {
wixLocation.to('/Property/rooms/3/bathrooms/2/parking/2');
}
}
Thank you