Решил поделиться своим решением на базе скрипта
http://egorkhmelev.github.io/jslider/. Версия компонента 3.16.1, модуля - 3.4.1:
1. Создаем папку modules/mod_jshopping_filters/javascript/. Размещаем там javascript файлы плагина.
2. Создаем папку modules/mod_jshopping_filters/css/. Размещаем там файл jslider.css плагина.
3. Создаем папку modules/mod_jshopping_filters/images/. Размещаем там спрайт-изображение плагина.
4. Подключаем скрипты и CSS в файле modules/mod_jshopping_filters/mod_jshopping_filters.php:
$doc =& JFactory::getDocument();
$doc->addScript( "../modules/mod_jshopping_filters/javascript/jshashtable.js" );
$doc->addScript( "../modules/mod_jshopping_filters/javascript/numberformatter.js" );
$doc->addScript( "../modules/mod_jshopping_filters/javascript/tmpl.js" );
$doc->addScript( "../modules/mod_jshopping_filters/javascript/dependClass.js" );
$doc->addScript( "../modules/mod_jshopping_filters/javascript/draggable.js" );
$doc->addScript( "../modules/mod_jshopping_filters/javascript/slider.js" );
$doc->addStyleSheet( "../modules/mod_jshopping_filters/css/jslider.css" );
5. Для получения минимального и максимального значения цены открываем файл components/com_jshopping/lib/functions.php и добавляем функцию:
function getCatMinMaxProductPrice($cat){
$db = &JFactory::getDBO();
$query = "SELECT max(product_price) as max_product_price, min(product_price) as min_product_price FROM `#__jshopping_products` WHERE product_id=any(SELECT product_id FROM `#__jshopping_products_to_categories` WHERE category_id = ".$cat.") and product_price>0";
$db->setQuery($query);
$max_min_Price = $db->loadAssoc();
return $max_min_Price;
}
6.В файле шаблона вывода modules/mod_jshopping_filters/tmpl/default.php добавляем:
- в начале файла:
<?php
//MinMaxProductPrice
$min_product_price = (int)$MinMaxProductPrice[min_product_price];
$max_product_price = (int)$MinMaxProductPrice[max_product_price];
?>
- меняем код:
<?php if ($show_prices){?>
<span class="filter_price"><?php print JText::_('PRICE')?>:<br/>
<span class="box_price_from"><?php print JText::_('FROM')?> <input type = "text" class = "inputbox" name = "fprice_from" id="fprice_from" size="7" value="<?php if ($fprice_from>0) print $fprice_from?>" /></span>
<span class="box_price_to"><?php print JText::_('TO')?> <input type = "text" class = "inputbox" name = "fprice_to" id="fprice_to" size="7" value="<?php if ($fprice_to>0) print $fprice_to?>" /></span>
<?php print $jshopConfig->currency_code?>
</span>
<input type="submit" class="button" value="<?php print JText::_('GO')?>">
<span class="clear_filter"><a href="#" onclick="modFilterclearPriceFilter();return false;"><?php print JText::_('RESET FILTER')?></a></span>
<?php }?>
на:
<?php if ($show_prices){?>
<?php if ($max_product_price != 0){?>
<div class="layout-slider">
<input style="display: none;" id="slider" type="slider" name="price" value="<?php if ($fprice_from > 0) echo $fprice_from; elseif ($fprice_from=="") echo $min_product_price; ?>;<?php if ($fprice_to > 0) echo $fprice_to; elseif ($fprice_to=="") echo $max_product_price; ?>" />
</div>
<span class="filter_price"><?php print JText::_('PRICE')?>:<br/>
<span class="box_price_from"><?php print JText::_('FROM')?>
<input type="text" class="inputbox" name="fprice_from" id="fprice_from" size="7" value="<?php if ($fprice_from > 0) echo $fprice_from; elseif ($fprice_from=="") echo $min_product_price; ?>" />
</span>
<span class="box_price_to"><?php print JText::_('TO')?> <input type="text" class="inputbox" name="fprice_to" id="fprice_to" size="7" value="<?php if ($fprice_to > 0) echo $fprice_to; elseif ($fprice_to=="") echo $max_product_price; ?>" />
</span>
<?php print $jshopConfig->currency_code?>
</span>
<input id = "jshop_filters" type="submit" class="button" value="<?php print JText::_('GO')?>">
<span class="clear_filter"><!--<a href="#" onclick="modFilterclearPriceFilter();return false;">--><a href="#" onclick="ClearFilter();"><?php print JText::_('RESET FILTER')?></a></span>
<?php }?>
<?php }?>
В конце файла добавляем javascript:
<script type="text/javascript" charset="utf-8">
var min_product_price = <?php echo $min_product_price; ?>;
var max_product_price = <?php echo $max_product_price; ?>;
jQuery("#slider").slider({
from: <?php echo $min_product_price; ?>,
to: <?php echo $max_product_price; ?>,
step: 100,
smooth: true,
round: 0,
skin: "plastic",
onstatechange: function(value){
var values = value.split(';',2);
if (values[0] > min_product_price) {
jQuery("input#fprice_from").val(values[0]);
} else {
jQuery("input#fprice_from").val(<?php echo $min_product_price; ?>);
}
if (values[1] < max_product_price) {
jQuery("input#fprice_to").val(values[1]);
} else {
jQuery("input#fprice_to").val(<?php echo $max_product_price; ?>);
}
},
callback: function(){
jQuery("input#fprice_from").change();
}
});
function ClearFilter(){
jQuery("#fprice_from").val("");
jQuery("#fprice_to").val("");
document.jshop_filters.submit();
}
</script>
У меня работает...