link thumbnails to bigger picture instead of page

  • Posts: 22
  • Thank you received: 0
12 years 7 months ago #46848

I don't need a seperate product page for each item of the shop. Is it possible for me to link the thumbnails to an enlarged picture of the product shown in the thumbnail? Just like when you're on the product page and clicking on one of the pictures, you get to see an enlarged version.

Please Log in or Create an account to join the conversation.

  • Posts: 82868
  • Thank you received: 13377
  • MODERATOR
12 years 7 months ago #46940

You can do that by editing the file "listing_img_title" of the view "product" via the menu Display->Views and changing the code

<?php if($this->params->get('link_to_product_page',1)){ ?>
		<a href="<?php echo $link;?>" title="<?php echo $this->escape($this->row->product_name); ?>">
	<?php }
		echo $this->image->display(@$this->row->file_path,false,$this->escape($this->row->file_name), '' , '' , $this->image->main_thumbnail_x,  $this->image->main_thumbnail_y);
	if($this->params->get('link_to_product_page',1)){ ?>
		</a>
	<?php } ?>
by
echo $this->image->display(@$this->row->file_path,true,$this->escape($this->row->file_name), '' , '' , $this->image->main_thumbnail_x,  $this->image->main_thumbnail_y);

The following user(s) said Thank You: pina

Please Log in or Create an account to join the conversation.

  • Posts: 22
  • Thank you received: 0
12 years 7 months ago #47059

Hi Nicolas

thank you for your response!

nicolas wrote: You can do that by editing the file "listing_img_title" of the view "product" via the menu Display->Views and changing the code

<?php if($this->params->get('link_to_product_page',1)){ ?>
		<a href="<?php echo $link;?>" title="<?php echo $this->escape($this->row->product_name); ?>">
	<?php }
		echo $this->image->display(@$this->row->file_path,false,$this->escape($this->row->file_name), '' , '' , $this->image->main_thumbnail_x,  $this->image->main_thumbnail_y);
	if($this->params->get('link_to_product_page',1)){ ?>
		</a>
	<?php } ?>
by
echo $this->image->display(@$this->row->file_path,true,$this->escape($this->row->file_name), '' , '' , $this->image->main_thumbnail_x,  $this->image->main_thumbnail_y);

Last edit: 12 years 7 months ago by pina.

Please Log in or Create an account to join the conversation.

  • Posts: 14
  • Thank you received: 2
11 years 8 months ago #96337

Hi,

Does this solution work with the current version of hikashop starter?

I also wanted to open enlarged images from the product listing intead of having to go to product page and tried this replacement but this does not work on hikashop starter 2.1.1

Any ideas please?

Thank you

Please Log in or Create an account to join the conversation.

  • Posts: 14
  • Thank you received: 2
11 years 8 months ago #96340

Small update for those who have similar problems..

I have found out why this would not work;

This did not work because I was editing the image_title.php file but I was using image and description view from the menu module. So editing the relevant listing_img_desc.php file did solve the problem.

However I must also point that the replcament code snippet quoted as a solution is not good enoug for a novice guy without coding expreience. The complete code replacement should have php tags at the beginning and at the end. So, the code for replavement I have use is as below;

<?php echo $this->image->display(@$this->row->file_path,true,$this->escape($this->row->file_name), '' , '' , $this->image->main_thumbnail_x,  $this->image->main_thumbnail_y); ?>

The following user(s) said Thank You: Mohamed Thelji

Please Log in or Create an account to join the conversation.

  • Posts: 12953
  • Thank you received: 1778
11 years 8 months ago #96379

Thanks for your feedback :).

Please Log in or Create an account to join the conversation.

  • Posts: 177
  • Thank you received: 5
11 years 7 months ago #101257

Just replace

file_path,false,$this
with
file_path,true,$this
.

Please Log in or Create an account to join the conversation.

  • Posts: 260
  • Thank you received: 25
10 years 5 months ago #159344

Hi, I am trying to do this but a bit confused - I think the original file has changed considerably since being written

The code as mentioned here

<?php if($this->params->get('link_to_product_page',1)){ ?>
		<a href="<?php echo $link;?>" title="<?php echo $this->escape($this->row->product_name); ?>">
	<?php }
		echo $this->image->display(@$this->row->file_path,false,$this->escape($this->row->file_name), '' , '' , $this->image->main_thumbnail_x,  $this->image->main_thumbnail_y);
	if($this->params->get('link_to_product_page',1)){ ?>
		</a>
	<?php } ?>

Seems to now be (if I understand it correctly) to this:
<?php if($this->params->get('link_to_product_page',1)){ ?>
			<a href="<?php echo $link;?>" title="<?php echo $this->escape($this->row->product_name); ?>">
		<?php }
			$image_options = array('default' => true,'forcesize'=>$this->config->get('image_force_size',true),'scale'=>$this->config->get('image_scale_mode','inside'));
			$img = $this->image->getThumbnail(@$this->row->file_path, array('width' => $this->image->main_thumbnail_x, 'height' => $this->image->main_thumbnail_y), $image_options);
			if($img->success) {
				echo '<img class="hikashop_product_listing_image" title="'.$this->escape(@$this->row->file_description).'" alt="'.$this->escape(@$this->row->file_name).'" src="'.$img->url.'"/>';
			}
			$main_thumb_x = $this->image->main_thumbnail_x;
			$main_thumb_y = $this->image->main_thumbnail_y;
			if($this->params->get('display_badges',1)){
				$this->classbadge->placeBadges($this->image, $this->row->badges, -10, 0);
			}
			$this->image->main_thumbnail_x = $main_thumb_x;
			$this->image->main_thumbnail_y = $main_thumb_y;

		if($this->params->get('link_to_product_page',1)){ ?>
			</a>
		<?php } ?>

So what needs to be changed to enable image popup from product listing?

Thanks in advance for any help.
Simon


Don't look at what is and ask 'why?'; look at what isn't and ask 'Why Not!'

Please Log in or Create an account to join the conversation.

  • Posts: 2334
  • Thank you received: 403
10 years 5 months ago #159486

Hi Simon,

It's actually easier.
You should just replace the first code you post with this line:

<?php echo $this->image->display(@$this->row->file_path,true,$this->escape($this->row->file_name), '' , '' , $this->image->main_thumbnail_x,  $this->image->main_thumbnail_y); ?>

And it'll do the job!

Please Log in or Create an account to join the conversation.

  • Posts: 260
  • Thank you received: 25
10 years 5 months ago #160464

Hi Eliot,

Thanks for your reply.

That first set of code I posted does not exist in my file (that is from the original post a couple of years ago)

The second piece of code is what is actually in the latest version of the mentioned file.

Make sense?


Don't look at what is and ask 'why?'; look at what isn't and ask 'Why Not!'

Please Log in or Create an account to join the conversation.

  • Posts: 13201
  • Thank you received: 2322
10 years 5 months ago #160542

Hi,

So in the view "product / listing_img_title" you have to replace the code:

			$image_options = array('default' => true,'forcesize'=>$this->config->get('image_force_size',true),'scale'=>$this->config->get('image_scale_mode','inside'));
			$img = $this->image->getThumbnail(@$this->row->file_path, array('width' => $this->image->main_thumbnail_x, 'height' => $this->image->main_thumbnail_y), $image_options);
			if($img->success) {
				echo '<img class="hikashop_product_listing_image" title="'.$this->escape(@$this->row->file_description).'" alt="'.$this->escape(@$this->row->file_name).'" src="'.$img->url.'"/>';
			}
By:
echo $this->image->display(@$this->row->file_path,true,$this->escape($this->row->file_name), '' , '' , $this->image->main_thumbnail_x,  $this->image->main_thumbnail_y);

Thanks to check that you are editing the correct view. If you had already the second part of code that's because you probably already have an override.

It just tested the code on my end and it's working fine.

Last edit: 10 years 5 months ago by Xavier.
The following user(s) said Thank You: sambob

Please Log in or Create an account to join the conversation.

  • Posts: 260
  • Thank you received: 25
10 years 5 months ago #160649

Hi Xavier,

That works now.

Thanks, appreciate it!


Don't look at what is and ask 'why?'; look at what isn't and ask 'Why Not!'

Please Log in or Create an account to join the conversation.

  • Posts: 177
  • Thank you received: 5
8 years 6 months ago #240984

What should I change in 2.6.3 version? There is no Dispaly word at all.

Updated: see answer in previous post :blush:

Last edit: 8 years 6 months ago by alikon1.

Please Log in or Create an account to join the conversation.

Time to create page: 0.131 seconds
Powered by Kunena Forum