News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

How to link product image to product details page?

Started by I, May 30, 2012, 23:57:18 PM

Previous topic - Next topic

I

Hello!

At this moment when I click on Product image in categorie view, it opens in pop up.  How to get that Image is linked to product page?

How I understand I must change something in this code:

echo $product->images[0]->displayMediaThumb('class="browseProductImage" border="0" title="'.$product->product_name.'" ',true,'class="modal"');

But what I must change??? I tried a lot of variations but with out results :(

Is here some solution?

Kind regards,
Felix

PRO

Link Image to product page
<?php echo JHTML::_('link', JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id='.$product-
>virtuemart_product_id.'&virtuemart_category_id='.$product->virtuemart_category_id),$product->images[0]->displayMediaThumb
('class="browseProductImage" border="0"',false)); ?>


http://forum.virtuemart.net/index.php?topic=97744.0

djouga

#2
I'm bringing up this post as I need an answer too.

Link Image to product page
<?php echo JHTML::_('link'JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id='.$product-
>
virtuemart_product_id.'&virtuemart_category_id='.$product->virtuemart_category_id),$product->images[0]->displayMediaThumb
('class="browseProductImage" border="0"',false)); ?>


This works but only on the category products listing and not on the main page (where you can see new products, best selling products and featured products)

I'd like to make that work there aswell.

srajca

To make it work in the frontpage or any other category or top ten view you have to use the code given by BanquetTables.pro in those views. For example if you want to change it in your frontpage then make an override and edit the following file -
templates/YOURTEMPLATE/html/com_virtuemart/virtuemart/default_products.php   ---->   this is for the top10 and featured etc on your frontpage
templates/YOURTEMPLATE/html/com_virtuemart/virtuemart/default_categories.php   ---->   this is for the categories in your frontpage
templates/YOURTEMPLATE/html/com_virtuemart/category/default.php   ---->   this is for the products in category view
etc.
Hope it helps

djouga

#4
/////// Thanks for the advice!


EDIT: SOLVED!

1) Edit default_products.php (in components/com_virtuemart/views/virtuemart/tmpl/)
2) Go to line 57 and remove or comment the code (after if ($product->images) {)
3) Add this instead:
echo JHTML::_('link', JRoute::_('index.php?option=com_virtuemart&view=productdetails&virtuemart_product_id='.$product->virtuemart_product_id.'&virtuemart_category_id='.$product->virtuemart_category_id),$product->images[0]->displayMediaThumb('class="featuredProductImage" border="0"',false));

mrooks1984

#5
hello, on the same sort of thing, could someone please tell me how to make the big image linkable to the full image in a new window, just cant figure it out.


// Product Main Image
if (!empty($this->product->images[0])) {
    ?>
    <div class="main-image">
<?php echo
'<A HREF="' $this->product->images[0]->displayMediaFull() . '"/>'.$this->product->images[0]->displayMediaFull('width="400px" class="medium-image" id="medium-image"'false"class='modal'"true) . '</a>'?>

    </div>
<?php // Product Main Image END ?>

<?php
// Showing The Additional Images
// if(!empty($this->product->images) && count($this->product->images)>1) {
if (!empty($this->product->images)) {
    
?>

    <div class="additional-images">
<?php
// List all Images
if (count($this->product->images) > 0) {
    foreach ($this->product->images as $image) {
echo '<div class="floatleft">' $image->displayMediaThumb('class="product-image"'true'class="modal"'truetrue) . '</div>'//'class="modal"'
    }
}
?>

        <div class="clear"></div>

got this far in the code, but i know this part of the code is wrong: '<A HREF="' . $this->product->images[0]->displayMediaFull() . '"/> but i dont know what it needs to be. many thanks all.
Joomla and Virtuemart Website Designer

My Website:
http://www.cyberglide.co.uk

I

I working with Gavick esport template and in my case I have changed code in templates/gk_esport/html/com_virtuemart/category/default.php

in line 195
<?php /** @todo make image popup */
echo $product->images[0]->displayMediaThumb('class="browseProductImage" border="0" title="'.$product->product_name.'" ',true,'class="modal"');
?>


change to
<?php /** @todo make image popup */
echo '<a href="' $product->link '" title="' $product->product_name '"><img src="' $product->images[0]->file_url_thumb '" alt="' $product->product_name '" /></a>';

?>


maybe it's not so professional, but it works :)

fanny0

As you can do so when you go to a category using the menu


http://provolt.cl/index.php/2012-08-19-21-10-08/2012-08-19-21-12-50


click the image to go directly to the product and not the image that pleases



No file should I change that, I tried changing that is not listed but which is


thank you very much!