sulman
sulman

Reputation: 2461

Magento Redirect search query result page to different page

My Magento setup has one main category ("Products") and all other catgories under it.

This causes issues with the search as the results just show "refine by category 'Products'". But I want the full category list to be expanded without clicking

If I click on the refine by Products it then brings the full category listing. In doing this is changes the URL to include the category ID.

Current way (not expanded):

http://example.com/catalogsearch/result/?q=bike

What I need:

http://example.com/catalogsearch/result/index/?cat=4&q=bike

I've tried to do this via htaccess rewrite rules like so:

RewriteCond %{QUERY_STRING} ^q=bike$ 
RewriteRule ^/catalogsearch/result/index/?cat=4 [R=QSA]

But It doesn't work.

Any ideas how I can acheive this?

Thanks

Upvotes: 1

Views: 1243

Answers (1)

Rehan Mobin
Rehan Mobin

Reputation: 552

Why you trying to do this with .htaccess while this could be achieved in very simple way. Open catalogsearch/orm.mini.phtml and just add after the form tag start.

<input id="cat" type="hidden" value="insert_your_category_id_here" name="cat" />

Upvotes: 1

Related Questions