CMS MADE SIMPLE FORGE

Shop Made Simple

 

[#8536] Sort order for product images

avatar
Created By: Metamorphose (metamorphose)
Date Submitted: 2012-10-17 09:01

Assigned To: Duketown (duketown)
Resolution: None
State: Open
Summary:
Sort order for product images
Detailed Description:
When product images was added, deleted, others added etc, with the time, the
display order for product images was no longer in the order I want. It's
possible that the images shows in order image_id 1,2,6,3,8,7.

To control the order in which the images shows, I reupload the images in the
right order for the product an use following modifications in some files, but
it's nice if the order can be changed directly in the backend with a new
function.

---------------
Added order option to SQL query string in the files 
action.fe_product_detail.php, action.de_product_list.php,

Original-Query
$query = "SELECT * FROM ".cms_db_prefix()."module_sms_product_images WHERE
product_id = ?";

New Query

$query = "SELECT * FROM ".cms_db_prefix()."module_sms_product_images WHERE
product_id = ? ORDER BY product_images_id";

And in the products.api.php
from
$sql = "SELECT product_images_id, product_id, image, description
		        FROM ".cms_db_prefix()."module_sms_product_images
		        WHERE product_id=?";

to

$sql = "SELECT product_images_id, product_id, image, description
		        FROM ".cms_db_prefix()."module_sms_product_images
		        WHERE product_id=? ORDER BY product_images_id";

History