VirtueMart Forum

VirtueMart 2 + 3 + 4 => General Questions => Topic started by: charlycx on November 26, 2013, 22:03:00 PM

Title: Disable products do no have image
Post by: charlycx on November 26, 2013, 22:03:00 PM
Good afternoon.

Excuse my English.

I have a client with a store with over 4000 products.

many products do no have image.

VM2 can be configured to not display the products that no have image?

Thanks
Title: Re: Disable products do no have image
Post by: GJC Web Design on November 26, 2013, 22:41:33 PM
without hacking the core query you could do something like this in the product template

// Start the Output
foreach ($this->products as $product) {
if($product->virtuemart_media_id[0] > 0){


don't forget the closing curly brace

this will only prevent them displaying - will still appear (I assume) in search etc
Title: Re: Disable products do no have image
Post by: charlycx on November 27, 2013, 17:13:49 PM
Thank you very much ...

Sorry I'm not an expert.

Where exactly put this hack?

thanks again

Quote from: GJC Web Design on November 26, 2013, 22:41:33 PM
without hacking the core query you could do something like this in the product template

// Start the Output
foreach ($this->products as $product) {
if($product->virtuemart_media_id[0] > 0){


don't forget the closing curly brace

this will only prevent them displaying - will still appear (I assume) in search etc
Title: Re: Disable products do no have image
Post by: GJC Web Design on November 27, 2013, 17:22:05 PM
make a template over ride

templates/your_template/html/com_virtuemart/category/default.php

default.php is copied from

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

code
if($product->virtuemart_media_id[0] > 0){

goes straight after ~ line 213


// Start the Output
foreach ($this->products as $product) {


................   ............................

closing curly
}

goes immediately before  ~ line 423

} // end of foreach ( $this->products as $product )
Title: Re: Disable products do no have image
Post by: Maxim Pishnyak on November 30, 2013, 12:08:39 PM
Quote from: charlycx on November 26, 2013, 22:03:00 PM
many products do no have image.

VM2 can be configured to not display the products that no have image?
You should use forum search for finding already posted solutions. For example using 1x1 transparent images (placeholders).