Post by edialedarb » Fri Jul 04, 2014 10:38 am

I thought I would just share my mod to make this great free extension have the functionality of displaying the gallery name instead of the default for all galleries.

Firstly I am not a PHP programmer and this mod may not be the correct way to do it, but it is how I got it working in Open Cart 1.5.6 using V1.1 Gallery Images.

###### BEGIN EDITS ######

File: catalog\model\catalog\gallimage.php

Comment out or replace the original query with this one.

Code: Select all

$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "gallimage_image gi LEFT JOIN " . DB_PREFIX . "gallimage gin ON (gi.gallimage_id  = gin.gallimage_id) LEFT JOIN " . DB_PREFIX . "gallimage_image_description gid ON (gi.gallimage_image_id  = gid.gallimage_image_id) WHERE gi.gallimage_id = '" . (int)$gallimage_id . "' AND gin.gallimage_id = '" . (int)$gallimage_id . "' AND gid.language_id = '" . (int)$this->config->get('config_language_id') . "'");

File: catalog\controller\module\gallimage.php

Find the foreach loop (about line 20) and replace it with this one

Code: Select all

foreach ($results as $result) {
			if (file_exists(DIR_IMAGE . $result['image'])) {
				$this->data['gallimages'][] = array(
					'title' => $result['title'],
					'name' => $result['name'],
					'link'  => $result['link'],
					'image' => $this->model_tool_image->resize($result['image'], $setting['width'], $setting['height']),
					'popup' => $this->model_tool_image->resize($result['image'], 800, 800)
				);
			}
		}
File: catalog\view\theme\default\template\module\gallimage.tpl

Find the line of code near the top to display the title and replace it with this.

Code: Select all

<div class="box-heading"><?php echo $gallimages[0]['name']; ?></div>
###### END EDITS ######

Hope this helps and works for anyone who wants it.

Oh yeah, if you upgrade the module these edits will need to be made again.

If any php guru's know a better way of doing this, please share.

cheers

Newbie

Posts

Joined
Fri Jul 04, 2014 10:31 am

Post by santoshm » Wed Jul 16, 2014 4:25 am

If you don't have any image on the gallery, it gives following error. Isn't it supposed to display the gallery name and show blank instead of images?

Here is the error it throws:
Notice: Undefined offset: 0 in /home/mydomain/public_html/catalog/view/theme/mytheme/template/module/gallimage.tpl on line 2

How to avoid this error?

New member

Posts

Joined
Thu Sep 22, 2011 10:56 pm

Post by edialedarb » Sat Jul 26, 2014 7:54 pm

Hi,

This was just something I needed so I developed it for myself and it works fine for my client. I just thought I would share it with the community.

I'm not sure why you would have a gallery without an image in it?? That would be my suggestion. Put an image in the gallery or delete the gallery.

Cheers

Newbie

Posts

Joined
Fri Jul 04, 2014 10:31 am

Post by santoshm » Mon Jul 28, 2014 8:43 pm

edialedarb wrote:Hi,

This was just something I needed so I developed it for myself and it works fine for my client. I just thought I would share it with the community.

I'm not sure why you would have a gallery without an image in it?? That would be my suggestion. Put an image in the gallery or delete the gallery.

Cheers
I have a customer who has created the gallery but not inserted any images there. Probably saved for the future. Anyways, I will suggest him to put some pics or delete the gallery.

New member

Posts

Joined
Thu Sep 22, 2011 10:56 pm
Who is online

Users browsing this forum: No registered users and 5 guests