Post by JasonF » Sat Oct 01, 2011 1:13 am

Hi,

I own a few sites selling t-shirts, I'm currently developing a theme for a new site and then will most likely port my old sites over to OpenCart in the future, if everything goes to plan.

I am having trouble replicating one of the functions of my existing cart script, namely that the main product image that I'm using as a thumbnail in the category pages/latest products modules is also the main product image shown on the product info pages, which I do not want.

Is it possible to alter the product.tpl page so that the image grid only shows images provided in the: "Catalog > Products > Image" section, and not the one in the "Catalog > Products > Data" section?

I was able to achieve it my removing the

Code: Select all

<?php if ($thumb) { ?>
section of the code, but it did not give the desired effect, since there was no longer a large product image there.

In case what I'm wanting to achieve isn't clear, here's some pictures of what I want:

Image Image


And here's the current set up with OpenCart:

Image Image

I'm using OpenCart v1.5.1.2 if that matters. Thanks in advance for any help.

Jason
Last edited by JasonF on Thu Oct 06, 2011 2:23 am, edited 1 time in total.

New member

Posts

Joined
Sat Oct 01, 2011 12:46 am

Post by JasonF » Wed Oct 05, 2011 9:53 pm

Anyone got an ideas?

I would like to make sure the basics of what I'm looking for are doable before I spend too long working on the design or purchase any extensions.

Thanks,

Jason

New member

Posts

Joined
Sat Oct 01, 2011 12:46 am

Post by uksitebuilder » Wed Oct 05, 2011 10:55 pm

Took some thinking about but try the following:

edit: catalog/controller/product/product.php

find

Code: Select all

			$this->load->model('tool/image');

			if ($product_info['image']) {
				$this->data['popup'] = $this->model_tool_image->resize($product_info['image'], $this->config->get('config_image_popup_width'), $this->config->get('config_image_popup_height'));
			} else {
				$this->data['popup'] = '';
			}
			
			if ($product_info['image']) {
				$this->data['thumb'] = $this->model_tool_image->resize($product_info['image'], $this->config->get('config_image_thumb_width'), $this->config->get('config_image_thumb_height'));
			} else {
				$this->data['thumb'] = '';
			}
			
			$this->data['images'] = array();
			
			$results = $this->model_catalog_product->getProductImages($this->request->get['product_id']);
			
			foreach ($results as $result) {
				$this->data['images'][] = array(
					'popup' => $this->model_tool_image->resize($result['image'], $this->config->get('config_image_popup_width'), $this->config->get('config_image_popup_height')),
					'thumb' => $this->model_tool_image->resize($result['image'], $this->config->get('config_image_additional_width'), $this->config->get('config_image_additional_height'))
				);
			}	
change to

Code: Select all

			$this->load->model('tool/image');

			$results = $this->model_catalog_product->getProductImages($this->request->get['product_id']);

			if(count($results)==0){
				if ($product_info['image']) {
					$this->data['popup'] = $this->model_tool_image->resize($product_info['image'], $this->config->get('config_image_popup_width'), $this->config->get('config_image_popup_height'));
				} else {
					$this->data['popup'] = '';
				}
				
				if ($product_info['image']) {
					$this->data['thumb'] = $this->model_tool_image->resize($product_info['image'], $this->config->get('config_image_thumb_width'), $this->config->get('config_image_thumb_height'));
				} else {
					$this->data['thumb'] = '';
				}
			}else{
				
				$this->data['images'] = array();
				$im = 0;
				foreach ($results as $result) {
					$im++;
					if($im>1){
						$this->data['images'][] = array(
							'popup' => $this->model_tool_image->resize($result['image'], $this->config->get('config_image_popup_width'), $this->config->get('config_image_popup_height')),
							'thumb' => $this->model_tool_image->resize($result['image'], $this->config->get('config_image_additional_width'), $this->config->get('config_image_additional_height'))
						);
					}else{
						$this->data['popup'] = $this->model_tool_image->resize($result['image'], $this->config->get('config_image_popup_width'), $this->config->get('config_image_popup_height'));
						$this->data['thumb'] = $this->model_tool_image->resize($result['image'], $this->config->get('config_image_thumb_width'), $this->config->get('config_image_thumb_height'));
					}
				}	
				
			}

ImageImageImageImageImage

For Friendly Professional Support - Click Here


User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by JasonF » Wed Oct 05, 2011 11:09 pm

Thanks, that seems to have worked a treat :)

New member

Posts

Joined
Sat Oct 01, 2011 12:46 am

Post by uksitebuilder » Wed Oct 05, 2011 11:13 pm

Good good, I added a fallback just in case you don't add any additional images, it should show the main image.

One thing I omitted was to put the main image back in to the additional images.

Let me know if you want that adding so it appears as a thumbnail on the product page

ImageImageImageImageImage

For Friendly Professional Support - Click Here


User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by JasonF » Thu Oct 06, 2011 2:22 am

No, that's not necessary, thank you anyway.

Thanks again fro your help with this.

New member

Posts

Joined
Sat Oct 01, 2011 12:46 am

Post by okmarket » Sat Oct 15, 2011 10:39 pm

Hi Simon,

Regarding hide main product image on product info page, i had already change the code as per your instruction, however it's still show it, pls see att'd screenshot, and pls give me a hand for solve it.

thank you.

China Wholesaler
http://www.okmarket.com
Image

David Wei


User avatar
New member

Posts

Joined
Sat Jul 09, 2011 11:47 pm
Location - Guangzhou,China

Post by uksitebuilder » Sun Oct 16, 2011 12:35 am

No screenshot attached

What OC version are you using ?

ImageImageImageImageImage

For Friendly Professional Support - Click Here


User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by dealstation » Sun Oct 16, 2011 1:26 am

I've also changed fitted see no difference
i use opencart 1.5.1.1

see screenshot pls

i want have like this.

https://skydrive.live.com/?cid=3491c8a4 ... 96CD%21114

https://skydrive.live.com/?cid=3491c8a4 ... 96CD%21115

thnx

New member

Posts

Joined
Tue Aug 16, 2011 7:59 am

Post by okmarket » Tue Oct 18, 2011 5:06 pm

Hi Simon,

opencart v151

Sorry for late reply.

pls see att'd screenshot, and pls help it.

good day.

Attachments

vraag 3.jpg

hide - vraag 3.jpg (280.96 KiB) Viewed 7794 times


China Wholesaler
http://www.okmarket.com
Image

David Wei


User avatar
New member

Posts

Joined
Sat Jul 09, 2011 11:47 pm
Location - Guangzhou,China

Post by DKeff » Fri Dec 09, 2011 6:11 am

Thanks uksitebuilder,

This helped alot!

- Dave

Newbie

Posts

Joined
Thu Jul 28, 2011 2:06 am

Post by remcofaasse » Wed Dec 14, 2011 5:55 pm

Hi uksitebuilder,
I have replaced the code, but I receive the following error on the site:

Notice: Undefined variable: images
/shop/catalog/view/theme/default/template/product/product.tpl on line 15

Can you help me with this? Thanks.
Last edited by remcofaasse on Fri Dec 16, 2011 10:06 am, edited 1 time in total.

New member

Posts

Joined
Mon Dec 05, 2011 2:20 am

Post by uksitebuilder » Thu Dec 15, 2011 4:58 am

Hi guys, sorry for the delay

The code I put above should work fine with OC 1.5.1.1 and 1.5.1.2

If it's not working, not sure what to say other than restore the default file and retry the edit again.

It definitely works.

ImageImageImageImageImage

For Friendly Professional Support - Click Here


User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by remcofaasse » Fri Dec 16, 2011 6:53 am

hi uksitebuilder,
Is it possible that v 1.5.1.3 gives above mentioned problem?
Thanks again for reply.

New member

Posts

Joined
Mon Dec 05, 2011 2:20 am

Post by uksitebuilder » Fri Dec 16, 2011 5:57 pm

Just tested on 1.5.1.3 and it works

here is a vqmod if it helps

Attachments


ImageImageImageImageImage

For Friendly Professional Support - Click Here


User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by remcofaasse » Fri Dec 16, 2011 7:15 pm

uksitebuilder wrote:Just tested on 1.5.1.3 and it works

here is a vqmod if it helps

Thanks uksitebuilder. For installation: I just drop the file in the vqmod/xml folder?
Just to make sure. And do I need to make sure that the same image files are in folders: /image and /data?

New member

Posts

Joined
Mon Dec 05, 2011 2:20 am

Post by uksitebuilder » Fri Dec 16, 2011 7:23 pm

Hi,

Yes, drop it in the xml folder

It uses the main image from the product for the category picture

The main product page uses the images uploaded to the additional images tab in the edit product screen.

ImageImageImageImageImage

For Friendly Professional Support - Click Here


User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom

Post by remcofaasse » Fri Dec 16, 2011 8:41 pm

Thanks uksitebuilder!
It works fantastic!

New member

Posts

Joined
Mon Dec 05, 2011 2:20 am

Post by jcmathis » Thu Dec 22, 2011 3:24 pm

How does it choose the alternate image to be the new default image on the product page?
Alphabetically?

Newbie

Posts

Joined
Sat Dec 03, 2011 3:30 am

Post by uksitebuilder » Thu Dec 22, 2011 3:45 pm

It uses OC's own code, so the image that would normally be the first thumb image is promoted to the main product image.

ImageImageImageImageImage

For Friendly Professional Support - Click Here


User avatar
Guru Member

Posts

Joined
Thu Jun 09, 2011 11:37 pm
Location - United Kindgom
Who is online

Users browsing this forum: No registered users and 14 guests