cartridge icon indicating copy to clipboard operation
cartridge copied to clipboard

Orderable product options

Open stargazer33 opened this issue 12 years ago • 9 comments
trafficstars

The dropdown list with product variations on the product page is unsorted. I have product variations which are numbers, so it is not a localization or NLS issue (the site is in russian) Attached a picture of dropdown list and a picture from admin showing product options (properly sorted when I click on "name" column header)

screenshot from 2013-06-03 15 41 13_v1

screenshot from 2013-06-03 15 39 16

stargazer33 avatar Jun 03 '13 12:06 stargazer33

We basically need a way to sort the options in the admin. Don't think it will be too hard to implement, I'm just unsure of the best interface for doing it.

stephenmcd avatar Jun 04 '13 05:06 stephenmcd

"...to sort the options in the admin"???

From my point of view it is important to get them sorted in the dropdown lists on the product page. In the admin - somewhere in the admin there should be a way to specify "how to sort the dropdown list". I can imagine following variants: -sort by name ascending -sort by name descending -add a new, hidden field, sort_order, and then choose in admin "sort by sort_order, ascending"

I think, the first two variants can be implemented without big efforts...

stargazer33 avatar Jun 04 '13 08:06 stargazer33

An admin user should be able to control the order of the options by going into the admin and sorting them in a drag/drop interface.

With that in place, all the other approaches are redundant. As simple as they may be, they'd only be short-term so there's no point in adding them.

stephenmcd avatar Jun 04 '13 08:06 stephenmcd

"An admin user should be able to control the order of the options by going into the admin and sorting them in a drag/drop interface." - ok, and the implementation of it could be, for example, a hidden field "sort_order" Alternatively... do you mean the same sort mechanism as for "normal" pages?

stargazer33 avatar Jun 04 '13 09:06 stargazer33

Yes there'd be a hidden sort field. The way pages work isn't alternative, it's the same thing - hidden sort field with drag/drop ordering in the admin.

stephenmcd avatar Jun 04 '13 09:06 stephenmcd

Anyway, for my purposes a plain vanilla "sort by name" will be enough - is it possible to add it quickly? If not - what is the best place/best way to have "sort by name" in my project? (a dirty, or not so dirty hack?)

stargazer33 avatar Jun 04 '13 09:06 stargazer33

Put one line of JavaScript into the product template.

stephenmcd avatar Jun 04 '13 09:06 stephenmcd

Jquery to sort the first option. You can modify this to use wildcards if needed http://api.jquery.com/attribute-starts-with-selector/

$("#id_option1").html($("#id_option1 option").sort(function (a, b) {
    return a.text == b.text ? 0 : a.text < b.text ? -1 : 1
}));

jbmckeon avatar Sep 24 '13 22:09 jbmckeon

manually sorting products in the admin backend would be really, really, really nice. could work the same way as with pages. if theres is paging on the products site one drop area at the top and one at the bottom to drag and drop the item to the next page, could work.

githannes avatar Jun 13 '14 11:06 githannes