Search the backend catalog by product keywords

LiteCart Fan
Depuis Netherlands
Membre depuis mars 2021

I want to be able to search the backend catalog for product keywords. However, this is not possible now and I don't know where to change this. Anyone have an idea or tips?

I had thought to find this in catalog.app/catalog myself but I made adjustments with a vmod but no effect.

tim
Founder
Depuis Sweden
Membre depuis mai 2013
tim

Are you using the left or right search field? (see atatched image)

What does your vmod look like?

For the right search field. Before line 301 in:
https://github.com/litecart/litecart/blob/2.5.2/public_html/admin/catalog.app/catalog.inc.php#L301

Try adding:

            + if(find_in_set('". database::input($_GET['query']) ."', p.keywords), 5, 0)

Find in set is pretty clumpsy though and does not take into consideration your commas may have space character after them. So you might want to try this:

            + if(find_in_set('". database::input($_GET['query']) ."', p.keywords) or find_in_set(' ". database::input($_GET['query']) ."', p.keywords), 5, 0)

You can also do partial match by like

+ if(p.keywords like '%". database::input($_GET['query']) ."%', 3, 0)

LiteCart Fan
Depuis Netherlands
Membre depuis mars 2021

Thanks, I did indeed mean the right search function. I think I'm best off with the line for a partial match.

Only thing I want to know is whether it is possible to refine a search result by searching with two keywords?

tim
Founder
Depuis Sweden
Membre depuis mai 2013
tim

You will have to break up the words into two separate matching clauses.

LiteCart Fan
Depuis Netherlands
Membre depuis mars 2021

Can you give me an example of how to do that? I don't quite understand it.

For example:
(product 1) red, duck
(product 2) blue, duck
(product 3) blue, dog

and I search
Duck Blue

then he finds nothing. I do find products on separate keywords, blue or duck but not together

tim
Founder
Depuis Sweden
Membre depuis mai 2013
tim

An example using regexp


+ if(p.keywords regexp '(^|, ?)Blue(,|$)', 5, 0)```
Ce fil de discussion a été fermé en raison d'une longue inactivité. Il n'est pas possible de publier dessus.
Ce site n'utilise aucun cookie ni aucune technologie de suivi tierce. Nous pensons pouvoir faire mieux que les autres et nous nous soucions vraiment de votre vie privée.