Лучший Ответ Sandmansss , 01 March 2019 - 13:37
Сам спросил - сам ответил.
Нашел схожее решение - http://forum.jbzoo.c...ории#entry60072
Сделал незначительные изменения
сайт\media\zoo\applications\jbuniversal\config\mod_jbzoo_search\itemcategory.xml
Заменяем на
<?xml version="1.0" encoding="utf-8"?>
<!--
JBZoo App is universal Joomla CCK, application for YooTheme Zoo component
@package jbzoo
@version 2.x Pro
@author JBZoo App http://jbzoo.com
@copyright Copyright (C) JBZoo.com, All rights reserved.
@license http://jbzoo.com/license-pro.php JBZoo Licence
@coder Denis Smetannikov <denis@jbzoo.com>
-->
<element>
<params group="render">
<param name="jbzoo_filter_render"
type="list"
label="JBZOO_ELEMENT_TEMPLATE"
description="JBZOO_ELEMENT_TEMPLATE_DESC"
default="_auto_"
>
<option value="_auto_">JBZOO_ELEMENT_TEMPLATE_AUTO</option>
<option value="category">JBZOO_ELEMENT_TEMPLATE_CATEGORIES</option>
<option value="category-chosen">JBZOO_ELEMENT_TEMPLATE_CATEGORIES_CHOSEN</option>
<option value="category-hidden">JBZOO_ELEMENT_TEMPLATE_CATEGORY_HIDDEN</option>
<option value="hidden">JBZOO_ELEMENT_TEMPLATE_HIDDEN</option>
</param>
<param name="jbzoo_filter_default"
type="text"
default=""
label="JBZOO_FILTER_DEFAULT"
description="JBZOO_FILTER_DEFAULT_DESC"
/>
<param name="jbzoo_category_mode"
type="list"
default="tree"
label="JBZOO_FILTER_CATEGORY_MODE"
description="JBZOO_FILTER_CATEGORY_MODE_DESC">
<option value="none">JBZOO_FILTER_NONE</option>
<option value="tree">JBZOO_FILTER_TREE</option>
<option value="parent">JBZOO_FILTER_ONLY_PARENT</option>
<option value="child">JBZOO_FILTER_ONLY_CHILD</option>
<option value="child_off_category">Дочерние категории родительской</option>
</param>
<param name="jbzoo_filter_multiple"
type="jbbool"
default="0"
label="JBZOO_FILTER_MULTIPLE"
description="JBZOO_FILTER_MULTIPLE_DESC"/>
<param name="jbzoo_filter_count"
type="jbbool"
default="1"
label="JBZOO_FILTER_COUNT"
description="JBZOO_FILTER_COUNT_DESC"/>
<param name="jbzoo_filter_placeholder"
type="text"
default=""
label="JBZOO_FILTER_PLACEHOLDER"
description="JBZOO_FILTER_PLACEHOLDER_DESC"
/>
</params>
</element>
Далее в
сайт\media\zoo\applications\jbuniversal\framework\render\filter\element.category.php
Заменяем на
<?php
/**
* JBZoo App is universal Joomla CCK, application for YooTheme Zoo component
*
* @package jbzoo
* @version 2.x Pro
* @author JBZoo App http://jbzoo.com
* @copyright Copyright (C) JBZoo.com, All rights reserved.
* @license http://jbzoo.com/license-pro.php JBZoo Licence
* @coder Denis Smetannikov <denis@jbzoo.com>
*/
// no direct access
defined('_JEXEC') or die('Restricted access');
/**
* Class JBFilterElementCategory
*/
class JBFilterElementCategory extends JBFilterElement
{
/**
* Render HTML
* @return string
*/
function html()
{
$values = $this->_getValues();
return $this->app->jbhtml->select(
$this->_createOptionsList($values),
$this->_getName(),
$this->_attrs,
$this->_value,
$this->_getId()
);
}
/**
* Get categories list
* @return array
*/
private function _getCategoriesList()
{
$applicationId = (int)$this->_params->get('item_application_id', 0);
$application = $this->app->table->application->get($applicationId);
$modeParam = $this->_params->get('jbzoo_category_mode', 'tree');
$allCategories = array();
if ($application) {
$allCategories = $application->getCategories(true);
}
$result = array();
if (empty($allCategories)) {
return $result;
}
if ($modeParam == 'parent') {
// only parents
foreach ($allCategories as $category) {
if (!$category->parent) {
$result[] = $category;
}
}
} elseif ($modeParam == 'child') {
// only childs
foreach ($allCategories as $category) {
if ($category->parent) {
$result[] = $category;
}
}
} elseif ($modeParam == 'tree') {
// tree view
$result = $this->app->tree->buildList(0, $this->app->tree->build($allCategories, 'Category'));
} elseif ($modeParam == 'child_off_category') {
$parentCategoryId = (int)$this->app->jbrequest->getSystem('category');
$parentCategory = $this->app->table->category->get($parentCategoryId);
$categoryId = $this->app->jbrequest->getSystem('category');
if ($parentCategory) {
$children = $parentCategory->getChildren();
if ($children) {
foreach ($children as $child) {
$result[] = $child;
}
}
}
} else {
$result = $allCategories;
}
return $result;
}
/**
* Get categories list values
* @param null $type
* @return array
*/
protected function _getValues($type = null)
{
$catList = $this->_getCategoriesList();
$catValues = $this->_getDbValues();
$categoriesList = array();
foreach ($catList as $category) {
$found = false;
foreach ($catValues as $catValue) {
if ($catValue['value'] == $category->name) {
$category->countItems = $catValue['count'];
$categoriesList[] = $category;
$found = true;
break;
}
}
if (!$found) {
$category->countItems = 0;
$categoriesList[] = $category;
}
}
$modeParam = $this->_params->get('jbzoo_category_mode', 'tree');
$options = array();
foreach ($categoriesList as $category) {
if ($modeParam == 'tree') {
$options[] = array(
'value' => $category->id,
'text' => ' ' . $category->treename,
'count' => $this->_isCountShow ? $category->countItems : null,
);
} else {
$options[] = array(
'value' => $category->id,
'text' => $category->name,
'count' => $this->_isCountShow ? $category->countItems : null,
);
}
}
return $options;
}
/**
* @param $value
* @return mixed
*/
protected function _getElementValue($value)
{
if ($this->_isValueEmpty($value)) {
$value = $this->app->jbrequest->getSystem('category');
}
return parent::_getElementValue($value);
}
}
Собственно все изменение заключалось в строчке
$parentCategoryId = (int)$this->_params->get('jbzoo_parent_category_id', 0);
Заменил на
$parentCategoryId = (int)$this->app->jbrequest->getSystem('category')
Перейти к сообщению










