Searching within order comments
Hi,
Using Zen 1.3.7.
On the orders.php page, there is a search box for searching for specific orders/info. Works fine, except I would also like this to search for terms INSIDE the order comments section. So for example, if one of the orders had the words "express mail" inside the order comments section, I could run a search on the term "express mail" and, voila!, that order would appear on the search results list.
I have looked in orders.php and found the search code:
Code:
// create search filter
$search = '';
if (isset($_GET['search']) && zen_not_null($_GET['search'])) {
$keywords = zen_db_input(zen_db_prepare_input($_GET['search']));
$search = " and (o.customers_city like '%" . $keywords . "%' or o.customers_postcode like '%" . $keywords . "%' or o.date_purchased like '%" . $keywords . "%' or o.billing_name like '%" . $keywords . "%' or o.billing_company like '%" . $keywords . "%' or o.billing_street_address like '%" . $keywords . "%' or o.delivery_city like '%" . $keywords . "%' or o.delivery_postcode like '%" . $keywords . "%' or o.delivery_name like '%" . $keywords . "%' or o.delivery_company like '%" . $keywords . "%' or o.delivery_street_address like '%" . $keywords . "%' or o.billing_city like '%" . $keywords . "%' or o.billing_postcode like '%" . $keywords . "%' or o.customers_email_address like '%" . $keywords . "%' or o.customers_name like '%" . $keywords . "%' or o.customers_company like '%" . $keywords . "%' or o.customers_street_address like '%" . $keywords . "%' or o.customers_telephone like '%" . $keywords . "%' or o.ip_address like '%" . $keywords . "%')";
So I figured I would just try to add "or o.comments like '%" . $keywords . "%' " to this long list of search inputs, but that does not work. Pls don't laugh...I had to give it a try, right?! :blush:
Can anyone tell me how to do this properly? It seems like it should be easy but I just do not know enough about the coding to do it.
Thanks,
Thomas
Re: Searching within order comments
The comments are not in the orders table ... they are in the orders_status_history which is not part of the initial select statement in orders.php where the search is performed ...
You would be better off making a separate search for that or you would need to add the orders_status_history table to the search ...
This would not be a fun task, btw ... :unsure:
Re: Searching within order comments
Quote:
Originally Posted by
Ajeh
The comments are not in the orders table ... they are in the orders_status_history which is not part of the initial select statement in orders.php where the search is performed ...
You would be better off making a separate search for that or you would need to add the orders_status_history table to the search ...
This would not be a fun task, btw ... :unsure:
"This would not be a fun task" for Ajeh = "impossible to do" for Thomas :D
So I guess I will forget about it for now. Thanks anyways.