Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Orderable product options #114

Open
stargazer33 opened this issue Jun 3, 2013 · 9 comments
Open

Orderable product options #114

stargazer33 opened this issue Jun 3, 2013 · 9 comments

Comments

@stargazer33
Copy link

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

@stephenmcd
Copy link
Owner

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.

@stargazer33
Copy link
Author

"...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...

@stephenmcd
Copy link
Owner

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.

@stargazer33
Copy link
Author

"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?

@stephenmcd
Copy link
Owner

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.

@stargazer33
Copy link
Author

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?)

@stephenmcd
Copy link
Owner

Put one line of JavaScript into the product template.

@jbmckeon
Copy link
Contributor

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
}));

@githannes
Copy link

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants