villagedefrance / OpenCart-Overclocked

OpenCart Overclocked Edition. Advanced Shopping Cart CMS based on OC v1.5.6.X source code.
https://villagedefrance.net
Other
31 stars 22 forks source link

Admin search fields issue #163

Closed Tangol closed 6 years ago

Tangol commented 6 years ago

Please note that when searching for stuff using the search fields in the Admin, you are limited to search only using the first keyword in a name.

For example, you have iPod Touch in the product list. To find it, you have to search for ipod. If you search for touch, it returns no results.

keyword

This is a big issue when you have hundreds of products, as it makes the search ineffective.

PS: this issue affects all search fields in the Admin side.

Tested on https://github.com/villagedefrance/OpenCart-Overclocked/commit/c8a4525b99aeff444d31fe4610c2839004d60618

villagedefrance commented 6 years ago

I have just added a new commit that gives the ability to search products using both product's name and/or manufacturer's name as well.

Now this is as far as it can go because there are too many factors involved:

The search is performed through an SQL query that changes depending on the parameters entered in the Filter. Pushing this too far could be trouble as the function is already 60 lines long, not including the "total" function to match the main function.

I don't think I can make more improvement on this. I think the issue should now be closed as it is working as intended.

Tangol commented 6 years ago

It still doesn't work (I don't know if I explained good enough in the main post). You can only search either using the first keyword in a product's name, or the full name.

keyword

palette

See what I mean?

villagedefrance commented 6 years ago

I do understand. ... but like I said there are too many factors involved and I honestly cannot make this better! I am open to suggestions, code snippets or PRs, if anybody can answer this. I can't. Sorry.

Tangol commented 6 years ago

Oh ok, no problem. I thought this was a bug that would have had an easy solution.

Can be closed. Thanks!

Tangol commented 6 years ago

I do understand. ... but like I said there are too many factors involved and I honestly cannot make this better! I am open to suggestions, code snippets or PRs, if anybody can answer this. I can't. Sorry.

Before we close it, some more thoughts regarding this matter. As we already have a functional full text search system implemented in the front end, why can't it be ported to the Admin side also?

I mean, it basically does the same thing, right? Query the database and return the results.

search

The bug from my point of view, is that the system only searches for the first word and not the entire string, if that makes sense.

I know, I'm annoyingly stubborn! 😁

villagedefrance commented 6 years ago

No, this is not the same thing at all!

The Admin product search (by name) is part of the Product List Table, which happens to have a Filter to limit the results based on Product options like name, model, price, and so on ...

The Front End search is on the other hand a Global Search with its dedicated controller, language files and result page. This searches the database for matches globally, including product name, category name, product descriptions, tag names, model, and now also colors. If you look at the examples (1,2,3) you kindly provided the name of the files are called "global_search".

These are 2 very different things!

Now the only way to achieve what you are asking would be to create a entirely new set of files (controller, language, model, template) under Admin called "Search" (or "Product Search"), which is possible. But, let think about the consequences of doing that: This would mean offering 2 distinct ways of finding and editing products, the classic way (like at present) or the search way. The question is then how confusing this would be for the users, would it be a useful positive addition or a redundant negative solution?

I am happy to create this if we agree that it will be beneficial for the users, but I'm not sure it is really necessary as it would mean double the amount of code for pretty much the same result.

One thing is certain, these 2 ways cannot be merged into the same files. They have to be distinct.

Tangol commented 6 years ago

I finally get it. Thanks for the detailed response.

In this case, there's no need to bother with this anymore.

The only beneficial thing here, would be to add a Global Search in the admin (as per my old suggestion here). That would greatly improve the Admin workflow, by adding the ability to instantly search for everything.

But then again, this isn't that urgent.

Tangol commented 6 years ago

I guess this report can be closed, as it may get fixed in a future update, by adding the Admin Global Search.

Thanks!