Just trying this module:
- installed it & activated
- ran cron
- navigated to /admin/store/settings/uc_views_upsell then pressed Rebuild now
A series of messages similar those above is shown:
user warning: Duplicate entry '4-5' for key 'PRIMARY' query: INSERT INTO uc_product_pairs (nid, pair_nid, orders) VALUES (4, 5, 1) in ...\sites\all\modules\uc_views_upsell\uc_views_upsell.module on line 49
Comments
Comment #1
mandreato commentedThe messages are shown every time cron runs
Comment #2
longwaveAre you using product attributes? I didn't test with attributes installed, perhaps there is an incompatibility here that needs fixing..
Comment #3
mandreato commentedYes I was, but after disabling and uninstalling the attribute module the errors are still present.
Comment #4
longwaveThat will be because there are previously ordered products with attributes that aren't deleted when you uninstall uc_attribute, and these will have duplicate nids. I need to do some tests with attributes enabled to figure out the best fix for this.
Comment #5
mandreato commentedThank you longwave.
Comment #6
Kalorlo commentedSubscribing - I use attributes and am interested in using this module.
Comment #7
Whole Human commentedSubscribing as well. I want to use this, but I will have products with attributes...
Comment #8
oivind commentedSubscribing.
Comment #9
misc commentedThis could be related to: http://drupal.org/node/1151824 - I got similar warnings like the above, and the fix made them go away.
Comment #10
nimicohgr commentedsubscribing as welll. FYI the curly brace fix in dev branch does not resolve issue. I also use attributes. I am willing to allow access to my site, if/when Longwave has time to look.
Comment #11
Piyush commentedCame across this same issue after re-hosting a working site (with PHP 5.2 and no warning messages) on a new server with PHP 5.3. Finally found a working fix/answer at http://drupal.org/node/638702#comment-2615634 i.e. prefix the INSERT db_query with @. And can confirm that this does indeed suppress the warning messages in the logs and on screen on rebuilding the pair data.
There is more discussion on this problem with regards to the php mysqli_affected_rows function at http://drupal.org/node/805858.
Hope this helps.
Comment #12
loparr commented@Piyush I re-hosted my site from server with php 5.2 to another server with php 5.3 but that patch did not solve errors. I think changes has to be made inside uc_views_upsell.module
This patch which is included in dev version did not solve it either http://drupal.org/node/1151824
Any ideas?