0

I set up multiple websites (parked domain method) and the default website works perfectly. However, when I test the second website. The search function is not working, it always redirect into the current page without loading the search result(Eg. If I click search at the homepage it will go homepage or if I click search at the about us page then it will go to about us page)

I used Magento1.9.2.4 free template from template monster. This template uses cmsmart extension for doing the search. There are two kinds of search method. One is typing the keyword in the input text box and clicking the search button(This one works), the other is selecting the category type in the select box and then clicking the search button.(This one doesn't work)

The domain name we used is as following:

www.aricare.com.au(working one with the search) www.shavingclub.com.au(not working one with the search when selecting the category from the select box and then clicking the search button)

Is it a redirect issue? I tried .htaccess and index.php separately but still can't fix the issue. (everything works fine except the second website's ajax search function) -------------------------------------------------- ------- .htaccess setting

RewriteBase /welcome/ RewriteCond %{HTTP_HOST} ^(.*)shavingclub.com.au RewriteRule ^ - [E=MAGE_RUN_CODE:shavingclub] -------------------------------------------------- ------- index.php

switch($_SERVER['HTTP_HOST']) {

// shavingclub.com.au case 'shavingclub.com.au': case 'www.shavingclub.com.au': Mage::run('shavingclub', 'website'); break;

// Mainstore.com (default store) default: Mage::run($mageRunCode, $mageRunType); break; }

Will it be a parameter lost issue? When I search at the default website, the url will be sth like "http://www.aricare.com.au/welcome/catalogsearch/result/?search_categories[]=103&q=" However, when I search at the second website the above url is not showing in the browser.

PLZ HELP. Thank you in advance.

  • 2nd method is from the theme? – AleGrinGo Jun 8 '16 at 3:07
  • Yes,use the same theme as the main website – Disheng Jun 8 '16 at 3:28
  • The second website is using the same theme as the main website and the both of the search methods are from the theme – Disheng Jun 8 '16 at 3:37
  • I just tested the search functionality and is working for me... here is the url result. shavingclub.com.au/welcome/catalogsearch/result/… – AleGrinGo Jun 8 '16 at 3:49
  • Yep, I typed "pace" after the suggestion show ups i just wait to suggestion hide then click on men category > search button. – AleGrinGo Jun 8 '16 at 3:52
0

@Disheng,

I just review the flow of catalogsearch/result action page, and I 100% sure if you try to search with a "empty" query_text (q=[empty]) you will be redirect to the current page you are (behavior you are getting in the second website).

public function indexAction()
{
    $query = Mage::helper('catalogsearch')->getQuery();
    /* @var $query Mage_CatalogSearch_Model_Query */

    $query->setStoreId(Mage::app()->getStore()->getId());

    if ($query->getQueryText() != '') { //your q is empty so
    ...... 
    } else {
        $this->_redirectReferer(); // you are redirect to current page
    }

So Please check under you admin section or theme configuration if under the System > Configuration > Catalog > Catalog > Catalog Search you can change something and make the same configuration to the other site.

I try to create a empty query under Catalog > Search Terms but was impossible, you can't create a empty query_text.

Hope all this information can help to configure your second site.

Best, Alejandro.

0

Finally fixed the problem. Thank you, GrinGo. This problem is because of the getQueryText() is '' as GrinGo mentioned. However the solution is very strange. Comment out the above redirect code will make the search works. But it is not good to change the Magento core code. To fix the problem, get rid of the records from catalogsearch_query table and catalogsearch_result table manually (delete * from catalogsearch_query -_-! ) and then create a new query record related to the website's category. Change the value of the synonym_for column from null to empty (just untick the null value in the catalogsearch_query table).

Notice: null value of the synonym_for column stop the search functions of cmsmart extension. It could be the bug from cmsmart extension or from Magento. cheers!

  • Glad to here that, please mark answer as correct so the question can be closed – AleGrinGo Jun 10 '16 at 23:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.