VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: babouz on August 09, 2012, 15:40:44 PM

Title: [SOLVED] Hide "image unvailable" in category when there's no image
Post by: babouz on August 09, 2012, 15:40:44 PM
Hi everybody,
I need some help... I don't find how to hide image "image unvailable" when category don't have an image...

To be clear, what I want it's :
- there's an image for my category -> show it
- there's no image for my category -> show nothing

I'll appreciate any help  ;)

Thank you
Title: Re: Hide "image unvailable" in category when there's no image
Post by: babouz on August 10, 2012, 11:12:31 AM
UP !
Please, nobody know how to do this ?

Thank you
Title: Re: Hide "image unvailable" in category when there's no image
Post by: babouz on August 20, 2012, 11:41:37 AM
I've found a solution to hide "image unvailable" but it's not really what I wanted...
What I do, it's showing image only on certain category... but I would like to have something more automatic... I'm not developper, so forgive me my code if you find this too dumb :)

However I'll really apreciate if someone would give me a hand on this case :)


<?php 
 $mycat 
$category->virtuemart_category_id;
 if (
$mycat == 70 || $mycat == 71 || $mycat == 72 || $mycat == 73 || $mycat == 74 || $mycat == 75 || $mycat == 76){
 echo 
$category->images[0]->displayMediaThumb("",false);
 }else{
 echo 
'';
 }
?>

Title: Re: Hide "image unvailable" in category when there's no image
Post by: ivus on August 20, 2012, 22:35:37 PM
Hi babouz,

to automatically test for category images, use the following code:



<?php  if (count($category->virtuemart_media_id) > 0) {
    echo $category->images[0]->displayMediaThumb("",false);
?>




I hope this helps. :D
Title: Re: Hide "image unvailable" in category when there's no image
Post by: babouz on August 21, 2012, 09:30:26 AM
Quote from: ivus on August 20, 2012, 22:35:37 PM
Hi babouz,

to automatically test for category images, use the following code:



<?php  if (count($category->virtuemart_media_id) > 0) {
    echo $category->images[0]->displayMediaThumb("",false);
?>




I hope this helps. :D

Hi ivus,
It works great and it's better than my code  ;D
It's really what I wanted to do ! thank you very much for your help !
Title: Re: Hide "image unvailable" in category when there's no image
Post by: ivus on August 21, 2012, 09:37:05 AM
Glad it works for you.  ;D
Title: Re: Hide "image unvailable" in category when there's no image
Post by: iwanna on June 24, 2014, 14:50:55 PM
Quote from: ivus on August 20, 2012, 22:35:37 PM
Hi babouz,

to automatically test for category images, use the following code:



<?php  if (count($category->virtuemart_media_id) > 0) {
    echo $category->images[0]->displayMediaThumb("",false);
?>




I hope this helps. :D


Hi,
Even if it is an old article, I was searching for this solution too..
Could somebody tell me where is the path file to edit with this code ?
Title: Re: [SOLVED] Hide "image unvailable" in category when there's no image
Post by: GJC Web Design on June 24, 2014, 15:42:22 PM
assume in

components/com_virtuemart/views/category/tmpl/default.php

or

templates/YOUR_TEMPLATE/html/com_virtuemart/category/default.php
Title: Re: [SOLVED] Hide "image unvailable" in category when there's no image
Post by: iwanna on July 08, 2014, 11:25:57 AM
thank you  :)...