I'm trying to create orders for users who already are in the system. There are two problems with searching for existing customers:
1. Search by first or last name returns a seemingly random list of users, not having the first or last name that are in the search term.
2. Search by email or username works, but somehow it doesn't work for users who have the role "Registered users". On my site, users receive this role when they first sign up for membership but haven't paid yet. If they pay online, they are automatically switched to one of the membership roles. If they pay by check instead, I need to enter the order manually, and then the search doesn't find them. Moreover, if I remove the Registered user role and add a membership role, the search still can't find them. The search does find users who never had an online order (bulk imported, for example), so I have no idea where this strange behavior comes from.
| Comment | File | Size | Author |
|---|---|---|---|
| #8 | 1595034-customer-search-ignore-order-status.patch | 1.17 KB | longwave |
Comments
Comment #1
tr commentedPlease be more specific about what page you're using, what you're entering into the search fields, and what the results are. admin/store/customers/view uses Views for the search, and it's unlikely that exposed filters are broken like you describe.
Comment #2
longwaveI think this is regarding the customer search facility when creating a new order (or editing an existing order), which doesn't (yet) use Views.
Comment #3
julia_g commentedThis is admin/store/orders/create. I fill out one field at a time with last name, first name, email or username of an existing user.
Comment #4
longwaveCan you give us some examples of searches you are making, with the expected and actual results?
This page does not take roles into account at all so I am not sure why the role of the user should make a difference.
Comment #5
tr commentedComment #6
julia_g commentedOK, finally got back to this, sorry.
I was wrong, the roles have nothing to do with this.
The function uc_order_create_form creates queries where search in table uc_orders is limited to users who have no orders yet, or the ones who have orders with limited set of statuses, defined by uc_order_status_list('general', TRUE). My users had orders with status 'abandoned', so the query couldn't find them. Cheanging this to uc_order_status_list('all', TRUE) should fix this, but I'm not sure whether this wouldn't break something else.
Comment #7
pedrogk commentedI can confirm this issue.
When I try to create a new order for a user that has another order with status = 'abandoned', I can't find that user by email through the search form at the create order page (admin/store/orders/create).
I don't know if this is by design (why create a new order for the user if he has an abandoned one) or not. In case it is by design, I guess it would be good to provide some clarification in the empty result message. Like "Search returned no results, please make sure you provided the right information or that the user in question does not have any abandoned orders".
Comment #8
longwavePlease test the attached patch. There is a check for order status that I hadn't spotted before, but I am not sure why it is needed.
Comment #9
longwaveCommitted #8.
Comment #11
marty.true commentedHaving the same issue and patch #8 did not do anything for me.
Comment #12
marty.true commentedComment #13
longwaveWhat version of Ubercart are you using? Patch #8 was committed over a year ago, so if you are using a recent version I am not sure how you applied it to test. Also, can you provide a bit more detail like the users in #6 and #7 did - what is different about the customers or orders that are not found by the search?
Comment #14
marty.true commentedUsing Ubercart v7.x-3.6 and having the exact issue described. When creating an admin order, searching a first name returns a list of random users that do not match the criteria at all. When I patched the file, it did in fact, change the file and returned no errors when patching the file. So apparently the changes in the patch we not in this version.
No matter what first name I type in, I will get a list of random users that do not match the criteria at all.
Comment #15
tr commented@xstatic: "Having the same issue" is not a helpful report, as the above thread contains a variety of reported problems. That is true of MOST threads here on Drupal.org - it is always necessary to be specific about what issues you are experiencing and whether or not you can confirm other specific problems.
In particular, the patch fixes only the case where users were not found because of a particular order status. That is the only issue that was addressed in this thread, as that was the only problem that was confirmed and had follow-up from the original poster. The "seemingly random list of users" result was never mentioned by anyone other than the original poster, and even she did not provide the information requested in #4 that we would need to pursue that issue. It is bad practice to report more than one problem per issue for exactly this reason.
If you truly have 7.x-3.6, then the patch will not apply. I verified that the patch was committed (commit e78791bdbac0) and the change is present in 7.x-3.6.
The additional information you provided in #14 indicates that you are having the "random users" problem, which is not what this thread/this patch was about. If so, please open a NEW thread for this new problem, describe the problem fully, and don't forget to provide the information requested in #4.