News:

Support the VirtueMart project and become a member

Main Menu

[SOLVED] Hide "image unvailable" in category when there's no image

Started by babouz, August 09, 2012, 15:40:44 PM

Previous topic - Next topic

babouz

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
Where is mum? She is in the bathroom. Where is dad? He is not at home. Why? I don't know.

babouz

Where is mum? She is in the bathroom. Where is dad? He is not at home. Why? I don't know.

babouz

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 
'';
 }
?>

Where is mum? She is in the bathroom. Where is dad? He is not at home. Why? I don't know.

ivus

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

babouz

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 !
Where is mum? She is in the bathroom. Where is dad? He is not at home. Why? I don't know.

ivus


iwanna

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 ?

GJC Web Design

assume in

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

or

templates/YOUR_TEMPLATE/html/com_virtuemart/category/default.php
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation