Post by KapitanBomba » Tue Mar 20, 2012 10:41 pm

Hi :)

I would like to moddify product page in my template... I would like to display additional images with Sort Order more than 100 in other place. Can I somehow get Sort Order value inside the additional images loop? Maybe it is $image['something']?

Newbie

Posts

Joined
Tue Mar 20, 2012 10:36 pm

Post by KapitanBomba » Thu Mar 22, 2012 2:57 pm

Any ideas?

Newbie

Posts

Joined
Tue Mar 20, 2012 10:36 pm

Post by KapitanBomba » Sat Mar 24, 2012 9:26 pm

BUMP

Newbie

Posts

Joined
Tue Mar 20, 2012 10:36 pm

Post by KapitanBomba » Sun Mar 25, 2012 5:15 am

I've got no idea... I think it'll be very usable not only for me. Maybe should I try $this->something?

And how to get value of total additional images?

Newbie

Posts

Joined
Tue Mar 20, 2012 10:36 pm

Post by rph » Sun Mar 25, 2012 6:57 am

OpenCart 1.5.2.x has sort order for additional images.

-Ryan


rph
Expert Member

Posts

Joined
Fri Jan 08, 2010 5:05 am
Location - Lincoln, Nebraska

Post by nasya_ct » Thu May 03, 2012 12:03 pm

I finally manage to get the solution for this.

1. First rename all your image file to ascending order. eg:01.jpg, 02.jpg, 03.jpg....

2. Then log on to your admin page and upload all your additional images for the particular product.

3. Open /catalog/model/catalog/product.php and admin/model/catalog/produts.php

find and change

Code: Select all

public function getProductImages($product_id) {
		$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_image WHERE product_id = '" . (int)$product_id . "'");
		
		return $query->rows;
	}
to

Code: Select all

public function getProductImages($product_id) {
		$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_image WHERE product_id = '" . (int)$product_id . "'ORDER BY image");
		
		return $query->rows;
	}
4. make sure you change the code for both file.

5. save and refresh your product page.

Actually what i do is just sort the image file order by image. So, images that have been renamed, will be sort in ascending order. This works in opencart 1.5 version.

Newbie

Posts

Joined
Thu May 03, 2012 11:52 am

Post by custompilotshirts » Fri May 18, 2012 1:40 pm

This worked for me. 1.5.1. Thank you for posting this solution!

New member

Posts

Joined
Sat Sep 10, 2011 4:30 am

Post by kurugaddere » Tue Feb 16, 2021 2:55 pm

I want to do this for version 2.3.0.2 .. please answer. ^-^

Newbie

Posts

Joined
Mon Oct 01, 2018 6:08 am
Who is online

Users browsing this forum: No registered users and 30 guests