Magento add checkbox and searchbox in Layer Filter

1)Replace the below code in files app/design/frontend/{yourtheme}/default/template/catalog/layer/view.phtml

<?php if($this->canShowBlock()): ?>
<div class="block block-layered-nav">
<div class="block-title">
<strong><span><?php echo $this->__('Shop By') ?></span></strong></div>
<div class="block-content">
<?php echo $this->getStateHtml() ?>
<?php if ($this->getLayer()->getState()->getFilters()): ?>
<div class="actions"><a class="btn btn-default" href="<?php echo $this->getClearUrl() ?>"><i class="icon-trash"></i><?php echo $this->__('Clear All') ?></a></div>
<?php endif;?>
<?php if( $this->canShowOptions()): ?>

<?php echo $this->__('Shopping Options') ?>
<dl id="narrow-by-list" class="clearfix">
<?php $_filters = $this->getFilters() ?>
<?php foreach ($_filters as $_filter): ?>
<?php if($_filter->getItemsCount()): ?>
<dt><?php echo $this->__($_filter->getName()) ?></dt>

<dd<?php echo ($this->__($_filter->getName()) == $this->__('Category') ? ' class="category-filter"' : ''); ?>>
<?php if($this->__($_filter->getName())!= $this->__('Price') ):?>
<input type="text" placeholder="<?php echo $this->__('Search for option'); ?>" class="quick-search form-control" />
<?php endif;?>
<?php echo $_filter->getHtml() ?>
</dd>

<?php endif; ?>
<?php endforeach; ?>
</dl>

<script type="text/javascript">
 decorateDataList('narrow-by-list');
 </script>
<?php endif; ?></div>
</div>
<?php endif; ?>

<script type="text/javascript">
jQuery(document).ready(function(){
jQuery(document).on('change','.ccheckbox', function() {
 jQuery(this).siblings('a').trigger("click");
 });
 jQuery(document).on('keyup','.quick-search',function(){
if(jQuery(this).val() != ''){
//alert('');
 var term = jQuery(this).val();
term = term.toLowerCase();
 jQuery(this).siblings('ol').find('li').each(function(){
 if( jQuery(this).find('a').text().toLowerCase().indexOf(term) >= 0 ){
 jQuery(this).show();
 } else {
 jQuery(this).hide();
 }
 });
}else{
jQuery(this).siblings('ol').find('li').each(function(){ 
 jQuery(this).show();
 });}
 });
 
});
 </script>

2)  Add below code in file /app/design/frontend/{yourtheme}/default/template/catalog/layer/filter.phtml

<ol>
<?php $selection = FALSE; $items = $this->getItems();
foreach ($this->getItems() as $_item)
{
if ($_item->isSelected())
{
$selection = TRUE;
$removal_url=$_item->getRemoveUrl();
break;
}
}
?>

<?php foreach ($this->getItems() as $_item): ?>
<?php $code =$_item->getFilter()->getAttributeModel()->getAttributeCode();
if($code !="price") {
$lable = $_item->getLabel();
}else{
$lable = '';
}

?>
	<li label="<?php echo $lable ?>">
<?php if( $_item->isSelected() ) : ?>
<input class="ccheckbox" type="checkbox" checked/>
<a style="color: #D96708" class="multi-select isselected" href="<?php echo $removal_url ?>">
<?php echo $_item->getLabel() ?></a>
<?php else : ?>
<input type="checkbox" class="ccheckbox"/>
<a style="color: #666633" class="multi-select unselected" href="<?php echo $this->urlEscape($_item->getUrl()) ?>">
<?php echo $_item->getLabel() ?></a>
<?php endif; ?></li>
<?php endforeach ?></ol>

3) Replace below line in file app/code/core/Mage/Catalog/Model/Resource/Layer/Filter/Attribute.php


// $tableAlias = $attribute->getAttributeCode() . '_idx';
$tableAlias = $attribute->getAttributeCode() . '_idx_'.$value;

4)  Comment below line in file app/code/core/Mage/Catalog/Model/Layer/Filter/Attribute.php

// $this->_items = array(); Line 96

5) Add below function in file app/code/core/Mage/Catalog/Model/Layer/Filter/Item.php


public function isSelected(){
$selected = Mage::getSingleton('core/app')->getRequest()->getParam($this->getFilter()->getRequestVar());

if($selected == $this->getValue()){
return true;
}else{
return false;
}
}

 

Git Command

Create from existing project


git remote add origin "url"

git push -u origin master

 

Fetch files  from repository

git pull origin master

Replace local files

git fetch -all

Add single file on git


git add 'filename'

git commit -m "Add testing file"

git push

LF will be replaced by CRLF Error while adding file.

git config --global core.autocrlf false