Magento search catalog not working : Fixed


Magento catalog search broken not working

One day i have problem in magneto(version is 1.6) search. Its not work properly as i need.

So i have search in internet and i got code. I hope code will work.

Path app/code/core/mage/catalogsearch/block/result.php

step 1 ) Uncomment lines 149 and 150

$this->getListBlock()
->setCollection($this->_getProductCollection());

step 2 ) Modify the line 172

change this line
$this->_productCollection = $this->getListBlock()->getLoadedProductCollection();

to

$this->_productCollection = Mage::getSingleton(‘catalogsearch/layer’)->getProductCollection();

================================================================

when you will fix your code, goto the admin  panel (System -> Index Management) and select all the

Indexes > Pick action is “Reindex data” > and the press “submit” button.

And also one thing in admin panel is catalog search setting

Goto the System -> Config -> Catalog -> “Catalog Search”

Here, you can change your search type like, fulltext or both as you need.

Now goto the frontside and check i hope its work.

Advertisements

7 thoughts on “Magento search catalog not working : Fixed

  1. Hi,i go t error like Fatal error: Call to a member function getProductCollection() on a non-object in /app/code/core/Mage/CatalogSearch/Block/Result.php on line 172

    • Hi,
      Have you create a object of “Mage_CatalogSearch_Model_Layer” this class using magento’s static method “getSingleton”?

      Check below line.
      $this->_productCollection = Mage::getSingleton(‘catalogsearch/layer’)->getProductCollection();

      In above line you need to create a object Layer class in this class one method we need to call getProductCollection..

      I think you did not create a object of that class that’s why php gives you fatal error.

  2. i try to view my webpage and this is what i see i cant even log into the admin panel cos i get the same error…please help

    Warning: include_once(/home/content/42/11168442/html/errors/503.php) [function.include-once]: failed to open stream: No such file or directory in /home/content/42/11168442/html/index.php on line 65

    Warning: include_once() [function.include]: Failed opening ‘/home/content/42/11168442/html/errors/503.php’ for inclusion (include_path=’.:/usr/local/php5_3/lib/php’) in /home/content/42/11168442/html/index.php on line 65

    • Your message looks like you don’t have 503.php file in your errors folder root of magento.
      So first if you don’t have 503.php then you need to download new magento and put “503.php” file in your errors folder.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s