Post by bobbart » Sun Nov 17, 2019 5:56 am

I have been looking for a way to force my options to list Alphabetically. Can someone help me? I really dont want to spend more money so I hope there is a free method

New member

Posts

Joined
Fri Nov 01, 2019 11:29 pm

Post by opencartmart » Sun Nov 17, 2019 4:15 pm

at which end, admin or front?

XForm - Opencart Form Builder
Xshippingpro - An advanced Shipping Module
Need Professional support? Skype: opencartmart


Active Member

Posts

Joined
Wed Oct 02, 2013 3:59 am

Post by paulfeakins » Mon Nov 18, 2019 11:19 pm

bobbart wrote:
Sun Nov 17, 2019 5:56 am
I have been looking for a way to force my options to list Alphabetically. Can someone help me? I really dont want to spend more money so I hope there is a free method
Find the controller for that part in the admin and add a sort order at the part where it gets the options.

For quick, professional OpenCart support please email info@antropy.co.uk


User avatar
Expert Member

Posts

Joined
Mon Aug 22, 2011 11:01 pm
Location - Reigate, Surrey, United Kingdom

Post by bobbart » Tue Nov 19, 2019 6:23 am

I am unsure how to do that. Any guidance would be great appreciated.

New member

Posts

Joined
Fri Nov 01, 2019 11:29 pm

Post by bobbart » Tue Nov 19, 2019 6:25 am

opencartmart wrote:
Sun Nov 17, 2019 4:15 pm
at which end, admin or front?
I guess for both but at least for the customer view to help them located the scent they are looking for.

New member

Posts

Joined
Fri Nov 01, 2019 11:29 pm

Post by letxobnav » Tue Nov 19, 2019 12:45 pm

in catalog/model/catalog/product.php

for the option values:
find

Code: Select all

SELECT * FROM " . DB_PREFIX . "product_option_value pov LEFT JOIN " . DB_PREFIX . "option_value ov ON (pov.option_value_id = ov.option_value_id) LEFT JOIN " . DB_PREFIX . "option_value_description ovd ON (ov.option_value_id = ovd.option_value_id) WHERE pov.product_id = '" . (int)$product_id . "' AND pov.product_option_id = '" . (int)$product_option['product_option_id'] . "' AND ovd.language_id = '" . (int)$this->config->get('config_language_id') . "' ORDER BY ov.sort_order"
change to

Code: Select all

SELECT * FROM " . DB_PREFIX . "product_option_value pov LEFT JOIN " . DB_PREFIX . "option_value ov ON (pov.option_value_id = ov.option_value_id) LEFT JOIN " . DB_PREFIX . "option_value_description ovd ON (ov.option_value_id = ovd.option_value_id) WHERE pov.product_id = '" . (int)$product_id . "' AND pov.product_option_id = '" . (int)$product_option['product_option_id'] . "' AND ovd.language_id = '" . (int)$this->config->get('config_language_id') . "' ORDER BY ov.sort_order, ovd.name"
if you leave the individual sort order fields equal it should now sort on the option name ascending.
I.e. it sorts on the manual sort order first, then name.

for the options themselves:
find:

Code: Select all

"SELECT * FROM " . DB_PREFIX . "product_option po LEFT JOIN `" . DB_PREFIX . "option` o ON (po.option_id = o.option_id) LEFT JOIN " . DB_PREFIX . "option_description od ON (o.option_id = od.option_id) WHERE po.product_id = '" . (int)$product_id . "' AND od.language_id = '" . (int)$this->config->get('config_language_id') . "' ORDER BY o.sort_order"
change to:

Code: Select all

"SELECT * FROM " . DB_PREFIX . "product_option po LEFT JOIN `" . DB_PREFIX . "option` o ON (po.option_id = o.option_id) LEFT JOIN " . DB_PREFIX . "option_description od ON (o.option_id = od.option_id) WHERE po.product_id = '" . (int)$product_id . "' AND od.language_id = '" . (int)$this->config->get('config_language_id') . "' ORDER BY o.sort_order, od.name"
if you leave the individual sort order fields equal it should now sort on the option name ascending.
I.e. it sorts on the manual sort order first, then name.

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Active Member
Online

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by bobbart » Wed Nov 20, 2019 3:12 am

Thank you for the reply and suggestion. However I made the changes and refreshed as well as a ctl-F5 and its not changing the order. I have made all the option value sort orders 0.
Any other ideas or did I do something wrong?

New member

Posts

Joined
Fri Nov 01, 2019 11:29 pm

Post by letxobnav » Wed Nov 20, 2019 4:21 am

any extensions running perhaps?

Crystal Light Centrum Taiwan
Extensions: MailQueue | SUKHR | VBoces

“Data security is paramount at [...], and we are committed to protecting the privacy of anyone who is associated with our [...]. We’ve made a lot of improvements and will continue to make them.”
When you know your life savings are gone.


User avatar
Active Member
Online

Posts

Joined
Fri Aug 18, 2017 4:35 pm
Location - Taiwan

Post by bobbart » Wed Nov 20, 2019 5:18 am

Sorry for my error in doing the following
1. Modifications cache clear
This caused it to start to work however it shown another issue I have.
2. I had to fix a few issues I had with option values not being added properly via a modifications extension MASS products update

After making your file modifications and the other listed changes its now working as it should. I can not thank you enough for your help.
Sincerely, THANK YOU

New member

Posts

Joined
Fri Nov 01, 2019 11:29 pm
Who is online

Users browsing this forum: No registered users and 26 guests