Author Topic: How to search order by partial customerName  (Read 60 times)

giacomokk

  • Jr. Member
  • **
  • Posts: 11
    • View Profile
How to search order by partial customerName
« on: August 28, 2017, 10:45:28 AM »
Hi, i'm triyng to search an order by "customer name" using the "AdminOrderSearch" class setting a value for the "customerName" property.

I see that it works only if i search with the complete customer name: firstname + lastname (e.g. "Mario Rossi"), and it does not work if i search for only a partial lastname (e.g. "Ross").

Printing the konakart mysql queries log i see that konakart executes a query with the equal "=" symbol (e.g. "select * from orders where customer_name = 'Ross' ") and not with "like" expression (e.g. "select * from orders where customer_name like '%Ross%' ").

How can i solve this issue?

Regards,

G


julie

  • Administrator
  • Hero Member
  • *****
  • Posts: 523
    • View Profile
    • KonaKart
Re: How to search order by partial customerName
« Reply #1 on: September 01, 2017, 09:59:27 AM »
In the AdminOrderSearch object you can set the search rule:

public void setCustomerNameRule(int customerNameRule)

The rule for the search. Valid values are:
KKConstants.SEARCH_EXACT
KKConstants.SEARCH_ADD_WILDCARD_BEFORE
KKConstants.SEARCH_ADD_WILDCARD_AFTER
KKConstants.SEARCH_ADD_WILDCARD_BEFORE_AND_AFTER
KKConstants.SEARCH_USE_GLOBAL_CONFIG