function onK2BeforeViewDisplay() { if ($this->getProcessFlag()) { $mainframe = JFactory::getApplication(); $params = JComponentHelper::getParams('com_k2mart'); $filters = array(); $ordering = JRequest::getVar('k2martOrdering', 'name'); $orderingDir = JRequest::getVar('k2martOrderingDir', 'asc'); $categories = JRequest::getVar('k2martCategories'); $manufacturers = JRequest::getVar('k2martManufacturers'); if ($params->get('sortingFilter')) { $options = array(); $options[] = JHTML::_('select.option', 'name', JText::_('K2MART_NAME')); $options[] = JHTML::_('select.option', 'sku', JText::_('K2MART_SKU')); $options[] = JHTML::_('select.option', 'price', JText::_('K2MART_PRICE')); $options[] = JHTML::_('select.option', 'sales', JText::_('K2MART_SALES')); $options[] = JHTML::_('select.option', 'hits', JText::_('K2MART_HITS')); $options[] = JHTML::_('select.option', 'date', JText::_('K2MART_DATE')); $filters['k2martOrdering'] = JHTML::_('select.genericlist', $options, 'k2martOrdering', 'class="k2martFilter"', 'value', 'text', $ordering); $options = array(); $options[] = JHTML::_('select.option', 'asc', JText::_('K2MART_ASCENDING')); $options[] = JHTML::_('select.option', 'desc', JText::_('K2MART_DESCENDING')); $filters['k2martOrderingDir'] = JHTML::_('select.genericlist', $options, 'k2martOrderingDir', 'class="k2martFilter"', 'value', 'text', $orderingDir); } else { $filters['k2martOrdering'] = false; } if ($params->get('manufacturersFilter')) { require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_k2mart' . DS . 'helpers' . DS . 'html.php'; $filters['k2martManufacturers'] = K2martHTMLHelper::getManufacturerFilter('k2martManufacturers[]', $manufacturers, 'class="k2martFilter" multiple="multiple" data-placeholder="' . JText::_('K2MART_CLICK_TO_SELECT_MANUFACTURERS') . '"'); } else { $filters['k2martManufacturers'] = false; } if ($params->get('categoriesFilter') && count($this->categories) > 1) { require_once JPATH_ADMINISTRATOR . DS . 'components' . DS . 'com_k2mart' . DS . 'helpers' . DS . 'html.php'; $filters['k2martCategories'] = K2martHTMLHelper::getCategoryFilter('k2martCategories[]', $categories, 'class="k2martFilter" multiple="multiple" data-placeholder="' . JText::_('K2MART_CLICK_TO_SELECT_CATEGORIES') . '"', $this->categories); } else { $filters['k2martCategories'] = false; } //Render ob_start(); include $this->getLayoutPath('filters'); $contents = ob_get_clean(); echo $contents; } }