Post by teratyke » Thu Oct 13, 2011 9:34 pm

Hi
I have quite a lot of option values under one of my options, maybe 50 or so.
In the admin these seem to display in no particular order (possibly the order they were entered in). I would like to sort these in the admin by using the sort order value for each option value. The front end does sort like this. I've been through the sql code in the model admin/model/catalog/option.php but it looks like it looks like its working in the way I want - I could be looking at the wrong code of course.

Code: Select all

	public function getOptionValues($option_id) {
		$option_value_data = array();
		
		$option_value_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "option_value ov LEFT JOIN " . DB_PREFIX . "option_value_description ovd ON (ov.option_value_id = ovd.option_value_id) WHERE ov.option_id = '" . (int)$option_id . "' AND ovd.language_id = '" . (int)$this->config->get('config_language_id') . "' ORDER BY ov.sort_order ASC");
Help appreciated.
Rob

screenshot attached - I should add that further downthe list are option values with a sort order of 42,43 etc
Capture.JPG

Capture.JPG (64 KiB) Viewed 6123 times


Active Member

Posts

Joined
Sun Jun 12, 2011 3:05 pm

Post by partizzzzzan » Thu Dec 15, 2011 1:05 am

admin/model/catalog/option.php
Find

Code: Select all

$option_value_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "option_value WHERE option_id = '" . (int)$option_id . "'");
replace

Code: Select all

$option_value_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "option_value WHERE option_id = '" . (int)$option_id . "'" . "ORDER BY sort_order ASC");

Newbie

Posts

Joined
Wed Aug 24, 2011 12:46 am

Post by teratyke » Thu Dec 15, 2011 4:53 am

Thank you so much for your help. I'll try that change tomorrow.

Many thanks.
Rob

Active Member

Posts

Joined
Sun Jun 12, 2011 3:05 pm

Post by teratyke » Fri Dec 16, 2011 8:20 pm

Great thanks for your help. Works a treat.

If anyone else wants this here is a vqmod..


Rob

Attachments

change admin options sort order


Active Member

Posts

Joined
Sun Jun 12, 2011 3:05 pm

Post by oneglory » Tue May 01, 2012 10:05 pm

You can also have it sort within the drop down when you're actually trying to add the option to a product.

in 1.5.2.x

in product.php find:

Code: Select all

$query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "product_option WHERE option_id = '" . (int)$option_id . "'");
replace it with:

Code: Select all

$query = $this->db->query("SELECT COUNT(*) AS total FROM " . DB_PREFIX . "product_option WHERE option_id = '" . (int)$option_id . "'" . "ORDER BY sort_order ASC");

Newbie

Posts

Joined
Tue May 01, 2012 10:03 pm

Post by theking1010 » Sat May 19, 2012 4:00 am

Hi oneglory,

I have OC version 1.5.2.1 and I replaced the code in the product.php in the admin folder as you instructed, however I don't see an option to sort the form. Please view screenshot.

Thanks!

Attachments

options.JPG

options.JPG (24.74 KiB) Viewed 5914 times


Newbie

Posts

Joined
Tue Nov 15, 2011 11:12 pm

Post by otd » Thu Aug 02, 2012 11:50 pm

did anyone get this working on teh option tab on teh product pahe for 1.5.1.3??

otd
New member

Posts

Joined
Thu Sep 29, 2011 4:42 pm

Post by eselpee » Fri Sep 21, 2012 5:06 pm

Did anyone got this working for 1.5.1.3 yet?

OC 1.5.1.3
Vqmod 2.1.5


New member

Posts

Joined
Mon Oct 03, 2011 5:37 am

Post by eselpee » Fri Sep 21, 2012 9:13 pm

partizzzzzan wrote:admin/model/catalog/option.php
Find

Code: Select all

$option_value_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "option_value WHERE option_id = '" . (int)$option_id . "'");
replace

Code: Select all

$option_value_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "option_value WHERE option_id = '" . (int)$option_id . "'" . "ORDER BY sort_order ASC");
If I am correct this sort the option on id number?
I am looking for the code that sorts it on the description.

Is that possible?

OC 1.5.1.3
Vqmod 2.1.5


New member

Posts

Joined
Mon Oct 03, 2011 5:37 am
Who is online

Users browsing this forum: No registered users and 106 guests