With the Nov 2nd dev version, I get this error on every page:
* warning: Invalid argument supplied for foreach() in /home/.jojo/[user]/[mysite.com]/sites/all/modules/uc_discounts_alt/uc_discounts/uc_discounts.module on line 1013.
* user warning: Unknown column 'a' in 'where clause' query: SELECT DISTINCT tid FROM term_node WHERE nid IN(80,a) in /home/.jojo/[user]/[mysite.com]/sites/all/modules/uc_discounts_alt/uc_discounts/uc_discounts.module on line 1038.
* user warning: Unknown column 'a' in 'where clause' query: SELECT DISTINCT model FROM uc_products WHERE nid IN(80,a) in /home/.jojo/[user]/[mysite.com]/sites/all/modules/uc_discounts_alt/uc_discounts/uc_discounts.module on line 1053.
* user warning: Unknown column 'a' in 'where clause' query: SELECT DISTINCT type FROM node WHERE nid IN(80,a) in /home/.jojo/[user]/[mysite.com]/sites/all/modules/uc_discounts_alt/uc_discounts/uc_discounts.module on line 1065.
* user warning: Unknown column 'a' in 'where clause' query: SELECT DISTINCT d.* FROM uc_discounts d LEFT JOIN uc_discounts_products dp ON d.discount_id=dp.discount_id LEFT JOIN uc_discounts_terms dt ON d.discount_id=dt.discount_id LEFT JOIN uc_discounts_skus ds ON d.discount_id=ds.discount_id LEFT JOIN uc_discounts_classes dcl ON d.discount_id=dcl.discount_id WHERE (d.requires_code=0) AND (d.has_role_filter=0 OR d.discount_id IN(SELECT dr.discount_id FROM uc_discounts_roles dr, users_roles ur WHERE (dr.role_id=ur.rid AND ur.uid=1) OR dr.role_id=-1 OR dr.role_id=2)) AND (d.filter_type<>1 OR dp.product_id IN(80,a,-1)) AND (d.filter_type<>2 OR dt.term_id IN(-1)) AND (d.has_expiration=0 OR d.expiration>0) ORDER BY weight in /home/.jojo/[user]/[mysite.com]/sites/all/modules/uc_discounts_alt/uc_discounts/uc_discounts.module on line 1133.
* warning: Invalid argument supplied for foreach() in /home/.jojo/[user]/[mysite.com]/sites/all/modules/uc_discounts_alt/uc_discounts/uc_discounts.module on line 1013.
* user warning: Unknown column 'a' in 'where clause' query: SELECT DISTINCT tid FROM term_node WHERE nid IN(80,a) in /home/.jojo/[user]/[mysite.com]/sites/all/modules/uc_discounts_alt/uc_discounts/uc_discounts.module on line 1038.
* user warning: Unknown column 'a' in 'where clause' query: SELECT DISTINCT model FROM uc_products WHERE nid IN(80,a) in /home/.jojo/[user]/[mysite.com]/sites/all/modules/uc_discounts_alt/uc_discounts/uc_discounts.module on line 1053.
* user warning: Unknown column 'a' in 'where clause' query: SELECT DISTINCT type FROM node WHERE nid IN(80,a) in /home/.jojo/[user]/[mysite.com]/sites/all/modules/uc_discounts_alt/uc_discounts/uc_discounts.module on line 1065.
* user warning: Unknown column 'a' in 'where clause' query: SELECT DISTINCT d.* FROM uc_discounts d LEFT JOIN uc_discounts_products dp ON d.discount_id=dp.discount_id LEFT JOIN uc_discounts_terms dt ON d.discount_id=dt.discount_id LEFT JOIN uc_discounts_skus ds ON d.discount_id=ds.discount_id LEFT JOIN uc_discounts_classes dcl ON d.discount_id=dcl.discount_id WHERE (d.requires_code=0) AND (d.has_role_filter=0 OR d.discount_id IN(SELECT dr.discount_id FROM uc_discounts_roles dr, users_roles ur WHERE (dr.role_id=ur.rid AND ur.uid=1) OR dr.role_id=-1 OR dr.role_id=2)) AND (d.filter_type<>1 OR dp.product_id IN(80,a,-1)) AND (d.filter_type<>2 OR dt.term_id IN(-1)) AND (d.has_expiration=0 OR d.expiration>0) ORDER BY weight in /home/.jojo/[user]/[mysite.com]/sites/all/modules/uc_discounts_alt/uc_discounts/uc_discounts.module on line 1133.
Comments
Comment #1
jday commentedI get this error:
warning: Invalid argument supplied for foreach() in /home/..../sites/all/modules/uc_discounts_alt/uc_discounts/uc_discounts.module on line 1011.
Comment #2
Abilnet commentedI can verify the same error.
Comment #3
attishu commentedSame error for me just in the shopping cart...
After I created the first discount. After I deleted, but the error message is same. When I have any item in the cart.
If the item is part of the discount, the module is recognise the rule, write the description on the screen, but the discount is £0.
Invalid argument supplied for foreach() in .../sites/all/modules/uc_discounts_alt/uc_discounts/uc_discounts.module on line 1011.
Comment #4
Zalatar commentedThese errors are in my logs:
Unknown column 'a' in 'where clause' query: SELECT DISTINCT d.* FROM uc_discounts d LEFT JOIN uc_discounts_products dp ON d.discount_id=dp.discount_id LEFT JOIN uc_discounts_terms dt ON d.discount_id=dt.discount_id LEFT JOIN uc_discounts_skus ds ON d.discount_id=ds.discount_id LEFT JOIN uc_discounts_classes dcl ON d.discount_id=dcl.discount_id WHERE (d.requires_code=0) AND (d.has_role_filter=0 OR d.discount_id IN(SELECT dr.discount_id FROM uc_discounts_roles dr, users_roles ur WHERE (dr.role_id=ur.rid AND ur.uid=0) OR dr.role_id=-1 OR dr.role_id=1)) AND (d.filter_type<>1 OR dp.product_id IN(586,a,-1)) AND (d.filter_type<>2 OR dt.term_id IN(-1)) AND (d.has_expiration=0 OR d.expiration>0) ORDER BY weight in /home/radiator/public_html/sites/all/modules/uc_discounts_alt/uc_discounts/uc_discounts.module on line 1133.
Unknown column 'a' in 'where clause' query: SELECT DISTINCT type FROM node WHERE nid IN(586,a) in /home/radiator/public_html/sites/all/modules/uc_discounts_alt/uc_discounts/uc_discounts.module on line 1065.
Unknown column 'a' in 'where clause' query: SELECT DISTINCT model FROM uc_products WHERE nid IN(586,a) in /home/radiator/public_html/sites/all/modules/uc_discounts_alt/uc_discounts/uc_discounts.module on line 1053.
Unknown column 'a' in 'where clause' query: SELECT DISTINCT tid FROM term_node WHERE nid IN(586,a) in /home/radiator/public_html/sites/all/modules/uc_discounts_alt/uc_discounts/uc_discounts.module on line 1038
I think that was all of them.
Z
Comment #5
dave bruns commentedI get the same error as well (warning: Invalid argument ...uc_discounts.module on line 1011.)
Is there a workaround for this - perhaps an earlier dev release that didn't have this issue? I tried beta36 as well, but couldn't manage to configure a role-based discount. I could select role-based filtering, but the available roles would not appear, and the form would therefore not validate on save. Roles-based filtering worked great with the 6.2x dev, but then I ran into the invalid argument problem.
I'm new to alt_discounts, so don't know much about it. I've been testing the uc_discount (discount framework) module, but have not been able to get role based discounts to work all the day through a submitted order. Apparently, the discount framework module is out of synch somewhat with Ubercart 2.0, so it seems that I should wait for it to catch up again.
Thanks in advance for any info.
Comment #6
ezra-g commentedCan you describe the kind of discount you have enabled on the site and the types of products in the cart?
Comment #7
ezra-g commentedAlso, I've separated this issue out. Please see #634718: Invalid argument supplied for foreach() uc_discounts/uc_discounts.module on line 233 for the invalid argument error. Let's use this issue for the "Unknown Column 'a' in Where Clause" error. I'm so far unable to reproduce this, so a description of the discount and the products in the cart would be helpful.
Comment #8
Zalatar commentedI have several discounts enabled but only one of them was being used.
It was a 10 percent discount off all products applied to one role. I am using product price alter field.
The other discounts are basically the same, percents off applied to one role.
Hope this helps,
Z
Comment #9
ezra-g commentedThanks, but I'm still not able to reproduce this. Does the error remain if you disable the price alter field?
Also, please don't change the issue title.
Comment #10
Zalatar commentedI am not sure, I have since reverted back to v1 for now. I may be ablt to test this tomorrow sometime.
Maybe someone else can reply.
I didn't change the title, it must of been the default.
Z
Comment #11
butler360 commentedSo the new issue you created covers the issue I originally posted about and I should install the patch?
Comment #12
miguel_angel commentedHi!
At line 991:
if $product->data isn't an array then the if condition is true and $product->data['kit_id'] returns an 'a' which is added to the $order_product_ids_set array as a key.
A possible workaround:
This works and removes the error message but I don't know if this is correct.
Comment #13
ezra-g commentedThis looks good to me, thanks! Could you format it is a patch so others here can test?
Comment #14
miguel_angel commentedHere is the patch. It also includes the 634718.patch
Comment #15
ezra-g commentedGreat, thanks! Marking as needs review.
Comment #16
butler360 commentedThe patch seems to work. I'm not seeing any more errors, at least.
Comment #17
DanielJohnston commentedConfirmed that patch at #14 resolves the error in my installation.
Comment #18
ezra-g commentedThanks for the patch. This patch needs a bit of work before it can be committed. Please use 2 spaces for each indentation per the Drupal coding standards. Also, I applied the fix at #634718: Invalid argument supplied for foreach() uc_discounts/uc_discounts.module on line 233, so the current patch should be re-rolled without that other fix.
Thanks!
Comment #19
ezra-g commentedActually, here's a re-roll that has the fix that was specific to this issue. Setting back to needs review.
Comment #20
ezra-g commentedActually, this is committed. Thanks for the help identifying this issue and for the patch reviews. If this doesn't resolve the problem, please re-open this issue.
Comment #21
miguel_angel commentedThanks ezra-g.
I think the patch should include the 991 line modification showed:
if (is_array($product->data) && !empty($product->data['kit_id'])) {to avoid the dummy 'a' that is causing this error.
Shouldn't it?
Comment #22
ezra-g commentedThanks for pointing this out. I made an additional commit. For future issues, this is the kind of detail that can get lost when 2 patches are combined into one ;). Thanks again for your help here!