Author Topic: How to use image instead of text?  (Read 2745 times)

pamchal

  • Beginner
  • *
  • Posts: 17
How to use image instead of text?
« on: November 28, 2010, 01:43:49 am »
I found what I was looking for in the forum but now I have another problem. Here is the code I must put to my flypage:
<?php

if ($product_url == ""){
  echo $addtocart;
} else {
  echo "<a target=\"_blank\" href=\"".$product_url."\">Go to external site</a><br />";
}

By this, I will have a "Go to external site"  link to a defined address at my flypage. Now I want to show an image instead of text (Go to external site)!

Hoe am I supposed to change the code?!

Thanks in advance :)

seyi

  • 3rd party VirtueMart Developer
  • Jr. Member
  • *
  • Posts: 401
    • AwoDev
Re: How to use image instead of text?
« Reply #1 on: November 28, 2010, 10:23:53 am »
simply replace the text with an image tag.  Something lik this:
Code: [Select]
<?php
echo "<a target=\"_blank\" href=\"".$product_url."\"><img src=\"link/to/the/image.png\" alt=\"external\"></a><br />";
?>

For more on the image tag, do a search in google for 'html img' or something similar.
Seyi A
--------------------
Promotion enhancement for Virtuemart:
   - AwoCoupon FREE - http://www.awocoupon.com/starter
   - AwoCoupon Pro - http://awodev.com/products/joomla/awocoupon
   - AwoRewards - http://awodev.com/products/joomla/aworewards
   - AwoAffiliate - http://awodev.com/products/joomla/awoaffiliate

pamchal

  • Beginner
  • *
  • Posts: 17
Re: How to use image instead of text?
« Reply #2 on: November 28, 2010, 12:19:37 pm »
Great!!!
Thanks :)

Billy

  • Beginner
  • *
  • Posts: 15
Re: How to use image instead of text?
« Reply #3 on: April 11, 2013, 16:56:13 pm »
If you would like to accomplish this same goal on the most recent version of Virtuemart, here's the updated code.

         
Code: [Select]
<?php
if ($this->product->product_url == ""){
  echo $this->loadTemplate('addtocart');
} else {
  echo "<a target=\"_blank\"  href=\"".$this->product->product_url."\">Buy From External Site</a>";
}
?>