Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Call to undefined method DatabaseStatementBase::fetchArray() in uc_discounts_get_discounts_for_order() #15

Closed
nattywebdev opened this issue Sep 7, 2023 · 4 comments · Fixed by #18

Comments

@nattywebdev
Copy link

When trying to add an item to the cart that has a discount applied, I am seeing the following error after the message '[product] added to your shopping cart':

Error: Call to undefined method DatabaseStatementBase::fetchArray() in uc_discounts_get_discounts_for_order() (line 1637 of /<my-site>/web/modules/uc_discounts/uc_discounts.module).

Is this a bug or perhaps something I've done wrong?

I'm using Backdrop 1.25.1 and ubercart 1.x-3.14.1 with uc_discounts 1.x-2.0.5.

@nattywebdev
Copy link
Author

On further investigation I found this appears to be caused by setting Max uses per user to anything other than the default of 0. I had it set to 1. Reset to 0 and the error goes away.

@bugfolder
Copy link
Collaborator

Glad there's a workaround, but that's still a bug (that function doesn't exist in Backdrop). Will look into it.

@argiepiano
Copy link

I believe fetchArray should be replaced by fetchAssoc(), but I haven't tested this

@bugfolder
Copy link
Collaborator

Actually, fetchField() will be cleaner. I'm working on this now, made the fix, just testing it.

bugfolder added a commit to bugfolder/uc_discounts that referenced this issue Sep 7, 2023
…ld().

Plus a little code cleanup and clearer variable name.
bugfolder added a commit that referenced this issue Sep 7, 2023
Issue #15: Replace fetchArray() db call with fetchField().
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants