Postponed (maintainer needs more info)
Project:
Commerce (Product Display Manager)
Version:
7.x-1.0-alpha3
Component:
Miscellaneous
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
7 Dec 2011 at 11:24 UTC
Updated:
26 Mar 2013 at 17:38 UTC
Jump to comment: Most recent file
Comments
Comment #1
andrea.brogi commentedComment #2
fonant commentedI have this too. If you re-order the products in the Display Manager list, the order is saved with suitable deltas. And the list is generated with the products in the correct order according to delta.
But the row weight widgets all have zero as their default, so when you save again, all the deltas get set to zero.
OK, here's the fix. Change this:
to this:
The #delta setting means the field will always have enough numbers in the select to show as many product deltas as there are products.
The #default_value setting simply uses the $key, as the sorting is done as deltas counting up from zero, and the products are already sorted by delta value.
Arghhh... while that fixes the problem on loading the page, when you sort using JavaScript all the weights/deltas get set wrongly, as the sorting is assuming one single table...
Comment #3
fonant commentedOK, fixed that, it just needed grouping, and one drupal_add_tabledrag() per group. I simply incremented the group number for each product display node, you could use the display node's ID instead.
Patch for this attached.
So now the drag-sorting works properly.
Final problem is that the products are NOT, in fact, sorted correctly in the admin table. While the list of products from _commerce_pdm_get_products_referenced() is in the correct order, this order is lost when the next query to get the product titles is performed.
The code needs to be re-factored quite a bit to fix this.
Comment #4
fonant commentedRaising priority, as with lots of products this failure to remember the sort order on the admin page is quite a problem.
Comment #5
tugis commentedFonant, I applied your patch successfully, but it's not working :/
Sorting is still wrong.
Comment #6
fonant commentedYes, as I said, the code needs a bit of a re-write so that the sort order from the database can be used in the Display Manager list. My patch fixes the JavaScript sorting behaviour, but doesn't enable the sort values to get into the list when the page is first constructed.
Comment #7
netsensei commentedI'm not quite sure what this patch is trying to fix here. Do you mean that the product display manager delta's don't map to the delta's of the product reference field on the product display nodes? I've played a bit with reordering the products with 7.x-1.x-dev but I don't see any problems there when saving and re-saving the form.
Some more input needed!
Comment #8
sanchezduran commentedWithin the administration panel of product display manager, when you order different products within a node display it work, but when I reloaded the page is not displayed in the order saved but it was in before saving.
Sorry for my english
Comment #9
netsensei commentedOkay. So when saving the product display from the manager, the order gets ignored. I don't think this is a major blocker, but I'll investigate nonetheless.
Comment #10
netsensei commentedHm. I can't seem to reproduce this problem. I've been toying with this and checking delta's in the database tables of the referencing fields, but I don't see any problems there. Changes are saved correctly.
I'm now explicitly retrieving the delta from the database and passing it to the delta form element as a default_value, as per #2. I'm not sure changing the tabledrag would add more value.
Commit ref:
http://drupalcode.org/project/commerce_product_display_manager.git/commi...