Page 1 of 1

[SOLVED] How to include main product image in thumbnail list

Posted: Mon Oct 24, 2011 9:18 pm
by TheMasterBrewer
Does anybody know how to include the main/default product image in the set of thumbnails? I've tried playing around with the code for the main image in the foreach loop but it always displays it full size... help!

Re: How to include main product image in list of thumbnails?

Posted: Wed Oct 26, 2011 9:38 pm
by TheMasterBrewer
I've solved this issue. In the product controller (catalog/controller/product/product.php) I added the following code around line 207:

Code: Select all

if ($product_info['image']) {
	$this->data['mainthumb'] = $this->model_tool_image->resize($product_info['image'], $this->config->get('config_image_additional_width'), $this->config->get('config_image_additional_height'));
} else {
	$this->data['mainthumb'] = '';
}
This is pretty much a clone of the previous two if statements; the first of which creates the enlarged version of the main image ('popup'), the second of which creates the default version of the main image ('image'). This new code creates a third version of the image, the same size as the thumbnails, and calls it "mainthumb". Then I called the 'mainthumb' image (the same way the product template calls the default image) just before the foreach loop on the product page where it displays all the thumbnails. Hey presto!

Re: [SOLVED] How to include main product image in thumbnail

Posted: Wed Nov 30, 2011 11:39 pm
by Ampeter
Great! thanks. I made it into a vQmod here: http://forum.opencart.com/viewtopic.php?f=131&t=47303