If all the required data is in the database, you can just use SQL to get the results out and display in whatever way you want, like putting pictures, adding buy buttons , adding add to cart etc.

But if you do not have any database with the products then you will have to write an app, which goes thru your sites static code and put it in the database in such a way that it can be searched by the users.

If you are planning to open a site for selling products, then you should go with the first approach, as thats how amazon/walmart does.