Author Topic: How to link product image to product details page?  (Read 15013 times)

I

  • Beginner
  • *
  • Posts: 11
How to link product image to product details page?
« on: May 30, 2012, 23:57:18 pm »
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

  • Global Moderator
  • Super Hero
  • *
  • Posts: 10420
  • VirtueMart Version: 3+
Re: How to link product image to product details page?
« Reply #1 on: May 31, 2012, 00:12:45 am »
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
J3.9+ VM 3.4.2
Slowest Page Speed Score (88) (Category)
Fastest Page Speed Score (94-96) (productdetails)

djouga

  • Beginner
  • *
  • Posts: 6
Re: How to link product image to product details page?
« Reply #2 on: June 12, 2012, 10:48:49 am »
I'm bringing up this post as I need an answer too.

Code: [Select]
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

  • Jr. Member
  • **
  • Posts: 146
Re: How to link product image to product details page?
« Reply #3 on: June 12, 2012, 11:03:40 am »
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

  • Beginner
  • *
  • Posts: 6
Re: How to link product image to product details page?
« Reply #4 on: June 12, 2012, 11:29:45 am »
/////// 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:
Code: [Select]
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

  • Beginner
  • *
  • Posts: 28
    • Cyberglide Computers
Re: How to link product image to product details page?
« Reply #5 on: June 29, 2012, 17:06:19 pm »
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.

Code: [Select]
// 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

  • Beginner
  • *
  • Posts: 11
Re: How to link product image to product details page?
« Reply #6 on: September 11, 2012, 11:18:53 am »
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
Code: [Select]
<?php /** @todo make image popup */
echo $product->images[0]->displayMediaThumb('class="browseProductImage" border="0" title="'.$product->product_name.'" ',true,'class="modal"');
?>

change to
Code: [Select]
<?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

  • Jr. Member
  • **
  • Posts: 91
Re: How to link product image to product details page?
« Reply #7 on: November 07, 2012, 00:42:59 am »
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!