Jump to content

PHP command for displaying an image


martin22

Recommended Posts

Hi there,

 

This is a bit of a newbie question, but i need the command for displaying an image within the server. Its for a magento website, which shows the text "Availability: In Stock" on the product pages. Instead of the text showing up, i want an image to appear instead. Here is the code on the relevant phtml file:

 

<?php $_product = $this->getProduct() ?>

 

<?php if($_product->isSaleable()): ?>

    <p><?php echo $this->__('Availability: In stock.') ?></p>

<?php else: ?>

    <p><?php echo $this->__('Availability: Out of stock.') ?></p>

<?php endif; ?>

 

Does anybody have an ideas?

 

Thanks in advance

 

Martin

Link to comment
https://forums.phpfreaks.com/topic/164640-php-command-for-displaying-an-image/
Share on other sites

You mean something like...

 

<?php $_product = $this->getProduct() ?>

<?php if($_product->isSaleable()): ?>
    <p><img src="img/in_stock.gif" alt="In Stock" /></p>
<?php else: ?>
    <p><img src="img/out_of_stock.gif" alt="Out of Stock" /></p>
<?php endif; ?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.