Jump to content

Search by product ID


Recommended Posts

I think you need some add one more filed to indicate it is search by product id or not.
others wise, you don't know if user input is a product id or name or anything else.

you can modify the "Quick Search block" module which is located in

YourSiteRoot/modules/blocksearch/

Link to comment
Share on other sites

it depends what version of your PrestaShop, slightly different.
Because search by product ID usually only hit one record.
So you will need write a simple SQL to get the record you want and return it, here is

So based on the select of search by on UI, if it is search by ID, then use following SQL to retrieve

SELECT *  FROM `'._DB_PREFIX_.'product` where id_product = X



where X is user input ID to search

if not search by ID, then use default way

Link to comment
Share on other sites

Thanks shokinro, I am actually looking a solution to integrate this function to current search system (search.php) because as far as I understand that blocksearch used search.php file from default system.

Link to comment
Share on other sites

  • 2 years later...
  • 1 year later...
  • 1 year later...
×
×
  • Create New...