Post by cpsarros » Sat Feb 12, 2011 8:46 am

I am adding images to my site and I want them to appear in a particular order but when I hit save they are all over the place. Sometimes it works ok. I am not sure how they are arranging themselves but they are not in numerical or alphabetical order. It's pissing me off. Anyone seen this before.

New member

Posts

Joined
Fri May 14, 2010 3:55 pm

Post by rph » Sun Feb 13, 2011 7:50 am

Are you're talking about product additional images? You'll need to change:

catalog/model/catalog/product.php
public function getProductImages

Code: Select all

$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_image WHERE product_id = '" . (int)$product_id . "'");
to

Code: Select all

$query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_image WHERE product_id = '" . (int)$product_id . "' ORDER BY image ASC");
and they'll sort by image name.

-Ryan


rph
Expert Member

Posts

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

Post by cpsarros » Sun Feb 13, 2011 10:07 am

thanks for that, much appreciated.

New member

Posts

Joined
Fri May 14, 2010 3:55 pm

Post by ann0314 » Mon Jun 20, 2011 1:46 pm

Ditto on the thanx! :) Was looking for the same info :)

User avatar
New member

Posts

Joined
Tue Jun 14, 2011 10:31 pm

Post by onlinemarketer » Wed Sep 14, 2011 3:42 am

Thats great, this would also be brilliant if it was in the core :)

Active Member

Posts

Joined
Sat May 14, 2011 8:21 pm

Post by BOBKIM7080 » Wed Jan 25, 2012 5:07 pm

Thank you
I needed it too :) :) :)

User avatar
New member

Posts

Joined
Fri Aug 26, 2011 12:53 am


Post by EveMar » Thu Jul 26, 2012 8:58 am

Thank you!!! I was looking for a way to solve that and your solution worked beautifully!!! ;D

Newbie

Posts

Joined
Thu Jul 26, 2012 8:57 am

Post by Owen Smith » Mon Oct 29, 2012 12:31 am

I tried this and i want it sorted by number, like #1 , #2, #3 etc right now i have a1, a2, a3 etc but it runs like a1, a2, a4, a3? which dont make sense.

New member

Posts

Joined
Mon Jul 16, 2012 9:56 pm

Post by rph » Mon Oct 29, 2012 6:27 am

This thread is out-of-date. The current version of OpenCart has sort order for additional images.

-Ryan


rph
Expert Member

Posts

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

Users browsing this forum: Amazon [Bot] and 29 guests