<?php
defined ('_JEXEC') or  die('Direct Access to ' . basename (__FILE__) . ' is not allowed.');
/**
 * @package obGoodies
 * @subpackage modules
 *
 * @copyright (C) 2010-2016 The Foobla Team
 * @author Tung Pham
 * @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
 * www.foobla.com
 */

defined('DS') or define('DS', DIRECTORY_SEPARATOR);


$doc    = JFactory::getDocument();
# Add css to layout
$doc->addStyleSheet( JURI::root() . "modules/mod_obvm_filter_price/assets/css/jslider.css" );
# add_javascript
$doc->addScript( JURI::root() . "modules/mod_obvm_filter_price/assets/js/tmpl.js" );
$doc->addScript( JURI::root() . "modules/mod_obvm_filter_price/assets/js/jquery.dependClass-0.1.js" );
$doc->addScript( JURI::root() . "modules/mod_obvm_filter_price/assets/js/draggable-0.1.js" );
$doc->addScript( JURI::root() . "modules/mod_obvm_filter_price/assets/js/jquery.slider.js" );

if (!class_exists( 'VmConfig' )) require(JPATH_ROOT.DS.'administrator'.DS.'components'.DS.'com_virtuemart'.DS.'helpers'.DS.'config.php');

VmConfig::loadConfig ();
VmConfig::loadJLang ('mod_obvm_filter_price', true);
// Load the virtuemart main parse code
$mindata = intval ($params->get ('mindata', 3));
$maxdata = intval ($params->get ('maxdata', 20));
$price_arrange = vRequest::getVar ('price_arrange_obvm','');
if( $price_arrange!='' ){
	$price_array = explode(';', $price_arrange);
	$current_min_price = (int) $price_array[0];
	$current_max_price = (int) $price_array[1];
}else{
	$current_min_price = $mindata;
	$current_max_price = $maxdata;
}
$maxdata = $mindata > $maxdata ? $mindata : $maxdata;
$button_text = $params->get('button_text', 'Filter');
$set_Itemid = intval ($params->get ('set_itemid', 0));
$moduleclass_sfx = $params->get ('moduleclass_sfx', '');
$format_date = $params->get('format_date', 'Y-m-d H:i:s');
$date = JFactory::getDate();
$current_date = $date->format($format_date);
if ($params->get ('filter_category', 0)) {
	$category_id = vRequest::getInt ('virtuemart_category_id', 0);
} else {
	$category_id = 0;
}
require JModuleHelper::getLayoutPath ('mod_obvm_filter_price', $params->get('layout', 'default'));
echo vmJsApi::writeJS();
?>
