You are here:  » Extra image if the field_sold = Yes

Support Forum



Extra image if the field_sold = Yes

Submitted by haggle on Sat, 2010-06-05 07:07 in

How would you code the PHP if you would like to show an extra image next to the standard image if the field "sold" has a value "Yes"?
In the link below I have modified the image itself but would like to just display a little image with the red dot next to it.
Any ideas? Should I do this manually?

See link below:

http://art.hagoole.com.au/products.php?q=Annalena

Submitted by support on Mon, 2010-06-07 08:50

Hi,

No problem - within the main part of html/product.php, you can simply add code as follows:

<?php
  
if ($mainProduct["sold"] == "Yes")
  {
    print 
"<img src='/images/sold.gif' />";
  }
?>

To make this appear alongside the main image, look for the following code starting at line 6:

        <?php if ($mainProduct["image_url"]): ?>
          <img width='180' src='<?php print $mainProduct["image_url"]; ?>' alt='<?php print $mainProduct["name"]; ?>' />
        <?php endif; ?>

...and then insert the code above immediately afterward...

Cheers,
David.