Fetch extra image
13 years 3 months ago #108807
by esotechie
Fetch extra image was created by esotechie
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?
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.
13 years 3 months ago #108833
by Eliot
Replied by Eliot on topic Fetch extra image
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:
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
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:
Code:
$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.
13 years 3 months ago #108881
by esotechie
Replied by esotechie on topic Fetch extra image
Thank you Eliot
That was very helpful.
That was very helpful.
Please Log in or Create an account to join the conversation.
Time to create page: 0.167 seconds