Hi,
I use weight to get the items in our store in the correct order. When updating from 7.x-1.0 to 7.x-2.0-beta3 I had to update the weight changer view an add the sorting by the new weight fields to all the views where I used it.
The product listing view lists nodes with product information received from the product entity from a relationship, as well as a relationship on taxonomy terms.
After playing around with my old view I where I got the duplicates as soon as I added weight as sorting criteria I
- cloned the default weight sorting view
- added a filter for the Node type that links to the products
- set the pager to display all items (which are in my case between 80 and 100)
- duplicates for all of the node titles are shown so I set Distinct in the Query Settings
Now some but not all of the duplicates are gone.
The duplicated entries are not necessary the ones referencing multiple products.
Maybe it is also important, that I had weight enabled for the product node type before updating. The product node type has, beside the weight field, just title, body, product_reference and one reference on taxonomy term field.
I also tried to add weight-ability with 7.x-2.0-beta3 to another node type with a user reference field and have been able to sort and list the nodes as desired.
Therefore I think it is either a problem upgrading from the 1.0 to 2.0-beta3 or a problem / conflict with the commerce module.
As I don't have the skills to investigate deeper you find the export of the view with the duplicates at http://pastebin.com/NRnJPQgu and the working view at http://pastebin.com/32KZ4SNr .
I hope the description of the problem is understandable. If you need further information I would be lucky to deliver. And if it's just me who made an incredibly silly error - sorry for wasting your time.
But nonetheless thanks for this great module!
| Comment | File | Size | Author |
|---|---|---|---|
| #4 | Screen Shot 2012-03-16 at 3.50.23 PM.png | 28.73 KB | duskoo |
Comments
Comment #1
davisbenThanks for the detailed description! I'll get commerce setup on a test site and see if I can track this down.
Comment #2
futurist commentedI got duplicates of nodes too after adding weight as sorting criterion, without commerce. I posted in the Views issue queue because I'm not sure where this belongs. (I will gladly provide access to my dev site if it is of any use.)
Comment #3
pauleb commentedDo our node types with the problem have anything (field types, updated from weight-1.0) in common?
Some additional information on the fields on the node type where it worked:
Comment #4
duskoo commentedI've noticed that duplicate entries are being made in field_data_weight_table (after changing the initial weight for a node). In the attached screenshot, the original entry is in German, and the duplicate is undefined.
Comment #5
davisbenThanks for the reports everyone! I haven't been able to reproduce this yet, but I'll be diving into it when I have some time this weekend.
pauleb/futurist - Are either of your sites multilingual also?
Comment #6
Helrunar commentedI think, i came a bit closer to this issue.
When you enabling the module for an contenttype without existing content, all will work fine and you got no duplicate content after saving the new weight. But, if you enabling the module for an contenttype with existing content, the existing content is not updating correctly and you've got duplicate entries after saving the weight.
I have test it on one page only in English and on one multilingual page with German as default language.
I hope this will help.
Comment #7
pauleb commentedMy site is multilingual with German as default language and English also enabled.
Multilingual settings are disabled for both of the node types where I tried weight.
@Helrunar: On the other content type, where it worked, content already existed. I just added the weight functionality to the node type, cloned the weight - view and it worked with the existing content. I didn't add any new content to both of the node types when I was testing.
Comment #8
davisbenI just committed a major overhaul to the weight field system that should eliminate this problem.
Comment #9
wiherek commentedwill it be in the new dev? I am having the same problem.
Comment #10
davisbenYes, it will be in the next dev release, but you can get it from git now if you don't want to wait for a few hours. Don't forget to backup your database and run update.php for all changes to take effect after updating the code.
Comment #11
wiherek commentedyea, I just did :)
I tried to install it upon the existing beta AND dev release and then update.php, but that returned fails. So I tried disabling then uninstalling the previous versions, and then installing the new commit. That required adding all the weight information and setting up views once more to sort by weight - but it works well! :)
Thanks a lot!
Comment #12
amerkelijn commentedThis morning I installed the 7.x-2.0-beta3 version and got the problem of duplicates of nodes.
I just installed the dev version, run update.php and the duplicates are gone!
Thanks!!
Comment #13
knalstaaf commentedNotice: carefully uninstall the previous version. I was little too careless and simply deleted the folder, uploaded the new one and ran update.php. This resulted in the following error:
If you bumped onto the same error, just delete the weight-folder again, refresh the website, upload the dev version, go to modules, and before enabling the dev version: uninstall the previous version. Then enable the dev version and you should be done.
Comment #14
knalstaaf commentedOw hold on, I'm getting this one now after saving content with weight (white page):
Looks nasty.
Also getting this error randomly, related?
And more:
Notice: Undefined index: weight_weight in _token_field_info() (line 1280 of /var/www/vhosts/domain.com/subdomains/preview/httpdocs/sites/all/modules/token/token.tokens.inc).And this (after disabling, uninstalling and re-enabling the module):
Resulting in this beauty after saving weight-related content:
PDOException: SQLSTATE[HY000]: General error: 1366 Incorrect integer value: '' for column 'weight' at row 1: INSERT INTO {weight_weights} (entity_id, entity_type, weight) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2); Array ( [:db_insert_placeholder_0] => 135 [:db_insert_placeholder_1] => node [:db_insert_placeholder_2] => ) in _weight_set_weight() (line 369 of /var/www/vhosts/domain.com/subdomains/preview/httpdocs/sites/all/modules/weight/weight.module).Luckily I can still go to the edit page of that node, but guess what: the troublemaker escaped. No possibility to apply a weight on the node anymore.
Ok, uninstalling, deleting the dev version, and putting back the 7.x-2.0-beta3. Oops...
FieldException: Attempt to create field name <em class="placeholder">weight</em> which already exists, although it is inactive. in field_create_field() (line 81 of /var/www/vhosts/domain.com/subdomains/preview/httpdocs/modules/field/field.crud.inc).Update.php?
No pending updates.No possibility anymore to assign weight anymore. Guess it's all kaputt in my case now.
Comment #15
davisbenI'm not sure where you stand at the moment, but it looks update.php didn't run completely and you're stuck in between the 2 versions of the module. Could you check your database to see which of the following tables exist?
Comment #16
knalstaaf commentedI can find these:
But not this one: weight_weights
I notice in the field_data_weight that the language of modified nodes (assigned weight to these) has been switched to "und" instead of "en".
Comment #17
davisbenI would try setting schema_version to 7204 for the weight module in the system table, then try running update.php again. This should run the 2 updates that take care of creating the new table, populating it with the weights from field_data_weight, and removing all the old field related stuff.
Comment #18
knalstaaf commentedChecked schema_version and strangely enough it was already set to 7204. Deleted 7.x-2.0-beta3 (couldn't uninstall after disabling it, because fields were being used). Uploaded the dev version, ran update.php, and this time the 2 required updates went well (whereas the first time it tripped over the second update).
Configured the proper content type again, tested it and not a single problem popped up. So I guess this is fixed.
Thanks for pulling me out, 10oclock!
Comment #19
knalstaaf commentedI cheered too early I'm afraid.
I applied the dev version on two other websites (no earlier version was installed), and the issues occur again.
It starts with this error on the edit page of a node (that hasn't got weight enabled - which is weird):
Notice: Undefined index: enabled in weight_field_attach_form() (line 265 of /var/www/vhosts/domain.com/httpdocs/sites/all/modules/weight/weight.module).When hitting "Save" on the edit page, this error occurs:
PDOException: SQLSTATE[HY000]: General error: 1366 Incorrect integer value: '' for column 'weight' at row 1: INSERT INTO {weight_weights} (entity_id, entity_type, weight) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2); Array ( [:db_insert_placeholder_0] => 84 [:db_insert_placeholder_1] => node [:db_insert_placeholder_2] => ) in _weight_set_weight() (line 369 of /var/www/vhosts/domain.com/subdomains/preview/httpdocs/sites/all/modules/weight/weight.module).When I checked back to the site of yesterday, I see that this behaviour is also present there (again). I've checked in another browser, just in case it had something to do with the browser's cache, and it's also doing it there.
-> The remarkable thing is: it doesn't occur on pages that do have weight enabled.
Comment #20
davisbenI found the bug, and committed the fix. It will be included in the next dev release, but you can get it from git now.
Comment #22
Yuri commentedThis looks very much like the error mentioned here.
I got this when resaving a node (after changing the image in an image field.)
latest version of Weight.
Comment #23
davisbenI'm currently traveling, but will check this out next week.
Comment #24
davisbenThat looks like the same error mentioned in #8 at #1589932: Weight not saving default value. Are you using the most recent dev version?
Comment #25
davisbenIf anyone is still experiencing this with the latest release, please reopen this issue.