2

I'm trying to figure out how searching for Commerce Orders in the CP works. I've run some tests searching against the following fields:

  • Shipping Business Name
  • Billing Business Name
  • Shipping Method

In all cases, searches seem to match nothing in these columns. For example, if the Shipping Business Name was "Acme" and I enter that in the CP search bar, I get no results.

Is this expected behaviour? That seems hard to believe if it is. How would a user filter down the list of Orders for a particular company or shipping method... or whatever?

3

We are working on providing better search for entries, products, orders, and all other custom elements in Craft within Craft 3. For example we recently added the search keywords method to the element interface to allow searching on non core attributes or custom fields: https://github.com/craftcms/cms/commit/afffaa5dcdb0fc02b484192e42cd5c9d528db94a

The above additions like above will help us provide searching on attributes that aren't actual properties/getter methods on the order.

This of course doesn't help you in the short term when searching for orders on the attributes you listed. I have added it as a priority to see if we can somehow make searching on those attributes easier in Commerce 1.x

A temporary work around would be adding the information to the search index by creating some pre-parse custom fields: https://github.com/aelvan/Preparse-Field-Craft

For example you could create a pre-parse field called "businessShippingName" and add it to the order field layout. In the settings for that field, you could use the template: {{ commerce_order.shippingAddress.businessName }}. This would allow you to search based on the business shipping name, as well as list it more easily in the order index screen.

  • 2
    Thanks for the input Luke. I also noticed that you cannot search based on an Order Number or even an Entry ID. I'm not trying to be contrary but I'm just baffled by this. An ecomm solution where one cannot find/filter order by an ID? I hope something can be done about that. It seems like a significant miss for a standard feature of any ecomm system. – Mike Feb 27 '17 at 12:00
  • 1
    Hi Mike, have you turned on fuzzy searching in your Craft config?craftcms.stackexchange.com/a/11872/91 Let me know if that helps? Order number and order email etc should be searchable already, but if you do not search for the full string, fuzzy might help. – Luke Holder Feb 27 '17 at 14:44
  • Ah - thanks Luke. I thought fuzzy searching was only for front end searches. That definitely helps for using the order number field. – Mike Feb 27 '17 at 14:54
  • I have created a pre-parse filed called orderSearchableName and within this added the following code; {{ commerce_order.billingAddress.firstName }} {{ commerce_order.billingAddress.lastName }} - I can see this is populating if I show this column on the order screen, however running a search 9with fuzzy enabled) is still not finding anything within this field. Is there a step I am missing? – Terry Upton Jul 26 '17 at 15:47
1

Right now (Feb 2017), there are indeed a distinct lack of order searching options for orders with Commerce. I don't know if you'd call it 'intended behaviour' so much as an oversight or at least lower priority at the moment....(my suspicion is that because P & T themselves sell only virtual products, it's not quite as obvious to them how necessary this is for non-virtual goods sellers - but it may be I'm being totally unfair there!).

It's a frustration for our staff that I have mentioned along the way a few times. There's a related feature request here: https://github.com/craftcms/commerce/issues/186

  • Thanks for the input Jeremy. Indeed, it seems like a bit of an oversight. Certainly with clients who we've built other ecomm solutions for, this would be a definite pain point. I'd also guess this isn't something a plugin could - at least easily - address (probably too wrapped up in core files). +1 to the feature request as this is an issue we'll need to weigh with Commerce. – Mike Feb 19 '17 at 23:23
  • I get these complaints, too. You'd have thought you'd be able to sort by order number, order short number, order ID at least. – Clive Portman Feb 20 '17 at 10:13
  • Do you know if it's possible to extend the search and write the functionality on my own? And if it is, any idea how to approach it, or where to look for inspiration? Or is adding custom (sortable) column to the orders table the only enhancement I can make here? EDIT: Ignore me, I've completely forgot about what's listed in Luke's answer below. – ijust May 11 '17 at 16:10
  • 1
    I am still having this batted back at me almost weekly by my clients using Craft Commerce. If there is anything that can be done? – Terry Upton Jul 26 '17 at 15:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.