Make EAN number searchable

Open to all! Ask other shopowners for help.
Post Reply
14Steve14
Senior Contributor
Posts: 923
Joined: Fri Oct 25, 2019 7:01 pm
Phoenix Version: v1.0.9.1
Has thanked: 17 times
Been thanked: 103 times

Make EAN number searchable

Post 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.


Join The Code Co-op to get access to your library in the Code Co-op Forum
14Steve14
Senior Contributor
Posts: 923
Joined: Fri Oct 25, 2019 7:01 pm
Phoenix Version: v1.0.9.1
Has thanked: 17 times
Been thanked: 103 times

Re: Make EAN number searchable

Post 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) . "%'";
raiwa
Certified Developer
Posts: 1640
Joined: Sat Dec 21, 2019 8:08 am
Phoenix Version: 1.1.0.6
Has thanked: 70 times
Been thanked: 152 times

Re: Make EAN number searchable

Post 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.
Public Phoenix Change Log Cheat Set on Google Sheets
https://docs.google.com/spreadsheets/d/ ... sp=sharing

Need Help?viewtopic.php?f=10&t=27
14Steve14
Senior Contributor
Posts: 923
Joined: Fri Oct 25, 2019 7:01 pm
Phoenix Version: v1.0.9.1
Has thanked: 17 times
Been thanked: 103 times

Re: Make EAN number searchable

Post 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.
User avatar
burt
Core Team
Posts: 4551
Joined: Tue Oct 29, 2019 9:37 am
Phoenix Version: v1.1.0.8
Has thanked: 252 times
Been thanked: 412 times

Re: Make EAN number searchable

Post 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.
I am not here to build for you.
I am here to build with you. Let's help each other.


Join The Code Co-op to get access to your library in the Code Co-op Forum
Post Reply