Jump to content

Search Order name behaving weird


Lastwolf

Recommended Posts

It's probably my fault considering how I'm abusing Cubecart to do something it's not intended.

But I'm currently using the Customer name field to hold a job ID.

For Example instead of 

Firstname: John

Surname:  Smith

I'm doing

Firstname: John Smith

Surname: (1008451567)

 This works great for my general needs, but the only flaw is that when I go to search, using (1008451567) it returns no results.

 

Looking into it a bit further, if you search any partial of a name and hit search, it returns all orders. It'll only show properly if you click a suggested name

Edited by Lastwolf
Link to comment
Share on other sites

The Search Orders tab, in the Customer> Orders form.

 

The fly out search wouldn't search the field at all as the job ID, I'm using on a per order basis.

removing the parentheses still results in the same behaviour.

 

Screenshot-2023-10-30-083231.jpg

Pressing that search button with anything in the above fields, returns no results/ reloads the page. For example searching the partial of a name, Mark, doesn't work. The Search will only complete if you click on one of the drop down names. I'd be fine with the drop down menu method, but it also doesn't seem to contain any orders that are manually entered without saving the customer (those orders are not hyperlinked).

Partial searches DO work for Order Number.

Edited by Lastwolf
Link to comment
Share on other sites

"Removing the parentheses still results in the same behaviour."

To be clear, when using the flyout to enter a customer's name (a job number), you were able to enter a left parenthesis?

I changed the Last Name of a customer to be (3456789), of which entering 345 brought up that customer for selecting. (The 'autocomplete' script requires three characters before an ajax request for search results is fired.)

Note: I also found out why my browser (Firefox 115) will not accept a left parenthesis in the search string.

So, on Orders, Search Orders tab, entering Mar in Customer Name, but not also clicking on one of the suggested results, then clicking the Search button, this has failed to assign to the Customer Name text entry field the customer_id value of the selected choice from the list of suggestions. Thus, in this scenario, having clicked the Search button will submit the form but with nothing to search against.

You mention administratively creating orders with no customer info? That does seem to be possible, and is there a workflow reason to not include a job number (Last Name)?

Link to comment
Share on other sites

It's not that there is no info, it's more that it's not making new customer accounts I think. Some orders are have hyperlinks and some don't, I'm having a hard time figuring out why this occurs. Okay, I figured it out, it's because the email address is not entered or the one entered is already in use.

 

Any of these grey linked orders appear to be not searchable, because they don't appear in the suggested results.

 

 

example1.jpg

All orders are manually entered, so there might not even be an email address given sometimes, these orders would never be searchable by customer name.

Edited by Lastwolf
Link to comment
Share on other sites

Please know that when an admin creates an order, providing delivery and billing details (which includes customer names and addresses), saving such an order, currently, does not automatically also use the customer details to create a new customer record in the database. (But it should be possible to add the necessary code to do that.)

When listing orders, if there is a customer_id accompanying that order, then yes, there will be a link to bring up the editing page to show that customer's details.

 

Link to comment
Share on other sites

Should there be a project to add the means to instantly create a related customer record while creating a new order, the result would be a narrow implementation.

That is because a customer record will have a name, where that customer's related various addressbook records can have different names.

So, maybe building a code snippet to be used by those that can use this specific implementation.

Link to comment
Share on other sites

I understand only some of those words  😀

 

Yes, I guess a forced unique customer id would solve the issue as well as anything else, but seems kinda backwards, all I want to do is find all orders with the name "Smith" (in my case it's reference number but the principle is the same) the search bar makes a blow out window of all accounts with the name Smith. Does this not mean if they had an addtional address to their Aunt Jones they sent an order to, it would show? cause I can't replicate that.

Also means that if I manually ordered in their "account" with it going to an alternative address it'd also not searchable as that doesn't automatically make an "alternative address" entry for them?

If I manually enter an order that does not have an email address, it's not searchable. 

I dunno, the way Search by Name currently works is so finite, it's not very useful.

Edited by Lastwolf
Link to comment
Share on other sites

Figured it out.

Admin/sources/orders.index.inc.php
            // Customer ID
            if (isset($_GET['search']['search_customer_id'])) {
                $where['last_name'] = '~'.trim($_GET['search']['search_customer_id']);
            }

Admin/skins/default/templates/orders.index.php
            <label for="customer_id">{$LANG.orders.customer_name}</label>
            <span><input type="text"  name="search[search_customer_id]" class="textbox"></span>

 

Link to comment
Share on other sites

Woops,

 

Seems I need to add a not empty check or it borks all other searches, this is why I am generally a bull in a china shop;

            // Customer ID
            if (isset($_GET['search']['search_customer_id']) && !empty($_GET['search']['search_customer_id'])) {
                $where['last_name'] = '~'.trim($_GET['search']['search_customer_id']);
            }

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...