I'll have to double check my current settings and update you, but I was getting an error about a bad query statement as it was including a where clause that filters out node ids that are already in the cart. However, if there are no products in the cart the list of nids is empty leaving the where clause as "NID NOT IN ()" which mysql doesn't like...
Easy solution, add an if statement to determine if the $filter_query string is set or not... ~line 215 in uc_upsell_core.inc...
The existing:
$randoms = db_query("SELECT `nid`
FROM {node}
WHERE `status` = 1
AND `type` IN ('". implode("','", uc_product_product_types()) ."')
AND NOT nid IN (". $filter_query .")
ORDER BY RAND()");
Should be changed to:
if ($filter_query) {
$randoms = db_query("SELECT `nid`
FROM {node}
WHERE `status` = 1
AND `type` IN ('". implode("','", uc_product_product_types()) ."')
AND NOT nid IN (". $filter_query .")
ORDER BY RAND()");
} else {
$randoms = db_query("SELECT `nid`
FROM {node}
WHERE `status` = 1
AND `type` IN ('". implode("','", uc_product_product_types()) ."')
ORDER BY RAND()");
}
Comments
Comment #1
webspring commentedThanks, this worked for me
Comment #2
ericwongcm commentedMy site have the same issue....in my news aggregator
http://www.hdmp4.com/aggregator/sources/
By using tcindie's code above, it fixed the issue.
Hopefully, torgosPizza (Upsell's author) will read this issue soon and fix it in the code.
Thanks
Comment #3
stroobl commentedSeems to work for me too.
I made a patch with the change.
Comment #4
torgospizzaThanks for the patch!
I actually changed it a bit. Instead of just finding all product types in uc_product_product_types(), it needs to use the settings from Upsell itself. Here's the modified patch. Will commit this asap.
Comment #5
torgospizzaComment #6
johnnymast commentedHas the module package been updated already ?.
Comment #7
torgospizzaNo, not yet. I got sidetracked again. Will put out a dev release, at least, soon.
Comment #8
torgospizzaThis change was commited to the 6.x-1.x-dev branch and will be in the next version (1.22 and 2.x)
Comment #9
torgospizzaComment #11
sarjeet.singh commentedThanks for patch. I faced same problem.
Comment #12
torgospizzaSo I'll set this back to closed, then. (You did not need to change this issue's Status.) Thanks for letting me know.