I am trying to get an image to load, depending on the products Custom Attribute.

I am selling products that have a carrying capacity. 1 up to 4.

The capacity is added to a custom attribute that is like this:

Maximum 1
Maximum 2
Maximum 3
Maximum 4

And these options are displayed accordingly on the list view.

Instead of text, I would like an image which is stored in a folder.

I.e, if the product attribute is "Maximum 1" it loads b1.jpg
"Maximum 2" loads b2.jpg and so on...

I have tried something like this but cannot get it to work.... It just loads the image b1.jpg for all the attributes.

PHP Code:
<!-- Enables the number of bike to show  -->
                                <?php echo   $_product->getAttributeText('color'?> 
$img '';
$capacity 'One'): {
$img $this->getSkinUrl('images/b1.jpg');

                                }    elseif(
$capacity 'Two'): {
$img $this->getSkinUrl('images/b2.jpg');
                                }    elseif(
$capacity 'Three'): {
$img $this->getSkinUrl('images/b3.jpg');
                                }    elseif(
$capacity 'Four'):  {
$img $this->getSkinUrl('images/b4.jpg');
                                <?php if($img): ?>
                                <img src="<?php echo $img?>"  Title="Capacity"/>
                                <?php endif;?>
                                <!-- End here -->

View more threads in the same category: