Skip to main content

Posts

Showing posts from October, 2016

Display all categories and sub categories on left sidebar in Magento

You can display list of all categories and subcategories in left sidebar including product view page using the following code in Magento. You can display subcategories upto second level using this code. You can create a new file for this code and you can add it in your theme’s catalog XML file like this: <block type="catalog/navigation" name="catalog.leftnav" template="catalog/navigation/my_left_nav.phtml" /> It should be placed inside the reference name “ left “, to show it in the left sidebar. I hope you know all these stuffs. Let’s get to the point. Just copy and paste the code in the  my_left_nav.phtml,  which should be in your theme’s  catalog/navigation folder.   <!-- List all categories and their second level subcategories --> <div class="block block-list block-categories"> <div id="block-categories" class="block-title active"> <strong><span>Categories </span

find rewrite modules

Paste below code magento root folder in one test.php file and run in browser <?php require 'app/Mage.php'; Mage::app(); echo "<pre/>"; print_r(Mage::getConfig()->getNode()->xpath('//global//rewrite'));

exact match search in with any name or meta key words etc

Magento/code/core/Mage/Catalogsearch/Block/Result copy this file into local folder and find this function   protected function _getProductCollection() and edit like below I am doing search like exact match with name and meta key words  protected function _getProductCollection()     {         if (is_null($this->_productCollection)) {         $serchQuery = str_replace('+', " ", Mage::app()->getRequest()->getParam('q'));         $collection = Mage::getModel("catalog/product")->getCollection()->addAttributeToSelect('*')                 ->addAttributeToFilter(array(                     array('attribute'=>'name','like' => '%' . $serchQuery . '%'),                     array('attribute'=>'meta_keyword','like' => '%' . $serchQuery . '%'),                 ));             $this->_productCollection = $collection; //            $this-&g