
Navigate to file view.phtml
app/design/frontend/your-package/your-theme/template/catalog/layer/view.phtml
Remove all file code with the following code
<?php
// get current price filter and set his value in price box
if(isset($_GET['price'])):
$orignalprice = $_GET['price'];
$exploadprice = explode("-",$orignalprice);
$firstboxvalue = $exploadprice[0];
$secondboxvalue = $exploadprice[1];
endif;
?>
<?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 href="<?php echo $this->getClearUrl() ?>"><?php echo $this->__('Clear All') ?></a></div>
<?php endif; ?>
<?php if($this->canShowOptions()):?>
<p class="block-subtitle"><?php echo $this->__('Shopping Options') ?></p>
<dl id="narrow-by-list">
<?php $_filters = $this->getFilters() ?>
<?php foreach ($_filters as $_filter): ?>
<?php
// get display attribute code
$attributeModel = $_filter->getAttributeModel();
if($attributeModel) {
$attr_code = $attributeModel->getAttributeCode();
}
?>
<?php if($_filter->getItemsCount()){ ?>
<dt><?php echo $this->__($_filter->getName()) ?></dt>
<!--<dt><?php /*echo ($this->__($_filter->getName()) == 'Category' ? 'Category': $this->__($_filter->getName())) */?></dt>-->
<!--<dd><?php /*echo $_filter->getHtml() */?></dd>-->
<dd>
<?php
// check if price attribute found that time add custom price filter
echo ($this->__($attr_code) == 'price' ? '
'.$this->__($_filter->getHtml()).
'<div class="filtermaindiv">'.str_replace('.','',$strcurrfirst).'
<input id="filterformprice" class="filterformprice" type="text" name="filterformprice" value="'.$firstboxvalue.'">
<span class="filtertoclass">'.$this->__("To").'</span>'.
str_replace('0','',$strcurrsecond).'
<input id="filtertoprice" class="filtertoprice" type="text" name="filtertoprice" value="'.$secondboxvalue.'">
<button id="filterbtn" name="filterbtn" class="button" type="button"><span><span>'.$this->__("Go").'</span></span></button></div>
': $this->__($_filter->getHtml()))
?>
</dd>
<?php } else {
// add custom else part and add price filter. this part display when price filter is active.
if($attr_code == 'price'){?>
<dt><?php echo $this->__('Price'); ?></dt>
<dd>
<div class="filtermaindiv">
<?php $curr=Mage::helper('core')->currency(''); $curr1=str_replace('0','',$curr); echo str_replace('.','',$curr1);?>
<input id="filterformprice" class="filterformprice" type="text" name="filterformprice" value="<?php echo ($firstboxvalue != '' ? $firstboxvalue: '');?>">
<span class="filtertoclass"><?php echo $this->__('To');?></span>
<?php $curr=Mage::helper('core')->currency('');$curr1=str_replace('.','',$curr); echo str_replace('0','',$curr1);?>
<input id="filtertoprice" class="filtertoprice" type="text" name="filtertoprice" value="<?php echo ($secondboxvalue != '' ? $secondboxvalue: '');?>">
<button id="filterbtn" name="filterbtn" class="button" type="button">
<span><span><?php echo $this->__('Go');?></span></span>
</button>
</div>
</dd>
<?php }
} ?>
<?php endforeach; ?>
</dl>
<script type="text/javascript">decorateDataList('narrow-by-list')</script>
<?php
else:
// add custom price filter part when all attribute disable that time display.
?>
<p class="block-subtitle"><?php echo $this->__('Shopping Options') ?></p>
<dl id="narrow-by-list">
<dt><?php echo $this->__('Price'); ?></dt>
<dd>
<div class="filtermaindiv">
<?php $curr=Mage::helper('core')->currency(''); $curr1=str_replace('0','',$curr); echo str_replace('.','',$curr1);?>
<input id="filterformprice" class="filterformprice" type="text" name="filterformprice" value="<?php echo ($firstboxvalue != '' ? $firstboxvalue: '');?>">
<span class="filtertoclass"><?php echo $this->__('To');?></span>
<?php $curr=Mage::helper('core')->currency('');$curr1=str_replace('.','',$curr); echo str_replace('0','',$curr1);?>
<input id="filtertoprice" class="filtertoprice" type="text" name="filtertoprice" value="<?php echo ($secondboxvalue != '' ? $secondboxvalue: '');?>">
<button id="filterbtn" name="filterbtn" class="button" type="button">
<span><span><?php echo $this->__('Go');?></span></span>
</button>
</div>
</dd>
</dl>
<?php endif; ?>
<?php
// get current page url for price filter
$customfilterbaseurlcheck = $this->helper('core/url')->getCurrentUrl();
// check if price attribute set so delete attribute and create new url
list($file, $parameters) = explode('?', $customfilterbaseurlcheck);
parse_str($parameters, $output);
unset($output['price']); // remove the make parameter
$customfilterbaseurl = $file . '?' . http_build_query($output); // Rebuild the url
// pass custom parameter and url in main url
$finalfilterurl = $customfilterbaseurl."&";
?>
<script type="text/javascript">
// prototype js to on click go button that time load url
$('filterbtn').observe('click', function() {
var filterformprice = $('filterformprice').getValue();
var filtertoprice = $('filtertoprice').getValue();
// check validation not blank.
if(filterformprice != "" || filtertoprice != ""){
window.location.href = "<?php echo $finalfilterurl;?>price="+filterformprice+"-"+filtertoprice;
}
});
</script>
</div>
</div>
<?php endif; ?>
![]()
0 Comments