Hello,
I have spent a lot of time searching for similar topic but couldn't find anything related.
I want to show product images in Joomla's search results. I'm using standard Virtuemart - Search plugin with latest Joomla 3 and Virtuemart 3.
Can someone help me with this, please?
Thanks in advance
Yo have to modify the plugin, if you want display the thumb. No setting exist to display image
Thanks, I'm aware of that, but what this modification should be?
Sorry, to long to check and explain. See the plugin code and compare with product product module for eg. you should find the code to add the images
Added the following in template override: templates/<TEMPLATE>/html/com_search/search/default_results.php
<?php
$imgUrl = "";
if (isset($result->product_id)) {
$product = $productModel->getProduct($result->product_id);
$productModel->addImages($product,1);
if (!empty($product->images[0]->file_url_thumb)) {
$imgUrl = '/' . $product->images[0]->file_url_thumb;
} else if (!empty($product->images[0]->file_url)) {
$imgUrl = '/' . $product->images[0]->file_url;
}
}
?>
Then in the same file add the following code where you want to show the image:
<?php if (!empty($imgUrl)) : ?>
<img src='<?php echo $imgUrl; ?>' />
<?php endif; ?>
I am trying to get this to work, but the joomla search only displays the title of the product with the SKU between ( ).
Seems like the code is not working. Or do I need to put it on a exact line?
In plugins/search/virtuemart/virtuemart.php I can delete blank () for SKU.
But i dont know how add image.
I try to templates/<TEMPLATE>/html/com_search/search/default_results.php too, but not work.
add to plugin model for product
call function for add images for selected product
show images for product (thumb or full) by if/else test
what is different Martin?
Why don't you search right code in view.html.php for view productdetail?
In this file are all right codes what do you need.
You don't need exactly code there, you need search and use self... is the bet option for you for future.
Welcome