Post by booyakan » Mon Jun 21, 2010 2:06 am

How can I display product option values alphabetically without using the sort oder? I'd like to just call from the database but I cannot find the code.

New member

Posts

Joined
Wed Jan 06, 2010 4:07 pm

Post by Xsecrets » Mon Jun 21, 2010 2:53 am

have you tried just setting all the sort orders to the same value like 0?

OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter


Guru Member

Posts

Joined
Sun Oct 25, 2009 3:51 am
Location - FL US

Post by booyakan » Mon Jun 21, 2010 2:59 am

yes but they are ordered by the way i input them. this is a problem because if i have 25 options and then want to add a few new ones later i would have to redo all of the sort numbers.

i think i found the code to change this in controller/model/controller/product.php

$product_option_value_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_option_value WHERE product_option_id = '" . (int)$product_option['product_option_id'] . "' ORDER BY sort_order");


if this is the correct code, do you know what i would change it to?

New member

Posts

Joined
Wed Jan 06, 2010 4:07 pm

Post by Xsecrets » Mon Jun 21, 2010 3:21 am

that query won't cut it because that table doesn't have the names in it. the names are in product_option_value_description table which that query doesn't reference.

OpenCart commercial mods and development http://spotonsolutions.net
Layered Navigation
Shipment Tracking
Vehicle Year/Make/Model Filter


Guru Member

Posts

Joined
Sun Oct 25, 2009 3:51 am
Location - FL US

Post by booyakan » Mon Jun 21, 2010 3:26 am

yea i just noticed that. if u have any other ideas i would really appreciate it. i am only trying to sort them alphabetically for one product_id.

New member

Posts

Joined
Wed Jan 06, 2010 4:07 pm

Post by Radium » Thu Jun 24, 2010 2:42 am

I am also having this issue. Shouldn't product options be sorted alphanumerically by name by default?

Newbie

Posts

Joined
Thu Jun 24, 2010 2:38 am

Post by Radium » Thu Jul 01, 2010 4:18 am

Probably not a recommended solution, but I got the product options to sort by name (value description) in OpenCart 1.4.8b by doing this modification...

I modified the file catalog/model/catalog/product.php

Replace:

Code: Select all

$product_option_value_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_option_value WHERE product_option_id = '" . (int)$product_option['product_option_id'] . "' ORDER BY sort_order");
 
With:

Code: Select all

// $product_option_value_query = $this->db->query("SELECT * FROM " . DB_PREFIX . "product_option_value WHERE product_option_id = '" . (int)$product_option['product_option_id'] . "' ORDER BY sort_order");
            
$product_option_value_query = $this->db->query("SELECT
" . DB_PREFIX . "product_option_value.product_option_value_id,
" . DB_PREFIX . "product_option_value_description.name,
" . DB_PREFIX . "product_option_value.price,
" . DB_PREFIX . "product_option_value.prefix
FROM " . DB_PREFIX . "product_option_value 
LEFT JOIN " . DB_PREFIX . "product_option_value_description 
ON " . DB_PREFIX . "product_option_value.product_option_value_id = " . DB_PREFIX . "product_option_value_description.product_option_value_id
WHERE " . DB_PREFIX . "product_option_value.product_option_id = " . (int)$product_option['product_option_id'] . "
ORDER BY sort_order, name");
 

Newbie

Posts

Joined
Thu Jun 24, 2010 2:38 am

Post by amelie » Tue Jul 19, 2011 12:04 am

I attempted the code by Radium for 1.4.9.4, but it didn't work as expected

It pulled up this error:

Code: Select all

Notice: Undefined index: extra in /home/decalb5/public_html/store/catalog/model/catalog/product.php on line 454
Line 454:

Code: Select all

'extras'                  => unserialize($product_option_value['extra']),
Full block where line 454 is located:

Code: Select all

$product_option_value_data[] = array(
					'product_option_value_id' => $product_option_value['product_option_value_id'],
					'name'                    => $product_option_value_description_query->row['name'],
         			'price'                   => $product_option_value['price'],
         			'prefix'                  => $product_option_value['prefix'],
                    'extras'                  => unserialize($product_option_value['extra']),
                    'extra'                   => unserialize($product_option['extra'])
				);
Any suggestions?

Active Member

Posts

Joined
Sat Feb 05, 2011 4:15 am

Post by djoliverm » Sat Jun 16, 2012 1:24 pm

Sorry to bump the thread, but has anyone figured this out? I too have run into this problem, where the instructions say that leaving the sort order at 0 should automatically sort alphabetically but the drop down menu to select an option is a whole mess.

Newbie

Posts

Joined
Sat Apr 21, 2012 10:51 am

Post by Sokonomi » Tue Nov 06, 2012 1:08 am

Im gonna give this one another bump, we need a fix!

Active Member

Posts

Joined
Sun Sep 30, 2012 4:52 am

Post by bigal » Mon Jan 07, 2013 9:38 am

I am using v1.5.4.1. You can change sort in the admin control panel.

Go to control panel - Catalog -> Options -> Edit your options -> and change the sort number numbers.

Best Regards/Allen Chen


Active Member

Posts

Joined
Wed Sep 21, 2011 9:02 am

Post by Sokonomi » Mon Jan 07, 2013 5:14 pm

Thats the problem, were looking for a solution.

Active Member

Posts

Joined
Sun Sep 30, 2012 4:52 am

Post by mmazurek » Sun May 05, 2013 5:27 pm

Hi,

I've got the same problem, but for now, there's an free extension for this: http://www.opencart.com/index.php?route ... on_id=7522

Maybe this would help someone.

Newbie

Posts

Joined
Thu Jun 14, 2012 12:31 am

Post by Sokonomi » Sun May 05, 2013 5:48 pm

Thats what ive been using, it works, but only on the front end.
The back end is still in complete shambles.

Active Member

Posts

Joined
Sun Sep 30, 2012 4:52 am

Post by mmazurek » Sun May 05, 2013 9:10 pm

Yes! True. It can be a pain ;) But maybe someone will post a solution for this in this thread.


Edit:

I've found something here: http://forum.opencart.com/viewtopic.php?f=20&t=43356

Newbie

Posts

Joined
Thu Jun 14, 2012 12:31 am

Post by justcurious » Sun May 05, 2013 11:46 pm

You could try this

http://www.opencart.com/index.php?route ... n_id=10341

It works for both admin and store

Google Product Feed - Get your products into Google Shopping. Includes a bulk update facility.
Backup Pro - Backup (on demand or scheduled), Restore and Clone your store.
Freestyle Box - Add multiple information boxes on multiple pages of your store. Includes optional "Code Mode".
View my other extensions


User avatar
Active Member

Posts

Joined
Sat Dec 24, 2011 4:36 pm
Location - UK

Post by mmazurek » Mon May 06, 2013 1:55 am

Oh... Thanks a lot!!!! :))))) It works for me.

Newbie

Posts

Joined
Thu Jun 14, 2012 12:31 am

Post by Sokonomi » Mon May 06, 2013 2:09 am

It works on the back end too? :clown:

Active Member

Posts

Joined
Sun Sep 30, 2012 4:52 am
Who is online

Users browsing this forum: Google [Bot] and 109 guests