When using this module in combination with the Commerce module the sorting doesn't work with more than 50 product variants in a product display. Currently the weight delta is hardcoded to 50 in the inline_entity_form.module.
Perhaps we can increase the value or don't make it hardcoded?
| Comment | File | Size | Author |
|---|---|---|---|
| #14 | max-weight-1876652.patch | 1.2 KB | webflo |
| #7 | 1876652-ief-weight-delta-6.patch | 1.04 KB | fearlsgroove |
| #5 | Screenshot_ief.png | 54.07 KB | criz |
Comments
Comment #1
bojanz commented#delta is just the maximum delta, and if you don't provide it, it defaults to 10, so there's no "don't hardcode it".
Since we say it's 50, that means you can have weights between -50 and 50, which is 100 in total.
We can add code that allows more, of course (by counting the total number of items or something)
Comment #2
combicart commentedThat would be great. I know that in theory there should be 100 positions (-50 to 50), but when adding more than 50 variants, the ordering is completely random. Even if you manually rearrange the variants they are only saved once correctly, but when editing the product for the second time the ordering isn't saved and is completely random.
Comment #3
Kiendeleo commentedI would recommend that you make this a variable that is configurable from the site admin pages. That way it can be configured as needed. I have a couple of products with 2000+ variations and I have to manually edit this every time there is an update to drupal commerce kickstart.
Comment #4
Kiendeleo commentedComment #5
crizThis is a major issue imho.
Now only the ordering of 50 items is supported (starts at 0 and not -50). When combining some product attributes 50 is just nothing.
What is the consequence of having more than 50 referenced product variations?
The order gets disarranged every time the node is saved. This leads to random default values in the add-to-cart form.
A workaround for now is using hook_form_alter():
Comment #6
dman commentedThis killed a site managers week here also.
All ordering above 50 was scrambled, and this was being used in a bunch of different places, with lists of several hundred items.
While I appreciate that this particular UI maybe wasn't designed to scale like that (and is awkward with that many items to say the least), the total lossage of the ordering data was ruinous.
Setting it to 50 doesn't really mean 100 - it just means 50 by the time you revisit the editor.
If it can't be unlimited, ( can't it do count($entities) + 10? ) then yeah make it configurable - or at least a lot bigger.
I too did a form alter that's almost the same as @criz above:
Comment #7
fearlsgroove commentedComment #8
joelpittetTested out #7 it worked like a charm! Thanks @fearlsgroove!
For testing just created this script:
https://gist.github.com/joelpittet/8adcbcf3626110a2d06c
Change your nid, entity types, field and bundles in the above. I was using an existing eck type with a section title field so I can see the order.
Then I went and added titles like A, B, C, D before and after the patch to see what happened to the order.
Totally fixed my problem:)
Comment #9
garphyI just deployed #7 to production. Works great.
Comment #10
pq commented#7 also working fine for me.
Comment #11
bojanz commentedCommitted, thank you.
Comment #14
webflo commentedWe don´t have this issue in 8.x-1.x because if fixed it in 56744aa5 before. But this patch is more in line with 7.x-1.x
Comment #16
slashrsm commentedCommitted to D8. Thanks!