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

Referencing product URL page instead of product thumbnail URL in category view

Started by ilias81, August 01, 2013, 23:26:33 PM

Previous topic - Next topic

ilias81

Hello all,
When a user views the category page, currently if he clicks on the product image a thumbnail image popup is shown.
The behavior that I want is that when a user clicks on the product image, he should be redirected to the product main page in the same way as if he clicks on the product title.
I see that this can be done by changing $href in the following line (administrator\components\com_virtuemart\helpers\mediahandler.php):
$lightboxImage = '<a '.$file_alt.' '.$effect.' href="'.$href.'">'.$image.'</a>';

What I like to do is to change $href  with the product page URL, indeed I tried to substitute it with $product->link and $parent->link but both didn't work..
Anyone can help?
thanks too much!

sadrem

HI,
You should not change core files of VM. You may achieve Your goal easily by template overwrite.
just put /components/com_virtuemart/views/category/tmpl/default.php
into /templates/[your template name]/html/com_virtuemart/category/default.php

line near 234
<a title="<?php echo $product->link ?>" rel="vm-additional-images" href="<?php echo $product->link?>">
<?php
echo $product->images[0]->displayMediaThumb('class="browseProductImage"'false);
?>

</a>


remove rel="vm-additional-images"
p.s. Do not forget to change message icon to Solved.

ilias81

Hello, thank you..
After your suggestion to substitute the files, I didn't find "rel=vm-additional-images" you mentioned.
I tested anyway, but I still get the same behavior so that when clicking on the product's image on category page it goes showing me the thumbnail.
Here is the code that I have in  /components/com_virtuemart/views/category/tmpl/default.php

// Show Products ?>
<div class="product floatleft<?php echo $Browsecellwidth $show_vertical_separator ?>">
<div class="spacer">
<div class="width30 floatleft center">
<?php /** @todo make image popup */
echo $product->images[0]->displayMediaThumb('class="browseProductImage" border="0" title="'.$product->product_name.'" ',true,'class="modal"');
?>




Thank you very much for your kind help!


sadrem

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


to this

<a title="<?php echo $product->link ?>"  href="<?php echo $product->link?>">
<?php
echo $product->images[0]->displayMediaThumb('class="browseProductImage"'false);
?>

</a>
p.s. Do not forget to change message icon to Solved.

ilias81

Thank you very much for you kind help!!
It's working as expected :D
Kind regards,

preikarm

Hi, I'm very interested to solve the same problem. I'm a bit confused about all the replays here. Please can you give me a summery what file I have to change and what the change should be. Thank you so much

jenkinhill

Default action in the current version, VirtueMart 2.0.22e is for the images on the category display page to link direct to the product details and not popup an image. If you are using this version then that is what should happen unless you are using a Joomla template with out of date template override files.
Kelvyn
Lowestoft, Suffolk, UK

Retired from forum life November 2023

Please mention your VirtueMart, Joomla and PHP versions when asking a question in this forum

preikarm

Hi Kelvyn,

thank you for your reply.

How can I use the product_url in my shop. I like to link the image and product name to this product_url. Thanks for your help.

Maxim Pishnyak

Use forum search button for finding already posted solution for this.

And product url is for product itself.

You'll use external images as general images.
You can support Community by voting for Project on the JED
https://extensions.joomla.org/extension/virtuemart/#reviews
Join us at
https://twitter.com/virtuemart