Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

Redirecting to product page if only one search result.


Recommended Posts

I've search for this, but only found one post where no one had replied :(


It would seem logical that if you searched for something and there was only one product that matched, it would redirect you straight to the product info instead of having to wait for the search results page to load and then clicking another link to get to the info.


I've done some research and have figured you need a header(location=<url>) function in the code, so you would have to call this after getting for product url from the database, but by that time, you have already echoed the header and get an error as the header function must be called before outputing anything.


I have come to the conclusion that you would have to merge the advanced_search_results and modules/product_listing file and then rearrange these so that you can call the header function before output is made? However, doing it this way would first show the url of advanced_search_results in the address bar before redirection?


Also read something on Apache FORCETYPE...is this relavent? Am I way off? Anyone got a working solution? PLEASE!! :)


amazon.com and buy.com both have working examples of redirection without a results page being shown for one unique search result.


Hope that all makes sense!! :) Thanks for your help.

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...