How to sort product list on SKU content?
Despite reading many articles of other kickstart users who try to sort on the SKU without success, like them I cannot find any solution for the following:
I use something like AB1234-knife and AB1234-spoon as the SKU
If I search in AB1234 I get both correct presented in the product list results which is intended. Both items were added at a random point in time, so, in the unfiltered product list they don't show up next to each other, thats due to the basic sort like 'newest not top' in the product list display.
I want to have the product list sorted on SKU, the sort filter above the page (newest/oldest, title etc) is irrelevant for me though sorting on 'newest' remains handy. Problem is that as I cannot add the sku in that section so I cannot create a sorted product page by making this the default in the search api, I cannot add it here either (and then add 'default and descending'. So I tried to override this by forcing the product display to sort on the sku and then on descending. But this also seems completely impossible.
There is no SKU field in the product view sort criteria (at /products). However, I can add this add a field in 'Fields -> add' when I use HTML with forced fields. Yet it still does not appear in 'sort' and neither in 'Relationships -> add'.
So how do you make a product list to be sorted on the SKU only and bypass the search api sort or add the SKU to the search api and make it here the default descending order? (tab Sorts)
It should be simple but despite reading for weeks now I cannot find any solution for such a simple concept. can anyone guid me to a solution or tell me if this is a mistake in the Kickstart design?
Comments
I feel your pain. I'd call the documentation and support for Kickstart criminal, but that would be an insult to criminals.
Question: What Sort options are -available- to you in the Search API? If it's only Title and Newest, your problem is likely the same as mine... you need a patch: https://www.drupal.org/node/2202093
I dunno your Drupal level... I'm certainly no expert... but the Commerce Kickstart 'bundle' contains -several- really awful problems like this--modules that have not been updated. I've driven myself -nuts- because I thought Kickstart was fully tested and any problems I had were -my- fault. I now assume that when I'm having a problem it may well be that the code is not fully baked. YMMV.
I looked at the solution you gave in the link. I tried that and it still does not work so revert back to original code. Trying to make things work via php amendments is really something we should not need to do, it gets overridden when module updates appear and at some point we would need a huge change control list to recreate bespoke code when updates still do not work.
I think the docs and support are a new version of quatum mechanics, or a sort of digital eugenics experiment.... maybe a day will come someone enlightens us.
Indeed I suspect that there is a code issue, according some video's I should be able to use commerce products fields in the sort criteria, but none show up. So sorting on SKU remains impossible. I'm on core version 7.32 and commerce_kickstart-7.x-2.19.
I'm still experimenting with the zillions of possible routes and let you known if I found a "relative solution" using only TTW changes.