Fetch extra image

  • Posts: 180
  • Thank you received: 13
11 years 4 months ago #108807

I am looking to modify the listing_img_title file so that it also includes the second image for a product if there is one, so it can be used on a roll-over.

What is the simplest way of fetching the second image for a product if there is one?

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

  • Posts: 2334
  • Thank you received: 403
11 years 4 months ago #108833

Hi there,

To do so, you have to take a look at the view.html.php which is loading the information.
First you should edit these lines to make them load every images related to your product:

$queryImage = 'SELECT * FROM '.hikashop_table('file').' WHERE file_ref_id IN ('.implode(',',$ids).') AND file_type=\'product\' ORDER BY file_ref_id ASC, file_ordering ASC, file_id ASC';
			$database->setQuery($queryImage);
			$images = $database->loadObjectList();

			foreach($rows as $k=>$row){
				if(!empty($images)){
					foreach($images as $image){
						if($row->product_id==$image->file_ref_id){
							if(!isset($row->file_ref_id)){
								foreach(get_object_vars($image) as $key => $name){
									$rows[$k]->$key = $name;
								}
							}
							break;
						}
					}
				}
				if(!isset($rows[$k]->file_name)){
					$rows[$k]->file_name = $row->product_name;
				}
			}

then you will be able to modify the listing_img_title to display 2 images if it's possible.
Do not hesitate to ask if you have more questions ;)

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

  • Posts: 180
  • Thank you received: 13
11 years 4 months ago #108881

Thank you Eliot

That was very helpful.

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

Time to create page: 0.064 seconds
Powered by Kunena Forum