Author Topic: Influence the order of article options  (Read 1033 times)

Offline Erwinvb

  • Posts: 11
  • Gender: Male
Influence the order of article options
« on: September 19, 2015, 10:59:22 PM »
Is there a way to influence the order in which the article options are shown in the select on the pages.
I can't seem to understand in which way they are sorted.

Thanks in advance

freeSbee

  • Guest
Re: Influence the order of article options
« Reply #1 on: September 20, 2015, 10:08:52 AM »
Hi Erwinvb

Bakery does not support ordering of option attributes by default.
But try this workarround:


WARNING:
1. This will only work properly before assigning any product attributes. For instance if you have already assigned attribute pricing it will be messed after reordering the attribute names.
2. These modifications will affect all Bakery option attributes, not only the ones given in the example below. All option attributes will be ordered the same like the attribute_id.



1.
First go to the mod_bakery_attribut es table in your database and reorder the attribute_name field in your own way.

For example:

attribute_id        option_id         attribute_name

     6                      2                        XXL
     7                      2                        L
     8                      2                        S
     9                      2                        XL
   10                      2                        M


Change db table to, eg.:

attribute_id        option_id         attribute_name

     6                      2                        S
     7                      2                        M
     8                      2                        L
     9                      2                        XL
   10                      2                        XXL


2.
Open the files view_overview.php and view_item.php. If you need the same ordering in the backend too, open modify_item.php and modify_options.php as well. Replace the code snippets (all in all 5 times)
Code: [Select]
ORDER BY o.option_name, LENGTH(a.attribute_name), a.attribute_name ASC
by
Code: [Select]
ORDER BY a.attribute_id ASC

Regards Christoph