Jump to content

Option attributes badly sorted after adding more options


Julien

Recommended Posts

Hi,

I have a product an option group "Keys" with over 100 options attributes (individual keyboard keys).
The products are keyboard, with their different layouts are defined as option sets.

My options attributes that I set initially came from a QWERTY layout, and I sorted the keys carefully by groups "A B C D (...)   F1 F2 F3  F4 (...) 1 2 3 4 (...) and special keys.

Because of additional keyboard layouts, I had to add many new attributes afterwards (special chars like "é à ü" for instance).

Instead of adding those attributes at the end of the list, when saving the attributes list, CubeCart's manager insert them at arbitrary locations in the list.
This makes things difficult because to make my options set well-organized, I have to drag and drop a lot the new attributes through the very long list.
Although not a real bug, this is very boring and perfectible. I have no GitHub account and this is why I post here.

Cheers,

Julien

Link to comment
Share on other sites

The site is still in development.

But I could find where the problem comes from.

Problem / Bug
When you add one (or more) new option attributes to an existing option group and click the "Save" button, the new options are saved in table CubeCart_option_value.
The last column in this table is "priority", which store the priority indexes in which the option attributes are displayed in the backend (and maybe also in the frontend).
If you add a new option attribute, it receive priority index "1".
Instead, it should receive priority index MAX(priority)+1.

Example
Create option values "A", "B", "C", "D" for an option group and save.
Add option attribute "E" to the same option group and save.
E will receive priority "1".

(Partial ?) solution  (not tested yet but should work)
by Editing the MySQL CubeCart_option_value table:

  1. Make sure that the priority column of your "_option_value" tables are unique
  2. Using phpMyAdmin, click the "Structure" tab for the "_option_value" table
  3. Assign the "priority" column a "Unique" and make it "AUTO_INCREMENT" (check A_I in phpMyAdmin)

Note
Maybe does Al Brookbanks knows if some code also has to be edited. I assume so.
With my solution, the values for the priority field should not be saved and this task delegated to the database.
But the "Option Attributes" tab also allows sorting fields by drag & drop and the new order has then to be saved in the priority field.
The current code (version 6.2.5) sets new priorities for all options.
Although  I didn't dig into the code, I assume there is some paradox here.
The problem when adding new fields is especially accutes if the existing number of option attributes is important.
(There are more than 100 option attributes in my case.)
Can someone report this bug in GitHub?

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...