Joining page attributes into a range 5.6.2.1
PermalinkThis 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?
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?
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 } ?>
There is one bedroom units but I am not too worries about the (s), would be nice but isn't crucial.
Many thanks!
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?