Joining page attributes into a range 5.6.2.1
Permalink
I have a question about displaying custom page attributes together. I will explain below what I have and what I ultimately need to render.
This is a property rental site. A building has multiple attributes for number of bedrooms, rent, etc. So right now if I show what's available I get this:
2 bedrooms - $1,095
2 bedrooms - $1,495
What I would like to show is this:
2 bedrooms $1,095-$1,495
I assume this is possible, I am just drawing a blank here!
Anyone have an idea?
This is a property rental site. A building has multiple attributes for number of bedrooms, rent, etc. So right now if I show what's available I get this:
2 bedrooms - $1,095
2 bedrooms - $1,495
What I would like to show is this:
2 bedrooms $1,095-$1,495
I assume this is possible, I am just drawing a blank here!
Anyone have an idea?
It's a combo of attribute like this...
2 bedrooms - $1,095' the value of a single text attribute
If unit_one_beds and unit_two_beds values are the same, I want to use their respective rents as the range. does that make sense?
2 bedrooms - $1,095' the value of a single text attribute
If unit_one_beds and unit_two_beds values are the same, I want to use their respective rents as the range. does that make sense?
There is a lot more to be considered as you might have buildings with 3 or more individual units?
Also, are there ever 1 bedroom units? Then you have to check if you need plural or singular for bedroom(s)
Otherwise this will work:
Also, are there ever 1 bedroom units? Then you have to check if you need plural or singular for bedroom(s)
Otherwise this will work:
<?php if ($unit_one_beds==$unit_two_beds) { ?> <?php echo $unit_one_beds ?> Bedrooms $<?php echo $unit_one_rent ?> - $<?php echo $unit_two_rent ?> <?php } else { ?> <?php echo $unit_one_beds ?> Bedrooms $<?php echo $unit_one_rent ?> <?php echo $unit_two_beds ?> Bedrooms $<?php echo $unit_two_rent ?> <?php } ?>
Worked like a charm!
There is one bedroom units but I am not too worries about the (s), would be nice but isn't crucial.
Many thanks!
There is one bedroom units but I am not too worries about the (s), would be nice but isn't crucial.
Many thanks!
Here's another one for ya! Let's just say the user doesn't enter them from lowest to highest? Is there an easy way to grab the lowest and put it first? And what if there are more than two apartments with the same amount of bedrooms, how to show a range on that?
Sorry for all the questions, I appreciate your help! ;)
Sorry for all the questions, I appreciate your help! ;)
Is '2 bedrooms - $1,095' the value of a single text attribute and
'2 bedrooms - $1,495' is just another instance of that attribute type?
Or are you using other combinations of attributes?