Page 1 of 1

Make EAN number searchable

Posted: Fri Aug 05, 2022 9:30 am
by 14Steve14
Phoenix version 1.0.7.10

I have had a quick search but could not find an answer.

I am using the GTIN PI module and was wondering if there is a way to make the output of the module on the products page show in the search results. Currently if you search for any GTIN number on the website no results are found yet lots of products use this data.

If its not possible it would mean adding the number into the product description text which will work, but will take time.

Re: Make EAN number searchable

Posted: Fri Aug 05, 2022 11:09 am
by 14Steve14
I may have found the answer to my own question after finding an old post on the old other website about the gtin numbers. Hopefully this is the right way of doing this. Hopefully someone will confirm.

In advanced_search_result.php change

Code: Select all

          $where_str .= "pd.products_name LIKE '%" . tep_db_input($keyword) . "%' OR p.products_model LIKE '%" . tep_db_input($keyword) . "%' OR m.manufacturers_name LIKE '%" . tep_db_input($keyword) . "%'";
to

Code: Select all

          $where_str .= "pd.products_name like '%" . tep_db_input($keyword) . "%' or p.products_model LIKE '%" . tep_db_input($keyword) . "%' OR p.products_gtin LIKE '%" . tep_db_input($keyword) . "%' OR m.manufacturers_name LIKE '%" . tep_db_input($keyword) . "%'";

Re: Make EAN number searchable

Posted: Fri Aug 05, 2022 11:39 am
by raiwa
You can do this in a siteWide hook. See this thread:
https://phoenixcart.org/forum/viewtopi ... =25&t=1474

The last message shows the code which should also fit your needs.

Re: Make EAN number searchable

Posted: Sun Aug 07, 2022 8:21 am
by 14Steve14
raiwa wrote: Fri Aug 05, 2022 11:39 am You can do this in a siteWide hook. See this thread:
https://phoenixcart.org/forum/viewtopi ... =25&t=1474

The last message shows the code which should also fit your needs.
Cheers raiwa.

I will look into this siteWide hook for the latest test site I am creating. On my old site the change works so for now will be left.

Re: Make EAN number searchable

Posted: Sun Aug 07, 2022 10:05 am
by burt
Another way would be to put the EAN number into the "keywords" input box [when adding/editing a product], then turn on keyword searching [ admin > modules > header tags > "product seo" > "enable keyword search" = true.

If you have loads of product that you would need to update (ie adding the EAN to the keywords input tag), then the method above advised by raiwa is the better option.