Интернет - магазин
wildthing писал(а):
Можно попробывать в коде тип. дин. страницы вместо кода:
использовать:
Тогда в списке производителей будут только производители товаров текущей группы и товаров всех ее подгрупп.
Все время передает полній список производителей
- я вам уже объяснила причину: в метод ShowShop в качестве текущей группы передано false, поэтому производители выбираются из всех групп. Можно попробывать в коде тип. дин. страницы вместо кода:
$mas_group = array();
$mas_group = $GLOBALS['shop']->GetGroupsTree($GLOBALS['shop_item_path']['group'], $current_shop_id, $mas_group);
$set = array();
$set = SetGroups($mas_group, $set);
$elements = array();
$in = $GLOBALS['shop_item_path']['group'];
foreach ($set as $key => $value)
{
$in .= ','.$value;
}
$elements['type']=0;
$elements['prefix'] = ' and (';
$elements['name'] = 'shop_items_catalog_table.shop_groups_id';
$elements['if'] = ' IN ('.$in.') ';
$elements['value'] = '';
$elements['sufix']=')';
$param['select'][]=$elements;
$param['current_group_id']=false;
$mas_group = $GLOBALS['shop']->GetGroupsTree($GLOBALS['shop_item_path']['group'], $current_shop_id, $mas_group);
$set = array();
$set = SetGroups($mas_group, $set);
$elements = array();
$in = $GLOBALS['shop_item_path']['group'];
foreach ($set as $key => $value)
{
$in .= ','.$value;
}
$elements['type']=0;
$elements['prefix'] = ' and (';
$elements['name'] = 'shop_items_catalog_table.shop_groups_id';
$elements['if'] = ' IN ('.$in.') ';
$elements['value'] = '';
$elements['sufix']=')';
$param['select'][]=$elements;
$param['current_group_id']=false;
использовать:
$mas_group = array();
$mas_group = $GLOBALS['shop']->GetGroupsTree($GLOBALS['shop_item_path']['group'],
$current_shop_id, $mas_group);
$set = array();
$set = SetGroups($mas_group, $set);
$elements = array();
$param['current_group_id'] = array();
$param['current_group_id'][] = $GLOBALS['shop_item_path']['group'];
foreach ($set as $key => $value)
{
$param['current_group_id'][] = $value;
}
$mas_group = $GLOBALS['shop']->GetGroupsTree($GLOBALS['shop_item_path']['group'],
$current_shop_id, $mas_group);
$set = array();
$set = SetGroups($mas_group, $set);
$elements = array();
$param['current_group_id'] = array();
$param['current_group_id'][] = $GLOBALS['shop_item_path']['group'];
foreach ($set as $key => $value)
{
$param['current_group_id'][] = $value;
}
Тогда в списке производителей будут только производители товаров текущей группы и товаров всех ее подгрупп.
Ребята сделайте подарок на ДР как в шаблоне ограничить производителей которые используются в данной группе ... подгруппе всю ночь вчера сидел так и не смог ничего придумать
<?
function SetGroups($mas_groups, $set)
{
$mas_groups = to_array($mas_groups);
foreach ($mas_groups as $key=>$value)
{
foreach ($value as $key1=>$value1)
{
$set[] = $value1['shop_groups_id'];
if ($value1['shop_groups_id'] == $key)
{
$set[] = $key;
SetGroups($mas_groups, $set);
}
}
}
return $set;
}
$xsl_catalog = to_str($GLOBALS['LA']['xsl_catalog']);
$xsl_item = to_str($GLOBALS['LA']['xsl_item']);
$current_shop_id = to_int($GLOBALS['LA']['shop_id']);
$param = array();
$shop = & singleton('shop');
if ($GLOBALS['shop_item_path'] != false)
{
if (class_exists("SiteUsers"))
{
/* Получаем id текущего пользователя сайта */
$SiteUsers = & singleton('SiteUsers');
$param['user_id'] = $SiteUsers->GetCurrentSiteUser();
}
$external_propertys = array();
if (isset($_POST['submit_comment']))
{
/* Проверяем CAPCHA*/
$Captcha = new Captcha();
if (isset($_POST['captcha_key']) && isset($_POST['captcha_keystring']))
{
$cpt = $Captcha->ValidCaptcha($_POST['captcha_key'], $_POST['captcha_keystring']);
}
else
{
$cpt = false;
}
if ($cpt)
{
$param['shop_items_catalog_item_id'] = to_int($_REQUEST['shop_items_catalog_item_id']);
$param['shop_comment_user_name'] = to_str($_REQUEST['shop_comment_user_name']);
$param['shop_comment_subject'] = to_str($_REQUEST['shop_comment_subject']);
$param['shop_comment_text'] = to_str($_REQUEST['shop_comment_text']);
$param['shop_comment_grade'] = to_int($_REQUEST['shop_comment_grade']);
$param['shop_comment_date_time'] = date("Y-m-d H:i:s");
/* Активность/неактивность комментария */
$shop_row = $shop->GetShop($current_shop_id);
if ($shop_row)
{
$param['shop_comment_active'] = to_int($shop_row['shop_comment_active']);
}
else
{
$param['shop_comment_active'] = false;
}
$external_propertys['comment_is_active'] = $param['shop_comment_active'];
$shop->InsertComment($param);
}
else
{
/* Неправильно введен код изображенный на картинке */
$external_propertys['error'] = 1;
/* Запиминаем значения */
$external_propertys['shop_comment_user_name'] = to_str($_REQUEST['shop_comment_user_name']);
$external_propertys['shop_comment_subject'] = to_str($_REQUEST['shop_comment_subject']);
$external_propertys['shop_comment_text'] = to_str($_REQUEST['shop_comment_text']);
$external_propertys['shop_comment_grade'] = to_int($_REQUEST['shop_comment_grade']);
$external_propertys['shop_comment_date_time'] = date("Y-m-d H:i:s");
}
}
/* Вывод списка */
if(!$GLOBALS['shop_item_path']['item'])
{
$mas_group = array();
$mas_group = $GLOBALS['shop']->GetGroupsTree($GLOBALS['shop_item_path']['group'], $current_shop_id, $mas_group);
$set = array();
$set = SetGroups($mas_group, $set);
$elements = array();
$in = $GLOBALS['shop_item_path']['group'];
foreach ($set as $key => $value)
{
$in .= ','.$value;
}
$elements['type']=0;
$elements['prefix'] = ' and (';
$elements['name'] = 'shop_items_catalog_table.shop_groups_id';
$elements['if'] = ' IN ('.$in.') ';
$elements['value'] = '';
$elements['sufix']=')';
$param['select'][]=$elements;
$param['current_group_id']= false;
$external_propertys['ТекущаяГруппа'] = $GLOBALS['shop_item_path']['group'];
/* Определяем номер элемента, с которого начинается показ в текущей группе */
$page = end($GLOBALS['URL_ARRAY']);
$page = to_str($page);
$shop_row = $shop->GetShop($current_shop_id);
if ($shop_row)
{
$items_on_page = $shop_row['shop_items_on_page'];
}
else
{
$items_on_page = 10;
}
/*
Порядок сортировки ('Asc' - по возрастанию, 'Desc' - по убыванию, 'Rand' - произвольный порядок)
$param['items_order']='Asc';
Поле, по которому сортируем (наименование элемента)
$param['items_field_order']='shop_items_catalog_name';
*/
/* Ограничиваем по производителю */
if (to_int($_GET['producer_id']) > 0)
{
$element['type'] = 0; // 0 - основное св-во, 1 - дополнительное
$element['name'] = 'shop_producers_list_id';
$element['prefix'] = 'AND'; // префикс
$element['if'] = '='; // Условие
$element['value'] = to_int($_GET['producer_id']);
$element['sufix'] = '';
$param['select'][] = $element;
$external_propertys['producer_id'] = to_int($_GET['producer_id']);
/* Применять фильтр */
$external_propertys['apply_filter'] = true;
}
$price_from = str_replace(',', '.', to_float($_GET['price_from']));
/* Ограничиваем по цене ОТ */
if ($price_from > 0)
{
$element['type'] = 0; // 0 - основное св-во, 1 - дополнительное
$element['name'] = 'shop_items_catalog_price';
$element['prefix'] = 'AND'; // префикс
$element['if'] = '>'; // Условие
$element['value'] = $price_from;
$element['sufix'] = '';
$param['select'][] = $element;
$external_propertys['price_from'] = $price_from;
/* Применять фильтр */
$external_propertys['apply_filter'] = true;
}
$price_to = str_replace(',', '.', to_float($_GET['price_to']));
/* Ограничиваем по цене ДО */
if ($price_to > 0)
{
$element['type'] = 0; // 0 - основное св-во, 1 - дополнительное
$element['name'] = 'shop_items_catalog_price';
$element['prefix'] = 'AND'; // префикс
$element['if'] = '<'; // Условие
$element['value'] = $price_to;
$element['sufix'] = '';
$param['select'][] = $element;
$external_propertys['price_to'] = $price_to;
/* Применять фильтр */
$external_propertys['apply_filter'] = true;
}
/* Число элементов на странице */
$on_page = to_int($_GET['on_page']);
if ($on_page > 0 && $on_page < 150)
{
$param['items_on_page'] = $on_page;
$external_propertys['on_page'] = $on_page;
/* Применять фильтр */
$external_propertys['apply_filter'] = true;
}
// Определяем номер страницы.
if ($on_page)
{
$items_on_page = $on_page;
}
if (ereg("^page-([0-9]*)$", $page, $regs) && to_int($regs[1]) > 1)
{
/* Страница умножается на кол-во элементов, выводимых на страницу */
$items_begin = ($regs[1] - 1) * $items_on_page;
}
else
{
$items_begin = 0;
}
$param['items_begin'] = $items_begin;
/* Направление сортировки, 0 - по-возрастанию, 1 - по-убыванию */
$order_direction = to_int($_GET['order_direction']);
switch ($order_direction)
{
case 1: /* По-возрастанию */
{
$order_direction = 'ASC';
break;
}
case 2: /* По-убыванию */
{
$order_direction = 'DESC';
break;
}
default: /* По-умолчанию */
{
$order_direction = 'ASC';
break;
}
}
/* Поле сортировки */
$sort_field = to_int($_GET['sort_by_field']);
switch ($sort_field)
{
case 1: /* По имени */
{
$param['items_field_order'] = 'shop_items_catalog_name';
$param['items_order'] = $order_direction;
$external_propertys['sort_by_field'] = $sort_field;
$external_propertys['order_direction'] = $order_direction;
break;
}
case 2: /* По цене */
{
$param['items_field_order'] = 'shop_items_catalog_price';
$param['items_order'] = $order_direction;
$external_propertys['sort_by_field'] = $sort_field;
$external_propertys['order_direction'] = $order_direction;
break;
}
}
/* Обработка дополнительных свойств.
Получаем список свойств, разрешенных для отображения в данной группе и в фильтре */
$resource_properties = $shop->GetPropertiesOfGroupForXml($current_shop_id, $param['current_group_id']);
if ($resource_properties)
{
$element['type'] = 0; /* 0 - основное св-во, 1 - дополнительное */
/* Префикс, если нужен. */
$element['prefix'] = ' and ('; // префикс
/* ОСТАВЛЯЕТЕ БЕЗ ИЗМЕНЕНИЙ, ЭТО НУЖНО ДЛЯ СОРТИРОВКИ */
$element['name'] = ''; // Имя
/* поля для основного св-ва, если тип = 1, то не указывается */
$element['if'] = ''; // Условие
/* Вот здесь передается ID доп. св-ва, по которому производится сортировка.
ID ВАШЕГО ПОЛЯ УКАЗЫВАЕТЕ ЗДЕСЬ */
$element['value'] = ''; /* Значение поля (или параметра) */
$element['sufix']=' ';
/* Добавляем в общий список условий */
$param['select'][] = $element;
$count_condition = 0;
$property_xml = '';
$count_properties = mysql_num_rows($resource_properties);
for ($i = 0; $i < $count_properties; $i++)
{
$row = mysql_fetch_assoc($resource_properties);
$element['value'] = 0;
foreach ($_GET as $key => $value)
{
if (preg_match("/property_id_{$row['shop_list_of_properties_id']}_item_id_(\d*)/", $key, $matches))
{
$get_param = 'property_id_'.$row['shop_list_of_properties_id'].'_item_id_'.$matches[1];
if (isset($_GET[$get_param]) > 0 && to_int($matches[1]) > 0)
{
$element['value'] = to_int($matches[1]);
$external_propertys['property_id_'.to_int($row['shop_list_of_properties_id']).'_item_id_'.$element['value']] = $element['value'];
$property_xml .= '&property_id_'.to_int($row['shop_list_of_properties_id']).'_item_id_'.$element['value'].'='.$element['value'];
}
}
}
/* Выбираем режим отображения */
$get_param = 'property_id_'.$row['shop_list_of_properties_id'];
if (isset($_GET[$get_param]))
{
if ($row['shop_list_of_properties_type'] == 0 || $row['shop_list_of_properties_show_kind'] == 1)
{
if (to_str($_GET[$get_param]) ==! "")
{
$element['value'] = quote_smart(to_str($_GET[$get_param]));
$external_propertys['property_id_'.to_int($row['shop_list_of_properties_id'])] = $element['value'];
$property_xml .= '&property_id_'.to_int($row['shop_list_of_properties_id']).'='.$element['value'];
}
}
// Флажок
elseif($row['shop_list_of_properties_type'] == 7)
{
$element['value'] = 1;
$external_propertys['property_id_'.to_int($row['shop_list_of_properties_id'])] = $element['value'];
$property_xml .= '&property_id_'.to_int($row['shop_list_of_properties_id']).'='.$element['value'];
}
else
{
if (to_int($_GET[$get_param]) > 0)
{
$element['value'] = to_int($_GET[$get_param]);
$external_propertys['property_id_'.to_int($row['shop_list_of_properties_id'])] = $element['value'];
$property_xml .= '&property_id_'.to_int($row['shop_list_of_properties_id']).'='.$element['value'];
}
}
}
if ($element['value'])
{
/* Применять фильтр */
$external_propertys['apply_filter'] = true;
$element['property_id'] = to_int($row['shop_list_of_properties_id']);
$element['type'] = 1; /* 0 - основное св-во, 1 - дополнительное */
//$element['prefix'] = 'AND'; /* префикс */
$element['if'] = '='; /* Условие */
$element['sufix'] = '';
if ($count_condition)
{
$element['prefix'] = ' or '; /* префикс */
}
else
{
$element['prefix'] = ' '; /* префикс */
}
$count_condition++;
$param['select'][] = $element;
}
}
if (!$count_condition)
{
$element['prefix'] = ' 1'; /* префикс */
}
else
{
$element['prefix'] = ''; // префикс
}
/* добавляем конечный элемент, содержащий HAVING */
$element['type'] = 0; /* 0 - основное св-во, 1 - дополнительное */
/* ОСТАВЛЯЕТЕ БЕЗ ИЗМЕНЕНИЙ, ЭТО НУЖНО ДЛЯ СОРТИРОВКИ */
$element['name'] = ''; /* Имя */
/* поля для основного св-ва, если тип = 1, то не указывается */
$element['if'] = ''; /* Условие */
/* Вот здесь передается ID доп. св-ва, по которому производится сортировка.
ID ВАШЕГО ПОЛЯ УКАЗЫВАЕТЕ ЗДЕСЬ */
$element['value'] = ''; // Значение поля (или параметра)
$having_count = '';
if ($count_condition != 0)
{
$having_count = 'GROUP BY shop_items_catalog_table.shop_items_catalog_item_id HAVING COUNT(shop_properties_items_table.shop_properties_items_id)= '.$count_condition.' ';
}
$element['sufix'] = ' ) '.$having_count;
/* Добавляем в общий список условий */
$param['select'][] = $element;
}
if (!empty($property_xml))
{
$external_propertys['property_xml'] = $property_xml;
}
// Если передано имя тэга - фильтруем
if (isset($GLOBALS['shop_item_path']['tag_name']))
{
$oTag = & singleton('Tag');
$tag_row = $oTag->GetTagByName($GLOBALS['shop_item_path']['tag_name']);
$param['tags'] = array($tag_row['tag_id']);
// При выводе тэгов вывод элементов ведется из всех групп
$param['current_group_id'] = false;
}
// При выводе списка товаров получать подробное описание каждого товара не нужно
$param['show_text'] = false;
// При выводе списка товаров получать сопутствующие товары не нужно
$param['xml_show_tying_products'] = false;
// При выводе списка товаров получать дополнительные св-ва групп не нужно
$param['xml_show_group_property'] = true;
$param['xml_show_group_type']='all';
$GLOBALS['shop']->ShowShop($current_shop_id, $xsl_catalog, $param, $external_propertys);
}
else
{
/* Вывод конкретного элемент */
$shop->ShowItem($GLOBALS['shop_item_path']['item'], $xsl_item, $param, $external_propertys);
}
}
?>
это код динамической страницы... function SetGroups($mas_groups, $set)
{
$mas_groups = to_array($mas_groups);
foreach ($mas_groups as $key=>$value)
{
foreach ($value as $key1=>$value1)
{
$set[] = $value1['shop_groups_id'];
if ($value1['shop_groups_id'] == $key)
{
$set[] = $key;
SetGroups($mas_groups, $set);
}
}
}
return $set;
}
$xsl_catalog = to_str($GLOBALS['LA']['xsl_catalog']);
$xsl_item = to_str($GLOBALS['LA']['xsl_item']);
$current_shop_id = to_int($GLOBALS['LA']['shop_id']);
$param = array();
$shop = & singleton('shop');
if ($GLOBALS['shop_item_path'] != false)
{
if (class_exists("SiteUsers"))
{
/* Получаем id текущего пользователя сайта */
$SiteUsers = & singleton('SiteUsers');
$param['user_id'] = $SiteUsers->GetCurrentSiteUser();
}
$external_propertys = array();
if (isset($_POST['submit_comment']))
{
/* Проверяем CAPCHA*/
$Captcha = new Captcha();
if (isset($_POST['captcha_key']) && isset($_POST['captcha_keystring']))
{
$cpt = $Captcha->ValidCaptcha($_POST['captcha_key'], $_POST['captcha_keystring']);
}
else
{
$cpt = false;
}
if ($cpt)
{
$param['shop_items_catalog_item_id'] = to_int($_REQUEST['shop_items_catalog_item_id']);
$param['shop_comment_user_name'] = to_str($_REQUEST['shop_comment_user_name']);
$param['shop_comment_subject'] = to_str($_REQUEST['shop_comment_subject']);
$param['shop_comment_text'] = to_str($_REQUEST['shop_comment_text']);
$param['shop_comment_grade'] = to_int($_REQUEST['shop_comment_grade']);
$param['shop_comment_date_time'] = date("Y-m-d H:i:s");
/* Активность/неактивность комментария */
$shop_row = $shop->GetShop($current_shop_id);
if ($shop_row)
{
$param['shop_comment_active'] = to_int($shop_row['shop_comment_active']);
}
else
{
$param['shop_comment_active'] = false;
}
$external_propertys['comment_is_active'] = $param['shop_comment_active'];
$shop->InsertComment($param);
}
else
{
/* Неправильно введен код изображенный на картинке */
$external_propertys['error'] = 1;
/* Запиминаем значения */
$external_propertys['shop_comment_user_name'] = to_str($_REQUEST['shop_comment_user_name']);
$external_propertys['shop_comment_subject'] = to_str($_REQUEST['shop_comment_subject']);
$external_propertys['shop_comment_text'] = to_str($_REQUEST['shop_comment_text']);
$external_propertys['shop_comment_grade'] = to_int($_REQUEST['shop_comment_grade']);
$external_propertys['shop_comment_date_time'] = date("Y-m-d H:i:s");
}
}
/* Вывод списка */
if(!$GLOBALS['shop_item_path']['item'])
{
$mas_group = array();
$mas_group = $GLOBALS['shop']->GetGroupsTree($GLOBALS['shop_item_path']['group'], $current_shop_id, $mas_group);
$set = array();
$set = SetGroups($mas_group, $set);
$elements = array();
$in = $GLOBALS['shop_item_path']['group'];
foreach ($set as $key => $value)
{
$in .= ','.$value;
}
$elements['type']=0;
$elements['prefix'] = ' and (';
$elements['name'] = 'shop_items_catalog_table.shop_groups_id';
$elements['if'] = ' IN ('.$in.') ';
$elements['value'] = '';
$elements['sufix']=')';
$param['select'][]=$elements;
$param['current_group_id']= false;
$external_propertys['ТекущаяГруппа'] = $GLOBALS['shop_item_path']['group'];
/* Определяем номер элемента, с которого начинается показ в текущей группе */
$page = end($GLOBALS['URL_ARRAY']);
$page = to_str($page);
$shop_row = $shop->GetShop($current_shop_id);
if ($shop_row)
{
$items_on_page = $shop_row['shop_items_on_page'];
}
else
{
$items_on_page = 10;
}
/*
Порядок сортировки ('Asc' - по возрастанию, 'Desc' - по убыванию, 'Rand' - произвольный порядок)
$param['items_order']='Asc';
Поле, по которому сортируем (наименование элемента)
$param['items_field_order']='shop_items_catalog_name';
*/
/* Ограничиваем по производителю */
if (to_int($_GET['producer_id']) > 0)
{
$element['type'] = 0; // 0 - основное св-во, 1 - дополнительное
$element['name'] = 'shop_producers_list_id';
$element['prefix'] = 'AND'; // префикс
$element['if'] = '='; // Условие
$element['value'] = to_int($_GET['producer_id']);
$element['sufix'] = '';
$param['select'][] = $element;
$external_propertys['producer_id'] = to_int($_GET['producer_id']);
/* Применять фильтр */
$external_propertys['apply_filter'] = true;
}
$price_from = str_replace(',', '.', to_float($_GET['price_from']));
/* Ограничиваем по цене ОТ */
if ($price_from > 0)
{
$element['type'] = 0; // 0 - основное св-во, 1 - дополнительное
$element['name'] = 'shop_items_catalog_price';
$element['prefix'] = 'AND'; // префикс
$element['if'] = '>'; // Условие
$element['value'] = $price_from;
$element['sufix'] = '';
$param['select'][] = $element;
$external_propertys['price_from'] = $price_from;
/* Применять фильтр */
$external_propertys['apply_filter'] = true;
}
$price_to = str_replace(',', '.', to_float($_GET['price_to']));
/* Ограничиваем по цене ДО */
if ($price_to > 0)
{
$element['type'] = 0; // 0 - основное св-во, 1 - дополнительное
$element['name'] = 'shop_items_catalog_price';
$element['prefix'] = 'AND'; // префикс
$element['if'] = '<'; // Условие
$element['value'] = $price_to;
$element['sufix'] = '';
$param['select'][] = $element;
$external_propertys['price_to'] = $price_to;
/* Применять фильтр */
$external_propertys['apply_filter'] = true;
}
/* Число элементов на странице */
$on_page = to_int($_GET['on_page']);
if ($on_page > 0 && $on_page < 150)
{
$param['items_on_page'] = $on_page;
$external_propertys['on_page'] = $on_page;
/* Применять фильтр */
$external_propertys['apply_filter'] = true;
}
// Определяем номер страницы.
if ($on_page)
{
$items_on_page = $on_page;
}
if (ereg("^page-([0-9]*)$", $page, $regs) && to_int($regs[1]) > 1)
{
/* Страница умножается на кол-во элементов, выводимых на страницу */
$items_begin = ($regs[1] - 1) * $items_on_page;
}
else
{
$items_begin = 0;
}
$param['items_begin'] = $items_begin;
/* Направление сортировки, 0 - по-возрастанию, 1 - по-убыванию */
$order_direction = to_int($_GET['order_direction']);
switch ($order_direction)
{
case 1: /* По-возрастанию */
{
$order_direction = 'ASC';
break;
}
case 2: /* По-убыванию */
{
$order_direction = 'DESC';
break;
}
default: /* По-умолчанию */
{
$order_direction = 'ASC';
break;
}
}
/* Поле сортировки */
$sort_field = to_int($_GET['sort_by_field']);
switch ($sort_field)
{
case 1: /* По имени */
{
$param['items_field_order'] = 'shop_items_catalog_name';
$param['items_order'] = $order_direction;
$external_propertys['sort_by_field'] = $sort_field;
$external_propertys['order_direction'] = $order_direction;
break;
}
case 2: /* По цене */
{
$param['items_field_order'] = 'shop_items_catalog_price';
$param['items_order'] = $order_direction;
$external_propertys['sort_by_field'] = $sort_field;
$external_propertys['order_direction'] = $order_direction;
break;
}
}
/* Обработка дополнительных свойств.
Получаем список свойств, разрешенных для отображения в данной группе и в фильтре */
$resource_properties = $shop->GetPropertiesOfGroupForXml($current_shop_id, $param['current_group_id']);
if ($resource_properties)
{
$element['type'] = 0; /* 0 - основное св-во, 1 - дополнительное */
/* Префикс, если нужен. */
$element['prefix'] = ' and ('; // префикс
/* ОСТАВЛЯЕТЕ БЕЗ ИЗМЕНЕНИЙ, ЭТО НУЖНО ДЛЯ СОРТИРОВКИ */
$element['name'] = ''; // Имя
/* поля для основного св-ва, если тип = 1, то не указывается */
$element['if'] = ''; // Условие
/* Вот здесь передается ID доп. св-ва, по которому производится сортировка.
ID ВАШЕГО ПОЛЯ УКАЗЫВАЕТЕ ЗДЕСЬ */
$element['value'] = ''; /* Значение поля (или параметра) */
$element['sufix']=' ';
/* Добавляем в общий список условий */
$param['select'][] = $element;
$count_condition = 0;
$property_xml = '';
$count_properties = mysql_num_rows($resource_properties);
for ($i = 0; $i < $count_properties; $i++)
{
$row = mysql_fetch_assoc($resource_properties);
$element['value'] = 0;
foreach ($_GET as $key => $value)
{
if (preg_match("/property_id_{$row['shop_list_of_properties_id']}_item_id_(\d*)/", $key, $matches))
{
$get_param = 'property_id_'.$row['shop_list_of_properties_id'].'_item_id_'.$matches[1];
if (isset($_GET[$get_param]) > 0 && to_int($matches[1]) > 0)
{
$element['value'] = to_int($matches[1]);
$external_propertys['property_id_'.to_int($row['shop_list_of_properties_id']).'_item_id_'.$element['value']] = $element['value'];
$property_xml .= '&property_id_'.to_int($row['shop_list_of_properties_id']).'_item_id_'.$element['value'].'='.$element['value'];
}
}
}
/* Выбираем режим отображения */
$get_param = 'property_id_'.$row['shop_list_of_properties_id'];
if (isset($_GET[$get_param]))
{
if ($row['shop_list_of_properties_type'] == 0 || $row['shop_list_of_properties_show_kind'] == 1)
{
if (to_str($_GET[$get_param]) ==! "")
{
$element['value'] = quote_smart(to_str($_GET[$get_param]));
$external_propertys['property_id_'.to_int($row['shop_list_of_properties_id'])] = $element['value'];
$property_xml .= '&property_id_'.to_int($row['shop_list_of_properties_id']).'='.$element['value'];
}
}
// Флажок
elseif($row['shop_list_of_properties_type'] == 7)
{
$element['value'] = 1;
$external_propertys['property_id_'.to_int($row['shop_list_of_properties_id'])] = $element['value'];
$property_xml .= '&property_id_'.to_int($row['shop_list_of_properties_id']).'='.$element['value'];
}
else
{
if (to_int($_GET[$get_param]) > 0)
{
$element['value'] = to_int($_GET[$get_param]);
$external_propertys['property_id_'.to_int($row['shop_list_of_properties_id'])] = $element['value'];
$property_xml .= '&property_id_'.to_int($row['shop_list_of_properties_id']).'='.$element['value'];
}
}
}
if ($element['value'])
{
/* Применять фильтр */
$external_propertys['apply_filter'] = true;
$element['property_id'] = to_int($row['shop_list_of_properties_id']);
$element['type'] = 1; /* 0 - основное св-во, 1 - дополнительное */
//$element['prefix'] = 'AND'; /* префикс */
$element['if'] = '='; /* Условие */
$element['sufix'] = '';
if ($count_condition)
{
$element['prefix'] = ' or '; /* префикс */
}
else
{
$element['prefix'] = ' '; /* префикс */
}
$count_condition++;
$param['select'][] = $element;
}
}
if (!$count_condition)
{
$element['prefix'] = ' 1'; /* префикс */
}
else
{
$element['prefix'] = ''; // префикс
}
/* добавляем конечный элемент, содержащий HAVING */
$element['type'] = 0; /* 0 - основное св-во, 1 - дополнительное */
/* ОСТАВЛЯЕТЕ БЕЗ ИЗМЕНЕНИЙ, ЭТО НУЖНО ДЛЯ СОРТИРОВКИ */
$element['name'] = ''; /* Имя */
/* поля для основного св-ва, если тип = 1, то не указывается */
$element['if'] = ''; /* Условие */
/* Вот здесь передается ID доп. св-ва, по которому производится сортировка.
ID ВАШЕГО ПОЛЯ УКАЗЫВАЕТЕ ЗДЕСЬ */
$element['value'] = ''; // Значение поля (или параметра)
$having_count = '';
if ($count_condition != 0)
{
$having_count = 'GROUP BY shop_items_catalog_table.shop_items_catalog_item_id HAVING COUNT(shop_properties_items_table.shop_properties_items_id)= '.$count_condition.' ';
}
$element['sufix'] = ' ) '.$having_count;
/* Добавляем в общий список условий */
$param['select'][] = $element;
}
if (!empty($property_xml))
{
$external_propertys['property_xml'] = $property_xml;
}
// Если передано имя тэга - фильтруем
if (isset($GLOBALS['shop_item_path']['tag_name']))
{
$oTag = & singleton('Tag');
$tag_row = $oTag->GetTagByName($GLOBALS['shop_item_path']['tag_name']);
$param['tags'] = array($tag_row['tag_id']);
// При выводе тэгов вывод элементов ведется из всех групп
$param['current_group_id'] = false;
}
// При выводе списка товаров получать подробное описание каждого товара не нужно
$param['show_text'] = false;
// При выводе списка товаров получать сопутствующие товары не нужно
$param['xml_show_tying_products'] = false;
// При выводе списка товаров получать дополнительные св-ва групп не нужно
$param['xml_show_group_property'] = true;
$param['xml_show_group_type']='all';
$GLOBALS['shop']->ShowShop($current_shop_id, $xsl_catalog, $param, $external_propertys);
}
else
{
/* Вывод конкретного элемент */
$shop->ShowItem($GLOBALS['shop_item_path']['item'], $xsl_item, $param, $external_propertys);
}
}
?>
<?xml version="1.0" encoding="windows-1251"?>
<!DOCTYPE xsl:stylesheet>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output xmlns="http://www.w3.org/TR/xhtml1/strict" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" encoding="Windows-1251" indent="yes" method="html" omit-xml-declaration="no" version="1.0" media-type="text/xml"/>
<xsl:decimal-format name="my" decimal-separator="," grouping-separator="."/>
<xsl:template match="/">
<xsl:apply-templates select="/shop"/>
</xsl:template>
<!-- Шаблон для магазина -->
<xsl:template match="/shop">
<!-- Получаем ID родительской группы и записываем в переменную $parent_group_id -->
<xsl:variable name="parent_group_id"><xsl:choose>
<xsl:when test="ТекущаяГруппа/node()"><xsl:value-of select="ТекущаяГруппа"/></xsl:when>
<xsl:otherwise><xsl:value-of select="@current_group_id"/></xsl:otherwise>
</xsl:choose></xsl:variable>
<!-- Если в находимся корне - выводим название информационной системы -->
<xsl:if test="$parent_group_id = 0">
<h1>
<xsl:value-of disable-output-escaping="yes" select="name"/>
</h1>
</xsl:if>
<!-- Если в находимся в группе - выводим название группы -->
<xsl:if test="$parent_group_id != 0">
<h1>
<xsl:value-of disable-output-escaping="yes" select=".//group[@id=$parent_group_id]/name"/>
</h1>
</xsl:if>
<!-- Обработка выбранных тэгов -->
<xsl:if test="count(selected_tags/tag) = 1">
<h2>Метка — <strong><xsl:value-of select="selected_tags/tag/tag_name"/></strong>.</h2>
</xsl:if>
<!-- Путь к группе -->
<div class="path">
<xsl:apply-templates select=".//group[@id=$parent_group_id]" mode="goup_path"/>
</div>
<xsl:variable name="count">1</xsl:variable>
<!-- Отображение подгрупп данной группы, только если подгруппы есть и не идет фильтра по меткам -->
<xsl:if test="count(selected_tags/tag) = 0 and count(//group[@parent=$parent_group_id]) > 0">
<table width="100%" border="0" cellpadding="3" cellspacing="0">
<tr>
<td valign="top">
<xsl:apply-templates select="//group[@parent=$parent_group_id]"/>
</td>
</tr>
</table>
</xsl:if>
<xsl:if test="count(item) > 0 or apply_filter = 1">
<form method="get" action="./">
<div class="shop_block">
<p>Производитель: 
<select name="producer_id">
<option value="0">…</option>
<xsl:apply-templates select="producerslist/producer"/>
</select> 
Цена от: 
<input name="price_from" size="5" type="text">
<xsl:if test="/shop/price_from != 0">
<xsl:attribute name="value">
<xsl:value-of disable-output-escaping="yes" select="/shop/price_from"/>
</xsl:attribute>
</xsl:if>
</input> 
до: 
<input name="price_to" size="5" type="text">
<xsl:if test="/shop/price_to != 0">
<xsl:attribute name="value">
<xsl:value-of disable-output-escaping="yes" select="/shop/price_to"/>
</xsl:attribute>
</xsl:if>
</input> </p>
<p>
<span style="white-space: nowrap">Товаров на странице:</span> 
<select name="on_page">
<option value="0">…</option>
<xsl:call-template name="for_on_page">
<xsl:with-param name="i" select="10"/>
<xsl:with-param name="n" select="50"/>
</xsl:call-template>
</select> 
<input name="apply_filter" value="Применить" type="submit"/>
<xsl:if test="count(properties_for_group/property) > 0">
<p>
<b>Фильтр по дополнительным свойствам товара:</b>
</p>
<table cellpadding="10px" cellspacing="0">
<tr valign="top">
<xsl:apply-templates select="properties_for_group/property"/>
</tr>
</table>
</xsl:if>
</p>
</div>
<!-- Таблица с элементами для сравнения -->
<xsl:if test="count(/shop/compare_items/compare_item) > 0">
<table cellpadding="5px" cellspacing="0" border="0">
<tr>
<td>
<input type="checkbox" onclick="SelectAllItems(this.checked, 'del_compare_id_')" />
</td>
<td>
<b>Сравниваемые элементы</b>
</td>
</tr>
<xsl:apply-templates select="compare_items/compare_item"/>
</table>
<input name="apply_compare" value="Сравнить" type="button" onclick="javascript:location='{/shop/path}compare_items/';"/>
<input name="delete_compare" value="Удалить" type="submit"/>
<!-- <input name="delete_all_compare" value="Удалить все" type="submit"/> -->
</xsl:if>
<!-- Сортировка товаров -->
<div class="shop_block">
<!-- Определяем ссылку с параметрами фильтра -->
<xsl:variable name="filter">
<xsl:if test="/shop/apply_filter/node()">?action=apply_filter&saller_id=<xsl:value-of select="/shop/saller_id"/>&price_from=<xsl:value-of select="/shop/price_from"/>&price_to=<xsl:value-of select="/shop/price_to"/>&on_page=<xsl:value-of select="/shop/on_page"/>
<xsl:if test="/shop/property_xml/node()">
<!-- GET для доп. свойств -->
<xsl:value-of select="/shop/property_xml"/>
</xsl:if>
</xsl:if>
</xsl:variable>
<!-- Определяем первый символ вопрос или амперсанд -->
<xsl:variable name="first_symbol">
<xsl:choose>
<xsl:when test="$filter != ''">&</xsl:when>
<xsl:otherwise>?</xsl:otherwise>
</xsl:choose>
</xsl:variable>
Сортировать по алфавиту
<xsl:choose>
<xsl:when test="/shop/sort_by_field = 1 and /shop/order_direction = 'ASC'">
<div class="arrow_up"></div>
<img src="/hostcmsfiles/images/arrow_up.png" style="filter: alpha(opacity=0); margin: 0px 0px -4px 0px" alt="по возрастанию"/>
</xsl:when>
<xsl:otherwise>
<div class="arrow_up_gray"></div>
<a href="{$filter}{$first_symbol}sort_by_field=1&order_direction=1" class="without_decor">
<img src="/hostcmsfiles/images/arrow_up_gray.png" style="filter: alpha(opacity=0); margin: 0px 0px -4px 0px" alt="по возрастанию"/>
</a>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="/shop/sort_by_field = 1 and /shop/order_direction = 'DESC'">
<div class="arrow_down"></div>
<img src="/hostcmsfiles/images/arrow_down.png" style="filter: alpha(opacity=0); margin: 0px 0px -4px 0px" alt="по убыванию"/>
</xsl:when>
<xsl:otherwise>
<div class="arrow_down_gray"></div>
<a href="{$filter}{$first_symbol}sort_by_field=1&order_direction=2" class="without_decor">
<img src="/hostcmsfiles/images/arrow_down_gray.png" style="filter: alpha(opacity=0); margin: 0px 0px -4px 0px" alt="по убыванию"/>
</a>
</xsl:otherwise>
</xsl:choose>, по цене
<xsl:choose>
<xsl:when test="/shop/sort_by_field = 2 and /shop/order_direction = 'ASC'">
<div class="arrow_up"></div>
<img src="/hostcmsfiles/images/arrow_up.png" style="filter: alpha(opacity=0); margin: 0px 0px -4px 0px" alt="по возрастанию"/>
</xsl:when>
<xsl:otherwise>
<div class="arrow_up_gray"></div>
<a href="{$filter}{$first_symbol}sort_by_field=2&order_direction=1" class="without_decor">
<img src="/hostcmsfiles/images/arrow_up_gray.png" style="filter: alpha(opacity=0); margin: 0px 0px -4px 0px" alt="по возрастанию"/></a>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="/shop/sort_by_field = 2 and /shop/order_direction = 'DESC'">
<div class="arrow_down"></div>
<img src="/hostcmsfiles/images/arrow_down.png" style="filter: alpha(opacity=0); margin: 0px 0px -4px 0px" alt="по убыванию"/>
</xsl:when>
<xsl:otherwise>
<div class="arrow_down_gray"></div>
<a href="{$filter}{$first_symbol}sort_by_field=2&order_direction=2" class="without_decor">
<img src="/hostcmsfiles/images/arrow_down_gray.png" style="filter: alpha(opacity=0); margin: 0px 0px -4px 0px" alt="по убыванию"/>
</a>
</xsl:otherwise>
</xsl:choose>
</div>
<!-- Определяем ссылку с параметрами фильтра -->
<xsl:variable name="filter">
<xsl:choose>
<xsl:when test="/shop/apply_filter/node()">?action=apply_filter&price_from=<xsl:value-of select="/shop/price_from"/>&price_to=<xsl:value-of select="/shop/price_to"/>&on_page=<xsl:value-of select="/shop/on_page"/>
<xsl:if test="/shop/property_xml/node()">
<!-- GET для доп. свойств -->
<xsl:value-of select="/shop/property_xml"/>
</xsl:if>
</xsl:when>
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- Определяем первый символ вопрос или амперсанд -->
<xsl:variable name="first_symbol">
<xsl:choose>
<xsl:when test="$filter != ''">&</xsl:when>
<xsl:otherwise>?</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:apply-templates select="item" />
<input name="add_compare" value="Добавить для сравнения" type="submit"/>
<xsl:if test="count(/shop/group[@id = /shop/@current_group_id]/propertys/property) > 0">
<div style="margin: 10px 0px;">
<h2>Атрибуты группы товаров</h2>
<xsl:if test="count(property[@dir_id = 0])">
<table border="0">
<xsl:apply-templates select="property[@dir_id = 0]"/>
</table>
</xsl:if>
<xsl:apply-templates select="/shop/properties_groups_dir"/>
</div>
</xsl:if>
<xsl:if test="count_items > 0 and items_on_page > 0">
<p>
<xsl:call-template name="for">
<xsl:with-param name="items_on_page" select="items_on_page"/>
<xsl:with-param name="current_page" select="current_page"/>
<xsl:with-param name="count_items" select="count_items"/>
<xsl:with-param name="visible_pages" select="5"/>
</xsl:call-template>
</p>
<div style="clear: both"></div>
</xsl:if>
</form>
</xsl:if>
</xsl:template>
<!-- Вывод раздела для свойств группы товаров -->
<xsl:template match="properties_groups_dir">
<p><b><xsl:value-of select="shop_properties_groups_dir_name"/></b></p>
<xsl:variable name="dir_id" select="@id"/>
<xsl:if test="count(/shop/group[@id = /shop/@current_group_id]/propertys/property)">
<table border="0">
<xsl:apply-templates select="/shop/group[@id = /shop/@current_group_id]/propertys/property[@parent_id = $dir_id]"/>
</table>
</xsl:if>
<xsl:if test="count(properties_groups_dir)">
<blockquote>
<xsl:apply-templates select="properties_groups_dir"/>
</blockquote>
</xsl:if>
</xsl:template>
<!-- Вывод строки со значением свойства -->
<xsl:template match="property">
<tr>
<td style="padding: 5px" bgcolor="#E5DFDA">
<b><xsl:value-of select="name"/></b>
</td>
<td style="padding: 5px" bgcolor="#E5DFDA">
<xsl:choose>
<xsl:when test="type = 1">
<a href="{file_path}">Скачать файл</a>
</xsl:when>
<xsl:when test="type = 7">
<xsl:choose>
<xsl:when test="value = 1">
<input type="checkbox" checked="" disabled="" />
</xsl:when>
<xsl:otherwise>
<input type="checkbox" disabled="" />
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:value-of disable-output-escaping="yes" select="value"/>
</xsl:otherwise>
</xsl:choose>
</td>
</tr>
</xsl:template>
<!-- Шаблон для списка товаров для сравнения -->
<xsl:template match="compare_items/compare_item">
<xsl:variable name="var_compare_id" select="."/>
<tr>
<td>
<input type="checkbox" name="del_compare_id_{compare_item_id}" id="id_del_compare_id_{compare_item_id}"/>
</td>
<td>
<a href="{/shop/path}{compare_item_fullpath}{compare_item_path}/">
<xsl:value-of disable-output-escaping="yes" select="compare_item_name"/>
</a>
</td>
</tr>
</xsl:template>
<!-- Шаблон для фильтра производителей -->
<xsl:template match="producerslist/producer">
<xsl:param name="id_prod" select="@id"/>
<option value="{@id}">
<xsl:if test="@id = /shop/producer_id">
<xsl:attribute name="selected"> </xsl:attribute>
</xsl:if>
<xsl:value-of disable-output-escaping="yes" select="name"/>
</option>
</xsl:template>
<!-- Шаблон для фильтра продавцов -->
<xsl:template match="sallers/saller">
<option value="{@id}">
<xsl:if test="@id = /shop/saller_id">
<xsl:attribute name="selected">
</xsl:attribute>
</xsl:if>
<xsl:value-of select="sallers_name"/>
</option>
</xsl:template>
<!-- Шаблон для фильра по дополнительным свойствам -->
<xsl:template match="properties_for_group/property">
<xsl:variable name="nodename">property_id_<xsl:value-of select="@id"/></xsl:variable>
<td>
<xsl:value-of disable-output-escaping="yes" select="property_name"/> 
<xsl:if test="property_show_kind = 1">
<!-- Отображаем поле ввода -->
<br/>
<input type="text" name="property_id_{@id}">
<xsl:if test="/shop/*[name()=$nodename] != ''">
<xsl:attribute name="value">
<xsl:value-of select="/shop/*[name()=$nodename]"/>
</xsl:attribute>
</xsl:if>
</input>
</xsl:if>
<xsl:if test="property_show_kind = 2">
<!-- Отображаем список -->
<br/>
<select name="property_id_{@id}">
<option value="0">...</option>-->
<xsl:apply-templates select="list_items/list_item"/>
</select>
</xsl:if>
<xsl:if test="property_show_kind = 3">
<!-- Отображаем переключатели -->
<br/>
<input type="radio" name="property_id_{@id}" value="0" id="id_prop_radio_{@id}_0"></input>
<label for="id_prop_radio_{@id}_0">Любой вариант</label>
<xsl:apply-templates select="list_items/list_item"/>
</xsl:if>
<xsl:if test=" property_show_kind = 4">
<!-- Отображаем флажки -->
<xsl:apply-templates select="list_items/list_item"/>
</xsl:if>
<xsl:if test=" property_show_kind = 5">
<!-- Отображаем флажок -->
<br/>
<input type="checkbox" name="property_id_{@id}" id="property_id_{@id}" style="padding-top:4px">
<xsl:if test="/shop/*[name()=$nodename] != ''">
<xsl:attribute name="checked">
<xsl:value-of select="/shop/*[name()=$nodename]"/>
</xsl:attribute>
</xsl:if>
</input>
<label for="property_id_{@id}">Да</label>
</xsl:if>
</td>
<xsl:if test="position() mod 6 = 0">
<xsl:text disable-output-escaping="yes">
</tr>
<tr valign="top">
</xsl:text>
</xsl:if>
</xsl:template>
<xsl:template match="list_items/list_item">
<xsl:if test="../../property_show_kind = 2">
<!-- Отображаем список -->
<xsl:variable name="nodename">property_id_<xsl:value-of select="../../@id"/></xsl:variable>
<option value="{@id}">
<xsl:if test="/shop/*[name()=$nodename] = @id">
<xsl:attribute name="selected">
</xsl:attribute>
</xsl:if>
<xsl:value-of disable-output-escaping="yes" select="list_item_value"/>
</option>
</xsl:if>
<xsl:if test="../../property_show_kind = 3">
<!-- Отображаем переключатели -->
<xsl:variable name="nodename">property_id_<xsl:value-of select="../../@id"/></xsl:variable>
<br/>
<input type="radio" name="property_id_{../../@id}" value="{@id}" id="id_property_id_{../../@id}_{@id}">
<xsl:if test="/shop/*[name()=$nodename] = @id">
<!--<xsl:attribute name="checked"> </xsl:attribute>-->
</xsl:if>
<label for="id_property_id_{../../@id}_{@id}">
<xsl:value-of disable-output-escaping="yes" select="list_item_value"/>
</label>
</input>
</xsl:if>
<xsl:if test="../../property_show_kind = 4">
<!-- Отображаем флажки -->
<xsl:variable name="nodename">property_id_<xsl:value-of select="../../@id"/>_item_id_<xsl:value-of select="@id"/></xsl:variable>
<br/>
<input type="checkbox" name="property_id_{../../@id}_item_id_{@id}" id="id_property_id_{../../@id}_{@id}">
<xsl:if test="/shop/*[name()=$nodename] = @id">
<!--<xsl:attribute name="checked"> </xsl:attribute>-->
</xsl:if>
<label for="id_property_id_{../../@id}_{@id}">
<xsl:value-of disable-output-escaping="yes" select="list_item_value"/>
</label>
</input>
</xsl:if>
</xsl:template>
<!-- Цикл с шагом 10 для select'a количества элементов на страницу -->
<xsl:template name="for_on_page">
<xsl:param name="i" select="0"/>
<xsl:param name="n"/>
<option value="{$i}">
<xsl:if test="$i = /shop/on_page">
<xsl:attribute name="selected">
</xsl:attribute>
</xsl:if>
<xsl:value-of select="$i"/>
</option>
<xsl:if test="$n > $i">
<!-- Рекурсивный вызов шаблона -->
<xsl:call-template name="for_on_page">
<xsl:with-param name="i" select="$i + 10"/>
<xsl:with-param name="n" select="$n"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<!-- Шаблон для групп товара -->
<xsl:template match="group">
<xsl:variable name="parent_id" select="@parent"/>
<div style="margin-bottom: 15px;">
<a href="{/shop/path}{fullpath}" style="font-weight: bold">
<xsl:value-of disable-output-escaping="yes" select="name"/>
</a> <span style="color: #aaaaaa">(<xsl:value-of select="count_all_items"/>)</span>
<br/>
<xsl:value-of disable-output-escaping="yes" select="description"/>
<xsl:if test="count(group) > 1">
<xsl:apply-templates select="group" mode="sub_group"/>
</xsl:if>
</div>
<xsl:if test="position()= round(count(//group[@parent = $parent_id]) div 2)">
<xsl:text disable-output-escaping="yes">
</td>
<td valign="top" width="50%">
</xsl:text>
</xsl:if>
</xsl:template>
<!-- Шаблон для подразделов -->
<xsl:template match="group" mode="sub_group">
<a href="{/shop/path}{fullpath}">
<xsl:value-of disable-output-escaping="yes" select="name"/>
</a>
<xsl:variable name="parent_id" select="@parent"/>
<!-- Ставим запятую после группы, за которой следуют еще группы из данной родителской группы -->
<xsl:if test="position() != last() and count(//group[@parent = $parent_id]) > 1">, </xsl:if>
</xsl:template>
<!-- Шаблон для товара -->
<xsl:template match="item">
<!-- Определяем цвет фона -->
<xsl:variable name="background_color">
<xsl:choose>
<xsl:when test="(position() + 1) mod 2 > 0">#f7f7f7</xsl:when>
<xsl:otherwise>#ffffff</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<table width="97%" border="0" cellpadding="0" cellspacing="0" style="padding-bottom: 7px; margin-bottom: 15px; margin-right: 10px; border-bottom: 1px solid #dadada">
<tr>
<td colspan="4" style="padding-bottom: 4px">
<!-- Название товара -->
<div>
<a href="{/shop/path}{fullpath}{path}/" class="cat_title">
<span style="font-size: 13pt">
<b>
<xsl:value-of disable-output-escaping="yes" select="name"/>
</b>
</span>
</a>
</div>
</td>
</tr>
<tr>
<td class="cat_t" style="width: 110px" valign="top">
<!-- Изображение для товара, если есть -->
<xsl:if test="small_image!=''">
<a href="{/shop/path}{fullpath}{path}/">
<img src="{small_image}" style="border: 1px solid #DADADA"/>
</a>
</xsl:if>
</td>
<td style="vertical-align:top;padding-left:12px;">
<!-- Описание товара -->
<xsl:value-of disable-output-escaping="yes" select="description"/>
<!-- Метки -->
<xsl:if test="count(tags/tag) > 0">
<img src="/hostcmsfiles/images/tags.gif" align="left" style="margin: 0px 5px -2px 0px"/>
<xsl:apply-templates select="tags/tag"/>
</xsl:if>
<!-- Продавец -->
<xsl:if test="saller!=0">
<!-- Идентификатор текущего продавца -->
<p>
<xsl:variable name="saller_id" select="saller"/>
<b>Продавец: </b>
<a href="{/shop/path}sallers/saller-{saller}/">
<xsl:value-of select="/shop/sallers/saller[@id=$saller_id]/sallers_name"/>
</a>
</p>
</xsl:if>
<!-- Если указан вес товара -->
<xsl:if test="weight != 0">
<p>
Вес товара: <xsl:value-of select="weight"/> <xsl:value-of select="weight_mesure"/>
</p>
</xsl:if>
<!-- Скидки -->
<xsl:if test="count(discount) > 0">
<p>
Скидки: <xsl:apply-templates select="discount"/>
</p>
</xsl:if>
<!-- Модификации -->
<xsl:if test="count(modifications/item) > 0">
<b>Модификации:</b>
<table cellspacing="0" cellpadding="2">
<tr>
<td style="border-bottom: 1px solid #dadada;">Название</td>
<td style="border-bottom: 1px solid #dadada;">Цена</td>
</tr>
<xsl:apply-templates select="modifications/item"/>
</table>
</xsl:if>
<div style="margin-left: -4px; margin-top: 5px">
<xsl:variable name="var_compare_id" select="@id"/>
<input type="checkbox" name="compare_id_{@id}" id="id_compare_id_{@id}">
<label for="id_compare_id_{@id}"> <span style="border-bottom: dashed 1px">Добавить для сравнения</span> </label>
</input>
</div>
</td>
<td width="128" valign="top" style="padding-left: 30px">
<xsl:if test="property[@xml_name = 'novinka']/value != '' and property[@xml_name = 'novinka']/value = 'Да'">
<img src="/images/new.gif"/>
</xsl:if>
<xsl:if test="property[@xml_name = 'hot']/value != '' and property[@xml_name = 'hot']/value = 'Да'">
<img src="/images/hot.gif"/>
</xsl:if>
</td>
<td width="130" class="cat_price_label" style="padding-left: 10px" valign="top">
<!-- Цена товара -->
<div style="display: inline">
<xsl:choose>
<xsl:when test="price != 0">
<xsl:variable name="pric" select="price"/>
<span style="font-size: 11pt">
<b>
<xsl:value-of select="format-number($pric, '###.##0,00', 'my')"/> 
<!-- Валюта товара -->
<xsl:value-of disable-output-escaping="yes" select="currency"/>
</b>
</span>
</xsl:when>
<xsl:otherwise>
<span style="font-size: 11pt">
<b>цена договорная</b>
</span>
</xsl:otherwise>
</xsl:choose>
<!-- Если цена со скидкой - выводим ее -->
<xsl:if test="price!=price_tax">
<br/>
<font color="gray">
<strike>
<xsl:variable name="pric_tax" select="price_tax"/>
<span style="font-size: 11pt">
<xsl:value-of select="format-number($pric_tax, '###.##0,00', 'my')"/> <xsl:value-of disable-output-escaping="yes" select="currency"/></span>
</strike>
</font>
</xsl:if>
<div style="display: inline; margin-left: 3px">
<input type="text" size="3" value="1" id="count_{@id}"/>
<a href="{/shop/path}cart/?action=add&item_id={@id}" onclick="return AddIntoCart('{/shop/path}', {@id}, document.getElementById('count_{@id}').value)">
<img alt="В корзину" title="В корзину" src="/hostcmsfiles/images/cart.gif" style="margin: 0px 0px -4px 10px" />
</a>
</div>
</div>
</td>
</tr>
</table>
</xsl:template>
<!-- /// Метки для товаров /// -->
<xsl:template match="tags/tag">
<a href="{/shop/path}tag/{tag_path_name}/" class="tag">
<xsl:value-of select="tag_name"/>
</a>
<xsl:if test="position() != last()">,</xsl:if> </xsl:template>
<!-- Шаблон для модификаций -->
<xsl:template match="modifications/item">
<tr>
<td>
<!-- Название модификации -->
<a href="{/shop/path}{fullpath}{path}/">
<xsl:value-of disable-output-escaping="yes" select="name"/>
</a>
</td>
<td>
<!-- Цена модификации -->
<xsl:choose>
<xsl:when test="price != 0">
<xsl:value-of disable-output-escaping="yes" select="price"/> 
<!-- Валюта товара -->
<xsl:value-of disable-output-escaping="yes" select="currency"/>
</xsl:when>
<xsl:otherwise>договорная</xsl:otherwise>
</xsl:choose>
</td>
</tr>
</xsl:template>
<!-- Шаблон для скидки -->
<xsl:template match="discount">
<br/>
<xsl:value-of disable-output-escaping="yes" select="name"/> 
<xsl:value-of disable-output-escaping="yes" select="value"/>%</xsl:template>
<!-- Цикл для вывода строк ссылок -->
<xsl:template name="for">
<xsl:param name="i" select="0"/>
<xsl:param name="items_on_page"/>
<xsl:param name="current_page"/>
<xsl:param name="count_items"/>
<xsl:param name="visible_pages"/>
<xsl:variable name="n" select="$count_items div $items_on_page"/>
<!-- Считаем количество выводимых ссылок перед текущим элементом -->
<xsl:variable name="pre_count_page">
<xsl:choose>
<xsl:when test="$current_page > ($n - (round($visible_pages div 2) - 1))">
<xsl:value-of select="$visible_pages - ($n - $current_page)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="round($visible_pages div 2) - 1"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- Считаем количество выводимых ссылок после текущего элемента -->
<xsl:variable name="post_count_page">
<xsl:choose>
<xsl:when test="0 > $current_page - (round($visible_pages div 2) - 1)">
<xsl:value-of select="$visible_pages - $current_page - 1"/>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="round($visible_pages div 2) = ($visible_pages div 2)">
<xsl:value-of select="$visible_pages div 2"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="round($visible_pages div 2) - 1"/>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:if test="$i = 0 and $current_page != 0">
<span class="ctrl">
← Ctrl
</span>
</xsl:if>
<xsl:if test="$i >= $n and ($n - 1) > $current_page">
<span class="ctrl">
Ctrl →
</span>
</xsl:if>
<xsl:if test="$count_items > $items_on_page and $n > $i">
<!-- Заносим в переменную $parent_group_id идентификатор текущей группы -->
<xsl:variable name="parent_group_id"><xsl:choose>
<xsl:when test="ТекущаяГруппа/node()"><xsl:value-of select="ТекущаяГруппа"/></xsl:when>
<xsl:otherwise><xsl:value-of select="/shop/@current_group_id"/></xsl:otherwise>
</xsl:choose></xsl:variable>
<!-- Путь для тэга -->
<xsl:variable name="tag_path">
<xsl:if test="count(/shop/selected_tags/tag) = 1">tag/<xsl:value-of select="/shop/selected_tags/tag/tag_path_name"/>/</xsl:if>
</xsl:variable>
<!-- Определяем группу для формирования адреса ссылки -->
<xsl:variable name="group_link">
<xsl:choose>
<!-- Если группа не корневая (!=0) -->
<xsl:when test="$parent_group_id != 0 ">
<xsl:value-of select="/shop//group[@id=$parent_group_id]/fullpath"/>
</xsl:when>
<!-- Иначе если нулевой уровень - просто ссылка на страницу со списком элементов -->
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- Определяем адрес ссылки -->
<xsl:variable name="number_link">
<xsl:choose>
<!-- Если не нулевой уровень -->
<xsl:when test="$i != 0">page-<xsl:value-of select="$i+1"/>/</xsl:when>
<!-- Иначе если нулевой уровень - просто ссылка на страницу со списком элементов -->
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- Передаем фильтр -->
<xsl:variable name="filter">
<xsl:choose>
<xsl:when test="/shop/apply_filter/node()">?action=apply_filter&producer_id=<xsl:value-of select="/shop/producer_id"/>&saller_id=<xsl:value-of select="/shop/saller_id"/>&price_from=<xsl:value-of select="/shop/price_from"/>&price_to=<xsl:value-of select="/shop/price_to"/>&on_page=<xsl:value-of select="/shop/on_page"/>
<xsl:if test="/shop/property_xml/node()">
<!-- GET для доп. свойств -->
<xsl:value-of select="/shop/property_xml"/>
</xsl:if>
</xsl:when>
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- Определяем первый символ вопрос или амперсанд -->
<xsl:variable name="first_symbol">
<xsl:choose>
<xsl:when test="$filter != ''">&</xsl:when>
<xsl:otherwise>?</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- Данные для стрелок сортировки -->
<xsl:variable name="arrows">
<xsl:choose>
<xsl:when test="(/shop/sort_by_field = 1) or (/shop/sort_by_field = 2)">
<xsl:choose>
<!-- Стрелка вверх -->
<xsl:when test="/shop/order_direction = 'ASC'">
<xsl:value-of select="$first_symbol"/>sort_by_field=<xsl:value-of select="/shop/sort_by_field"/>&order_direction=1</xsl:when>
<!-- Стрелка вниз -->
<xsl:otherwise>
<xsl:value-of select="$first_symbol"/>sort_by_field=<xsl:value-of select="/shop/sort_by_field"/>&order_direction=2</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- Ставим ссылку на страницу-->
<xsl:if test="$i != $current_page">
<!-- Выводим ссылку на первую страницу -->
<xsl:if test="$current_page - $pre_count_page > 0 and $i = 0">
<a href="{/shop/path}{$group_link}{$tag_path}{$number_link}{$filter}{$arrows}" class="page_link" style="text-decoration: none;">←</a>
</xsl:if>
<xsl:if test="$i >= ($current_page - $pre_count_page) and ($current_page + $post_count_page) >= $i">
<!-- Выводим ссылки на видимые страницы -->
<a href="{/shop/path}{$group_link}{$tag_path}{$number_link}{$filter}{$arrows}" class="page_link">
<xsl:value-of select="$i + 1"/>
</a>
</xsl:if>
<!-- Выводим ссылку на последнюю страницу -->
<xsl:if test="$i+1 >= $n and $n > ($current_page + 1 + $post_count_page)">
<xsl:choose>
<xsl:when test="$n > round($n)">
<!-- Выводим ссылку на последнюю страницу -->
<a href="{/shop/path}{$group_link}{$tag_path}{$number_link}{$filter}{$arrows}page-{round($n+1)}/" class="page_link" style="text-decoration: none;">→</a>
</xsl:when>
<xsl:otherwise>
<a href="{/shop/path}{$group_link}{$tag_path}{$number_link}{$filter}{$arrows}" class="page_link" style="text-decoration: none;">→</a>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:if>
<!-- Ссылка на предыдущую страницу для Ctrl + влево -->
<xsl:if test="$current_page != 0 and $i = $current_page">
<xsl:variable name="prev_number_link">
<xsl:choose>
<!-- Если не нулевой уровень -->
<xsl:when test="($current_page - 1) != 0">page-<xsl:value-of select="$i"/>/</xsl:when>
<!-- Иначе если нулевой уровень - просто ссылка на страницу со списком элементов -->
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<a href="{/shop/path}{$group_link}{$tag_path}{$prev_number_link}{$filter}{$arrows}" id="id_prev"></a>
</xsl:if>
<!-- Ссылка на следующую страницу для Ctrl + вправо -->
<xsl:if test="($n - 1) > $current_page and $i = $current_page">
<a href="{/shop/path}{$group_link}{$tag_path}page-{$current_page+2}/{$filter}{$arrows}" id="id_next"></a>
</xsl:if>
<!-- Не ставим ссылку на страницу-->
<xsl:if test="$i = $current_page">
<span class="current">
<xsl:value-of select="$i+1"/>
</span>
</xsl:if>
<!-- Рекурсивный вызов шаблона. НЕОБХОДИМО ПЕРЕДАВАТЬ ВСЕ НЕОБХОДИМЫЕ ПАРАМЕТРЫ! -->
<xsl:call-template name="for">
<xsl:with-param name="i" select="$i + 1"/>
<xsl:with-param name="items_on_page" select="$items_on_page"/>
<xsl:with-param name="current_page" select="$current_page"/>
<xsl:with-param name="count_items" select="$count_items"/>
<xsl:with-param name="visible_pages" select="$visible_pages"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<!-- Шаблон выводит рекурсивно ссылки на группы инф. элемента -->
<xsl:template match="group" mode="goup_path">
<xsl:param name="parent_id" select="@parent"/>
<!-- Получаем ID родительской группы и записываем в переменную $parent_group_id -->
<xsl:variable name="parent_group_id"><xsl:choose>
<xsl:when test="ТекущаяГруппа/node()"><xsl:value-of select="ТекущаяГруппа"/></xsl:when>
<xsl:otherwise><xsl:value-of select="/shop/@current_group_id"/></xsl:otherwise>
</xsl:choose></xsl:variable>
<xsl:apply-templates select="//group[@id=$parent_id]" mode="goup_path"/>
<xsl:if test="@parent=0">
<a href="{/shop/path}">
<xsl:value-of select="/shop/name"/>
</a>
</xsl:if>
<span class="path_arrow">→</span>
<xsl:choose>
<xsl:when test="$parent_group_id = @id">
<xsl:value-of disable-output-escaping="yes" select="name"/>
</xsl:when>
<xsl:otherwise>
<a href="{/shop/path}{fullpath}">
<xsl:value-of disable-output-escaping="yes" select="name"/>
</a>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
А это шаблон вывода каталога.... Что нужно поправить<!DOCTYPE xsl:stylesheet>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:output xmlns="http://www.w3.org/TR/xhtml1/strict" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" encoding="Windows-1251" indent="yes" method="html" omit-xml-declaration="no" version="1.0" media-type="text/xml"/>
<xsl:decimal-format name="my" decimal-separator="," grouping-separator="."/>
<xsl:template match="/">
<xsl:apply-templates select="/shop"/>
</xsl:template>
<!-- Шаблон для магазина -->
<xsl:template match="/shop">
<!-- Получаем ID родительской группы и записываем в переменную $parent_group_id -->
<xsl:variable name="parent_group_id"><xsl:choose>
<xsl:when test="ТекущаяГруппа/node()"><xsl:value-of select="ТекущаяГруппа"/></xsl:when>
<xsl:otherwise><xsl:value-of select="@current_group_id"/></xsl:otherwise>
</xsl:choose></xsl:variable>
<!-- Если в находимся корне - выводим название информационной системы -->
<xsl:if test="$parent_group_id = 0">
<h1>
<xsl:value-of disable-output-escaping="yes" select="name"/>
</h1>
</xsl:if>
<!-- Если в находимся в группе - выводим название группы -->
<xsl:if test="$parent_group_id != 0">
<h1>
<xsl:value-of disable-output-escaping="yes" select=".//group[@id=$parent_group_id]/name"/>
</h1>
</xsl:if>
<!-- Обработка выбранных тэгов -->
<xsl:if test="count(selected_tags/tag) = 1">
<h2>Метка — <strong><xsl:value-of select="selected_tags/tag/tag_name"/></strong>.</h2>
</xsl:if>
<!-- Путь к группе -->
<div class="path">
<xsl:apply-templates select=".//group[@id=$parent_group_id]" mode="goup_path"/>
</div>
<xsl:variable name="count">1</xsl:variable>
<!-- Отображение подгрупп данной группы, только если подгруппы есть и не идет фильтра по меткам -->
<xsl:if test="count(selected_tags/tag) = 0 and count(//group[@parent=$parent_group_id]) > 0">
<table width="100%" border="0" cellpadding="3" cellspacing="0">
<tr>
<td valign="top">
<xsl:apply-templates select="//group[@parent=$parent_group_id]"/>
</td>
</tr>
</table>
</xsl:if>
<xsl:if test="count(item) > 0 or apply_filter = 1">
<form method="get" action="./">
<div class="shop_block">
<p>Производитель: 
<select name="producer_id">
<option value="0">…</option>
<xsl:apply-templates select="producerslist/producer"/>
</select> 
Цена от: 
<input name="price_from" size="5" type="text">
<xsl:if test="/shop/price_from != 0">
<xsl:attribute name="value">
<xsl:value-of disable-output-escaping="yes" select="/shop/price_from"/>
</xsl:attribute>
</xsl:if>
</input> 
до: 
<input name="price_to" size="5" type="text">
<xsl:if test="/shop/price_to != 0">
<xsl:attribute name="value">
<xsl:value-of disable-output-escaping="yes" select="/shop/price_to"/>
</xsl:attribute>
</xsl:if>
</input> </p>
<p>
<span style="white-space: nowrap">Товаров на странице:</span> 
<select name="on_page">
<option value="0">…</option>
<xsl:call-template name="for_on_page">
<xsl:with-param name="i" select="10"/>
<xsl:with-param name="n" select="50"/>
</xsl:call-template>
</select> 
<input name="apply_filter" value="Применить" type="submit"/>
<xsl:if test="count(properties_for_group/property) > 0">
<p>
<b>Фильтр по дополнительным свойствам товара:</b>
</p>
<table cellpadding="10px" cellspacing="0">
<tr valign="top">
<xsl:apply-templates select="properties_for_group/property"/>
</tr>
</table>
</xsl:if>
</p>
</div>
<!-- Таблица с элементами для сравнения -->
<xsl:if test="count(/shop/compare_items/compare_item) > 0">
<table cellpadding="5px" cellspacing="0" border="0">
<tr>
<td>
<input type="checkbox" onclick="SelectAllItems(this.checked, 'del_compare_id_')" />
</td>
<td>
<b>Сравниваемые элементы</b>
</td>
</tr>
<xsl:apply-templates select="compare_items/compare_item"/>
</table>
<input name="apply_compare" value="Сравнить" type="button" onclick="javascript:location='{/shop/path}compare_items/';"/>
<input name="delete_compare" value="Удалить" type="submit"/>
<!-- <input name="delete_all_compare" value="Удалить все" type="submit"/> -->
</xsl:if>
<!-- Сортировка товаров -->
<div class="shop_block">
<!-- Определяем ссылку с параметрами фильтра -->
<xsl:variable name="filter">
<xsl:if test="/shop/apply_filter/node()">?action=apply_filter&saller_id=<xsl:value-of select="/shop/saller_id"/>&price_from=<xsl:value-of select="/shop/price_from"/>&price_to=<xsl:value-of select="/shop/price_to"/>&on_page=<xsl:value-of select="/shop/on_page"/>
<xsl:if test="/shop/property_xml/node()">
<!-- GET для доп. свойств -->
<xsl:value-of select="/shop/property_xml"/>
</xsl:if>
</xsl:if>
</xsl:variable>
<!-- Определяем первый символ вопрос или амперсанд -->
<xsl:variable name="first_symbol">
<xsl:choose>
<xsl:when test="$filter != ''">&</xsl:when>
<xsl:otherwise>?</xsl:otherwise>
</xsl:choose>
</xsl:variable>
Сортировать по алфавиту
<xsl:choose>
<xsl:when test="/shop/sort_by_field = 1 and /shop/order_direction = 'ASC'">
<div class="arrow_up"></div>
<img src="/hostcmsfiles/images/arrow_up.png" style="filter: alpha(opacity=0); margin: 0px 0px -4px 0px" alt="по возрастанию"/>
</xsl:when>
<xsl:otherwise>
<div class="arrow_up_gray"></div>
<a href="{$filter}{$first_symbol}sort_by_field=1&order_direction=1" class="without_decor">
<img src="/hostcmsfiles/images/arrow_up_gray.png" style="filter: alpha(opacity=0); margin: 0px 0px -4px 0px" alt="по возрастанию"/>
</a>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="/shop/sort_by_field = 1 and /shop/order_direction = 'DESC'">
<div class="arrow_down"></div>
<img src="/hostcmsfiles/images/arrow_down.png" style="filter: alpha(opacity=0); margin: 0px 0px -4px 0px" alt="по убыванию"/>
</xsl:when>
<xsl:otherwise>
<div class="arrow_down_gray"></div>
<a href="{$filter}{$first_symbol}sort_by_field=1&order_direction=2" class="without_decor">
<img src="/hostcmsfiles/images/arrow_down_gray.png" style="filter: alpha(opacity=0); margin: 0px 0px -4px 0px" alt="по убыванию"/>
</a>
</xsl:otherwise>
</xsl:choose>, по цене
<xsl:choose>
<xsl:when test="/shop/sort_by_field = 2 and /shop/order_direction = 'ASC'">
<div class="arrow_up"></div>
<img src="/hostcmsfiles/images/arrow_up.png" style="filter: alpha(opacity=0); margin: 0px 0px -4px 0px" alt="по возрастанию"/>
</xsl:when>
<xsl:otherwise>
<div class="arrow_up_gray"></div>
<a href="{$filter}{$first_symbol}sort_by_field=2&order_direction=1" class="without_decor">
<img src="/hostcmsfiles/images/arrow_up_gray.png" style="filter: alpha(opacity=0); margin: 0px 0px -4px 0px" alt="по возрастанию"/></a>
</xsl:otherwise>
</xsl:choose>
<xsl:choose>
<xsl:when test="/shop/sort_by_field = 2 and /shop/order_direction = 'DESC'">
<div class="arrow_down"></div>
<img src="/hostcmsfiles/images/arrow_down.png" style="filter: alpha(opacity=0); margin: 0px 0px -4px 0px" alt="по убыванию"/>
</xsl:when>
<xsl:otherwise>
<div class="arrow_down_gray"></div>
<a href="{$filter}{$first_symbol}sort_by_field=2&order_direction=2" class="without_decor">
<img src="/hostcmsfiles/images/arrow_down_gray.png" style="filter: alpha(opacity=0); margin: 0px 0px -4px 0px" alt="по убыванию"/>
</a>
</xsl:otherwise>
</xsl:choose>
</div>
<!-- Определяем ссылку с параметрами фильтра -->
<xsl:variable name="filter">
<xsl:choose>
<xsl:when test="/shop/apply_filter/node()">?action=apply_filter&price_from=<xsl:value-of select="/shop/price_from"/>&price_to=<xsl:value-of select="/shop/price_to"/>&on_page=<xsl:value-of select="/shop/on_page"/>
<xsl:if test="/shop/property_xml/node()">
<!-- GET для доп. свойств -->
<xsl:value-of select="/shop/property_xml"/>
</xsl:if>
</xsl:when>
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- Определяем первый символ вопрос или амперсанд -->
<xsl:variable name="first_symbol">
<xsl:choose>
<xsl:when test="$filter != ''">&</xsl:when>
<xsl:otherwise>?</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:apply-templates select="item" />
<input name="add_compare" value="Добавить для сравнения" type="submit"/>
<xsl:if test="count(/shop/group[@id = /shop/@current_group_id]/propertys/property) > 0">
<div style="margin: 10px 0px;">
<h2>Атрибуты группы товаров</h2>
<xsl:if test="count(property[@dir_id = 0])">
<table border="0">
<xsl:apply-templates select="property[@dir_id = 0]"/>
</table>
</xsl:if>
<xsl:apply-templates select="/shop/properties_groups_dir"/>
</div>
</xsl:if>
<xsl:if test="count_items > 0 and items_on_page > 0">
<p>
<xsl:call-template name="for">
<xsl:with-param name="items_on_page" select="items_on_page"/>
<xsl:with-param name="current_page" select="current_page"/>
<xsl:with-param name="count_items" select="count_items"/>
<xsl:with-param name="visible_pages" select="5"/>
</xsl:call-template>
</p>
<div style="clear: both"></div>
</xsl:if>
</form>
</xsl:if>
</xsl:template>
<!-- Вывод раздела для свойств группы товаров -->
<xsl:template match="properties_groups_dir">
<p><b><xsl:value-of select="shop_properties_groups_dir_name"/></b></p>
<xsl:variable name="dir_id" select="@id"/>
<xsl:if test="count(/shop/group[@id = /shop/@current_group_id]/propertys/property)">
<table border="0">
<xsl:apply-templates select="/shop/group[@id = /shop/@current_group_id]/propertys/property[@parent_id = $dir_id]"/>
</table>
</xsl:if>
<xsl:if test="count(properties_groups_dir)">
<blockquote>
<xsl:apply-templates select="properties_groups_dir"/>
</blockquote>
</xsl:if>
</xsl:template>
<!-- Вывод строки со значением свойства -->
<xsl:template match="property">
<tr>
<td style="padding: 5px" bgcolor="#E5DFDA">
<b><xsl:value-of select="name"/></b>
</td>
<td style="padding: 5px" bgcolor="#E5DFDA">
<xsl:choose>
<xsl:when test="type = 1">
<a href="{file_path}">Скачать файл</a>
</xsl:when>
<xsl:when test="type = 7">
<xsl:choose>
<xsl:when test="value = 1">
<input type="checkbox" checked="" disabled="" />
</xsl:when>
<xsl:otherwise>
<input type="checkbox" disabled="" />
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise>
<xsl:value-of disable-output-escaping="yes" select="value"/>
</xsl:otherwise>
</xsl:choose>
</td>
</tr>
</xsl:template>
<!-- Шаблон для списка товаров для сравнения -->
<xsl:template match="compare_items/compare_item">
<xsl:variable name="var_compare_id" select="."/>
<tr>
<td>
<input type="checkbox" name="del_compare_id_{compare_item_id}" id="id_del_compare_id_{compare_item_id}"/>
</td>
<td>
<a href="{/shop/path}{compare_item_fullpath}{compare_item_path}/">
<xsl:value-of disable-output-escaping="yes" select="compare_item_name"/>
</a>
</td>
</tr>
</xsl:template>
<!-- Шаблон для фильтра производителей -->
<xsl:template match="producerslist/producer">
<xsl:param name="id_prod" select="@id"/>
<option value="{@id}">
<xsl:if test="@id = /shop/producer_id">
<xsl:attribute name="selected"> </xsl:attribute>
</xsl:if>
<xsl:value-of disable-output-escaping="yes" select="name"/>
</option>
</xsl:template>
<!-- Шаблон для фильтра продавцов -->
<xsl:template match="sallers/saller">
<option value="{@id}">
<xsl:if test="@id = /shop/saller_id">
<xsl:attribute name="selected">
</xsl:attribute>
</xsl:if>
<xsl:value-of select="sallers_name"/>
</option>
</xsl:template>
<!-- Шаблон для фильра по дополнительным свойствам -->
<xsl:template match="properties_for_group/property">
<xsl:variable name="nodename">property_id_<xsl:value-of select="@id"/></xsl:variable>
<td>
<xsl:value-of disable-output-escaping="yes" select="property_name"/> 
<xsl:if test="property_show_kind = 1">
<!-- Отображаем поле ввода -->
<br/>
<input type="text" name="property_id_{@id}">
<xsl:if test="/shop/*[name()=$nodename] != ''">
<xsl:attribute name="value">
<xsl:value-of select="/shop/*[name()=$nodename]"/>
</xsl:attribute>
</xsl:if>
</input>
</xsl:if>
<xsl:if test="property_show_kind = 2">
<!-- Отображаем список -->
<br/>
<select name="property_id_{@id}">
<option value="0">...</option>-->
<xsl:apply-templates select="list_items/list_item"/>
</select>
</xsl:if>
<xsl:if test="property_show_kind = 3">
<!-- Отображаем переключатели -->
<br/>
<input type="radio" name="property_id_{@id}" value="0" id="id_prop_radio_{@id}_0"></input>
<label for="id_prop_radio_{@id}_0">Любой вариант</label>
<xsl:apply-templates select="list_items/list_item"/>
</xsl:if>
<xsl:if test=" property_show_kind = 4">
<!-- Отображаем флажки -->
<xsl:apply-templates select="list_items/list_item"/>
</xsl:if>
<xsl:if test=" property_show_kind = 5">
<!-- Отображаем флажок -->
<br/>
<input type="checkbox" name="property_id_{@id}" id="property_id_{@id}" style="padding-top:4px">
<xsl:if test="/shop/*[name()=$nodename] != ''">
<xsl:attribute name="checked">
<xsl:value-of select="/shop/*[name()=$nodename]"/>
</xsl:attribute>
</xsl:if>
</input>
<label for="property_id_{@id}">Да</label>
</xsl:if>
</td>
<xsl:if test="position() mod 6 = 0">
<xsl:text disable-output-escaping="yes">
</tr>
<tr valign="top">
</xsl:text>
</xsl:if>
</xsl:template>
<xsl:template match="list_items/list_item">
<xsl:if test="../../property_show_kind = 2">
<!-- Отображаем список -->
<xsl:variable name="nodename">property_id_<xsl:value-of select="../../@id"/></xsl:variable>
<option value="{@id}">
<xsl:if test="/shop/*[name()=$nodename] = @id">
<xsl:attribute name="selected">
</xsl:attribute>
</xsl:if>
<xsl:value-of disable-output-escaping="yes" select="list_item_value"/>
</option>
</xsl:if>
<xsl:if test="../../property_show_kind = 3">
<!-- Отображаем переключатели -->
<xsl:variable name="nodename">property_id_<xsl:value-of select="../../@id"/></xsl:variable>
<br/>
<input type="radio" name="property_id_{../../@id}" value="{@id}" id="id_property_id_{../../@id}_{@id}">
<xsl:if test="/shop/*[name()=$nodename] = @id">
<!--<xsl:attribute name="checked"> </xsl:attribute>-->
</xsl:if>
<label for="id_property_id_{../../@id}_{@id}">
<xsl:value-of disable-output-escaping="yes" select="list_item_value"/>
</label>
</input>
</xsl:if>
<xsl:if test="../../property_show_kind = 4">
<!-- Отображаем флажки -->
<xsl:variable name="nodename">property_id_<xsl:value-of select="../../@id"/>_item_id_<xsl:value-of select="@id"/></xsl:variable>
<br/>
<input type="checkbox" name="property_id_{../../@id}_item_id_{@id}" id="id_property_id_{../../@id}_{@id}">
<xsl:if test="/shop/*[name()=$nodename] = @id">
<!--<xsl:attribute name="checked"> </xsl:attribute>-->
</xsl:if>
<label for="id_property_id_{../../@id}_{@id}">
<xsl:value-of disable-output-escaping="yes" select="list_item_value"/>
</label>
</input>
</xsl:if>
</xsl:template>
<!-- Цикл с шагом 10 для select'a количества элементов на страницу -->
<xsl:template name="for_on_page">
<xsl:param name="i" select="0"/>
<xsl:param name="n"/>
<option value="{$i}">
<xsl:if test="$i = /shop/on_page">
<xsl:attribute name="selected">
</xsl:attribute>
</xsl:if>
<xsl:value-of select="$i"/>
</option>
<xsl:if test="$n > $i">
<!-- Рекурсивный вызов шаблона -->
<xsl:call-template name="for_on_page">
<xsl:with-param name="i" select="$i + 10"/>
<xsl:with-param name="n" select="$n"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<!-- Шаблон для групп товара -->
<xsl:template match="group">
<xsl:variable name="parent_id" select="@parent"/>
<div style="margin-bottom: 15px;">
<a href="{/shop/path}{fullpath}" style="font-weight: bold">
<xsl:value-of disable-output-escaping="yes" select="name"/>
</a> <span style="color: #aaaaaa">(<xsl:value-of select="count_all_items"/>)</span>
<br/>
<xsl:value-of disable-output-escaping="yes" select="description"/>
<xsl:if test="count(group) > 1">
<xsl:apply-templates select="group" mode="sub_group"/>
</xsl:if>
</div>
<xsl:if test="position()= round(count(//group[@parent = $parent_id]) div 2)">
<xsl:text disable-output-escaping="yes">
</td>
<td valign="top" width="50%">
</xsl:text>
</xsl:if>
</xsl:template>
<!-- Шаблон для подразделов -->
<xsl:template match="group" mode="sub_group">
<a href="{/shop/path}{fullpath}">
<xsl:value-of disable-output-escaping="yes" select="name"/>
</a>
<xsl:variable name="parent_id" select="@parent"/>
<!-- Ставим запятую после группы, за которой следуют еще группы из данной родителской группы -->
<xsl:if test="position() != last() and count(//group[@parent = $parent_id]) > 1">, </xsl:if>
</xsl:template>
<!-- Шаблон для товара -->
<xsl:template match="item">
<!-- Определяем цвет фона -->
<xsl:variable name="background_color">
<xsl:choose>
<xsl:when test="(position() + 1) mod 2 > 0">#f7f7f7</xsl:when>
<xsl:otherwise>#ffffff</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<table width="97%" border="0" cellpadding="0" cellspacing="0" style="padding-bottom: 7px; margin-bottom: 15px; margin-right: 10px; border-bottom: 1px solid #dadada">
<tr>
<td colspan="4" style="padding-bottom: 4px">
<!-- Название товара -->
<div>
<a href="{/shop/path}{fullpath}{path}/" class="cat_title">
<span style="font-size: 13pt">
<b>
<xsl:value-of disable-output-escaping="yes" select="name"/>
</b>
</span>
</a>
</div>
</td>
</tr>
<tr>
<td class="cat_t" style="width: 110px" valign="top">
<!-- Изображение для товара, если есть -->
<xsl:if test="small_image!=''">
<a href="{/shop/path}{fullpath}{path}/">
<img src="{small_image}" style="border: 1px solid #DADADA"/>
</a>
</xsl:if>
</td>
<td style="vertical-align:top;padding-left:12px;">
<!-- Описание товара -->
<xsl:value-of disable-output-escaping="yes" select="description"/>
<!-- Метки -->
<xsl:if test="count(tags/tag) > 0">
<img src="/hostcmsfiles/images/tags.gif" align="left" style="margin: 0px 5px -2px 0px"/>
<xsl:apply-templates select="tags/tag"/>
</xsl:if>
<!-- Продавец -->
<xsl:if test="saller!=0">
<!-- Идентификатор текущего продавца -->
<p>
<xsl:variable name="saller_id" select="saller"/>
<b>Продавец: </b>
<a href="{/shop/path}sallers/saller-{saller}/">
<xsl:value-of select="/shop/sallers/saller[@id=$saller_id]/sallers_name"/>
</a>
</p>
</xsl:if>
<!-- Если указан вес товара -->
<xsl:if test="weight != 0">
<p>
Вес товара: <xsl:value-of select="weight"/> <xsl:value-of select="weight_mesure"/>
</p>
</xsl:if>
<!-- Скидки -->
<xsl:if test="count(discount) > 0">
<p>
Скидки: <xsl:apply-templates select="discount"/>
</p>
</xsl:if>
<!-- Модификации -->
<xsl:if test="count(modifications/item) > 0">
<b>Модификации:</b>
<table cellspacing="0" cellpadding="2">
<tr>
<td style="border-bottom: 1px solid #dadada;">Название</td>
<td style="border-bottom: 1px solid #dadada;">Цена</td>
</tr>
<xsl:apply-templates select="modifications/item"/>
</table>
</xsl:if>
<div style="margin-left: -4px; margin-top: 5px">
<xsl:variable name="var_compare_id" select="@id"/>
<input type="checkbox" name="compare_id_{@id}" id="id_compare_id_{@id}">
<label for="id_compare_id_{@id}"> <span style="border-bottom: dashed 1px">Добавить для сравнения</span> </label>
</input>
</div>
</td>
<td width="128" valign="top" style="padding-left: 30px">
<xsl:if test="property[@xml_name = 'novinka']/value != '' and property[@xml_name = 'novinka']/value = 'Да'">
<img src="/images/new.gif"/>
</xsl:if>
<xsl:if test="property[@xml_name = 'hot']/value != '' and property[@xml_name = 'hot']/value = 'Да'">
<img src="/images/hot.gif"/>
</xsl:if>
</td>
<td width="130" class="cat_price_label" style="padding-left: 10px" valign="top">
<!-- Цена товара -->
<div style="display: inline">
<xsl:choose>
<xsl:when test="price != 0">
<xsl:variable name="pric" select="price"/>
<span style="font-size: 11pt">
<b>
<xsl:value-of select="format-number($pric, '###.##0,00', 'my')"/> 
<!-- Валюта товара -->
<xsl:value-of disable-output-escaping="yes" select="currency"/>
</b>
</span>
</xsl:when>
<xsl:otherwise>
<span style="font-size: 11pt">
<b>цена договорная</b>
</span>
</xsl:otherwise>
</xsl:choose>
<!-- Если цена со скидкой - выводим ее -->
<xsl:if test="price!=price_tax">
<br/>
<font color="gray">
<strike>
<xsl:variable name="pric_tax" select="price_tax"/>
<span style="font-size: 11pt">
<xsl:value-of select="format-number($pric_tax, '###.##0,00', 'my')"/> <xsl:value-of disable-output-escaping="yes" select="currency"/></span>
</strike>
</font>
</xsl:if>
<div style="display: inline; margin-left: 3px">
<input type="text" size="3" value="1" id="count_{@id}"/>
<a href="{/shop/path}cart/?action=add&item_id={@id}" onclick="return AddIntoCart('{/shop/path}', {@id}, document.getElementById('count_{@id}').value)">
<img alt="В корзину" title="В корзину" src="/hostcmsfiles/images/cart.gif" style="margin: 0px 0px -4px 10px" />
</a>
</div>
</div>
</td>
</tr>
</table>
</xsl:template>
<!-- /// Метки для товаров /// -->
<xsl:template match="tags/tag">
<a href="{/shop/path}tag/{tag_path_name}/" class="tag">
<xsl:value-of select="tag_name"/>
</a>
<xsl:if test="position() != last()">,</xsl:if> </xsl:template>
<!-- Шаблон для модификаций -->
<xsl:template match="modifications/item">
<tr>
<td>
<!-- Название модификации -->
<a href="{/shop/path}{fullpath}{path}/">
<xsl:value-of disable-output-escaping="yes" select="name"/>
</a>
</td>
<td>
<!-- Цена модификации -->
<xsl:choose>
<xsl:when test="price != 0">
<xsl:value-of disable-output-escaping="yes" select="price"/> 
<!-- Валюта товара -->
<xsl:value-of disable-output-escaping="yes" select="currency"/>
</xsl:when>
<xsl:otherwise>договорная</xsl:otherwise>
</xsl:choose>
</td>
</tr>
</xsl:template>
<!-- Шаблон для скидки -->
<xsl:template match="discount">
<br/>
<xsl:value-of disable-output-escaping="yes" select="name"/> 
<xsl:value-of disable-output-escaping="yes" select="value"/>%</xsl:template>
<!-- Цикл для вывода строк ссылок -->
<xsl:template name="for">
<xsl:param name="i" select="0"/>
<xsl:param name="items_on_page"/>
<xsl:param name="current_page"/>
<xsl:param name="count_items"/>
<xsl:param name="visible_pages"/>
<xsl:variable name="n" select="$count_items div $items_on_page"/>
<!-- Считаем количество выводимых ссылок перед текущим элементом -->
<xsl:variable name="pre_count_page">
<xsl:choose>
<xsl:when test="$current_page > ($n - (round($visible_pages div 2) - 1))">
<xsl:value-of select="$visible_pages - ($n - $current_page)"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="round($visible_pages div 2) - 1"/>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- Считаем количество выводимых ссылок после текущего элемента -->
<xsl:variable name="post_count_page">
<xsl:choose>
<xsl:when test="0 > $current_page - (round($visible_pages div 2) - 1)">
<xsl:value-of select="$visible_pages - $current_page - 1"/>
</xsl:when>
<xsl:otherwise>
<xsl:choose>
<xsl:when test="round($visible_pages div 2) = ($visible_pages div 2)">
<xsl:value-of select="$visible_pages div 2"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="round($visible_pages div 2) - 1"/>
</xsl:otherwise>
</xsl:choose>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:if test="$i = 0 and $current_page != 0">
<span class="ctrl">
← Ctrl
</span>
</xsl:if>
<xsl:if test="$i >= $n and ($n - 1) > $current_page">
<span class="ctrl">
Ctrl →
</span>
</xsl:if>
<xsl:if test="$count_items > $items_on_page and $n > $i">
<!-- Заносим в переменную $parent_group_id идентификатор текущей группы -->
<xsl:variable name="parent_group_id"><xsl:choose>
<xsl:when test="ТекущаяГруппа/node()"><xsl:value-of select="ТекущаяГруппа"/></xsl:when>
<xsl:otherwise><xsl:value-of select="/shop/@current_group_id"/></xsl:otherwise>
</xsl:choose></xsl:variable>
<!-- Путь для тэга -->
<xsl:variable name="tag_path">
<xsl:if test="count(/shop/selected_tags/tag) = 1">tag/<xsl:value-of select="/shop/selected_tags/tag/tag_path_name"/>/</xsl:if>
</xsl:variable>
<!-- Определяем группу для формирования адреса ссылки -->
<xsl:variable name="group_link">
<xsl:choose>
<!-- Если группа не корневая (!=0) -->
<xsl:when test="$parent_group_id != 0 ">
<xsl:value-of select="/shop//group[@id=$parent_group_id]/fullpath"/>
</xsl:when>
<!-- Иначе если нулевой уровень - просто ссылка на страницу со списком элементов -->
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- Определяем адрес ссылки -->
<xsl:variable name="number_link">
<xsl:choose>
<!-- Если не нулевой уровень -->
<xsl:when test="$i != 0">page-<xsl:value-of select="$i+1"/>/</xsl:when>
<!-- Иначе если нулевой уровень - просто ссылка на страницу со списком элементов -->
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- Передаем фильтр -->
<xsl:variable name="filter">
<xsl:choose>
<xsl:when test="/shop/apply_filter/node()">?action=apply_filter&producer_id=<xsl:value-of select="/shop/producer_id"/>&saller_id=<xsl:value-of select="/shop/saller_id"/>&price_from=<xsl:value-of select="/shop/price_from"/>&price_to=<xsl:value-of select="/shop/price_to"/>&on_page=<xsl:value-of select="/shop/on_page"/>
<xsl:if test="/shop/property_xml/node()">
<!-- GET для доп. свойств -->
<xsl:value-of select="/shop/property_xml"/>
</xsl:if>
</xsl:when>
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- Определяем первый символ вопрос или амперсанд -->
<xsl:variable name="first_symbol">
<xsl:choose>
<xsl:when test="$filter != ''">&</xsl:when>
<xsl:otherwise>?</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- Данные для стрелок сортировки -->
<xsl:variable name="arrows">
<xsl:choose>
<xsl:when test="(/shop/sort_by_field = 1) or (/shop/sort_by_field = 2)">
<xsl:choose>
<!-- Стрелка вверх -->
<xsl:when test="/shop/order_direction = 'ASC'">
<xsl:value-of select="$first_symbol"/>sort_by_field=<xsl:value-of select="/shop/sort_by_field"/>&order_direction=1</xsl:when>
<!-- Стрелка вниз -->
<xsl:otherwise>
<xsl:value-of select="$first_symbol"/>sort_by_field=<xsl:value-of select="/shop/sort_by_field"/>&order_direction=2</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- Ставим ссылку на страницу-->
<xsl:if test="$i != $current_page">
<!-- Выводим ссылку на первую страницу -->
<xsl:if test="$current_page - $pre_count_page > 0 and $i = 0">
<a href="{/shop/path}{$group_link}{$tag_path}{$number_link}{$filter}{$arrows}" class="page_link" style="text-decoration: none;">←</a>
</xsl:if>
<xsl:if test="$i >= ($current_page - $pre_count_page) and ($current_page + $post_count_page) >= $i">
<!-- Выводим ссылки на видимые страницы -->
<a href="{/shop/path}{$group_link}{$tag_path}{$number_link}{$filter}{$arrows}" class="page_link">
<xsl:value-of select="$i + 1"/>
</a>
</xsl:if>
<!-- Выводим ссылку на последнюю страницу -->
<xsl:if test="$i+1 >= $n and $n > ($current_page + 1 + $post_count_page)">
<xsl:choose>
<xsl:when test="$n > round($n)">
<!-- Выводим ссылку на последнюю страницу -->
<a href="{/shop/path}{$group_link}{$tag_path}{$number_link}{$filter}{$arrows}page-{round($n+1)}/" class="page_link" style="text-decoration: none;">→</a>
</xsl:when>
<xsl:otherwise>
<a href="{/shop/path}{$group_link}{$tag_path}{$number_link}{$filter}{$arrows}" class="page_link" style="text-decoration: none;">→</a>
</xsl:otherwise>
</xsl:choose>
</xsl:if>
</xsl:if>
<!-- Ссылка на предыдущую страницу для Ctrl + влево -->
<xsl:if test="$current_page != 0 and $i = $current_page">
<xsl:variable name="prev_number_link">
<xsl:choose>
<!-- Если не нулевой уровень -->
<xsl:when test="($current_page - 1) != 0">page-<xsl:value-of select="$i"/>/</xsl:when>
<!-- Иначе если нулевой уровень - просто ссылка на страницу со списком элементов -->
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<a href="{/shop/path}{$group_link}{$tag_path}{$prev_number_link}{$filter}{$arrows}" id="id_prev"></a>
</xsl:if>
<!-- Ссылка на следующую страницу для Ctrl + вправо -->
<xsl:if test="($n - 1) > $current_page and $i = $current_page">
<a href="{/shop/path}{$group_link}{$tag_path}page-{$current_page+2}/{$filter}{$arrows}" id="id_next"></a>
</xsl:if>
<!-- Не ставим ссылку на страницу-->
<xsl:if test="$i = $current_page">
<span class="current">
<xsl:value-of select="$i+1"/>
</span>
</xsl:if>
<!-- Рекурсивный вызов шаблона. НЕОБХОДИМО ПЕРЕДАВАТЬ ВСЕ НЕОБХОДИМЫЕ ПАРАМЕТРЫ! -->
<xsl:call-template name="for">
<xsl:with-param name="i" select="$i + 1"/>
<xsl:with-param name="items_on_page" select="$items_on_page"/>
<xsl:with-param name="current_page" select="$current_page"/>
<xsl:with-param name="count_items" select="$count_items"/>
<xsl:with-param name="visible_pages" select="$visible_pages"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<!-- Шаблон выводит рекурсивно ссылки на группы инф. элемента -->
<xsl:template match="group" mode="goup_path">
<xsl:param name="parent_id" select="@parent"/>
<!-- Получаем ID родительской группы и записываем в переменную $parent_group_id -->
<xsl:variable name="parent_group_id"><xsl:choose>
<xsl:when test="ТекущаяГруппа/node()"><xsl:value-of select="ТекущаяГруппа"/></xsl:when>
<xsl:otherwise><xsl:value-of select="/shop/@current_group_id"/></xsl:otherwise>
</xsl:choose></xsl:variable>
<xsl:apply-templates select="//group[@id=$parent_id]" mode="goup_path"/>
<xsl:if test="@parent=0">
<a href="{/shop/path}">
<xsl:value-of select="/shop/name"/>
</a>
</xsl:if>
<span class="path_arrow">→</span>
<xsl:choose>
<xsl:when test="$parent_group_id = @id">
<xsl:value-of disable-output-escaping="yes" select="name"/>
</xsl:when>
<xsl:otherwise>
<a href="{/shop/path}{fullpath}">
<xsl:value-of disable-output-escaping="yes" select="name"/>
</a>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
тот код что вы написали... не работает... он опять выводит только корень магазина и только тех производителей что есть в первой 10ке товаров

wildthing, скажите честно, вы сообщения не читаете, которые вам пишут?

См. мое предыдущее сообщение. После внесения исправлений в код:
natalya писал(а):
Вам такой вариант не подходит?

См. мое предыдущее сообщение. После внесения исправлений в код:
natalya писал(а):
в списке производителей будут только производители товаров текущей группы и товаров всех ее подгрупп.
Вам такой вариант не подходит?
что значит wildthing писал(а):
Код проверялся локально, все работает верно.
выводит только корень магазина
?Код проверялся локально, все работает верно.
Вы видели мои коды...? Вы на них проверяли... я честно пробовал Ваш код... и у меня выводит родительскую группу... в категории не заходит... и выводит только тех производителей что есть в первой десятке... Возможно у меня в коде ошибка... 

В общем что я сделал... я взял поставил родные коды шаблона каталога(кроме вывода картинок) и в типовой внес изменения как Вы написали:
$mas_group = array();
$mas_group = $GLOBALS['shop']->GetGroupsTree($GLOBALS['shop_item_path']['group'],
$current_shop_id, $mas_group);
$set = array();
$set = SetGroups($mas_group, $set);
$elements = array();
$param['current_group_id'] = array();
$param['current_group_id'][] = $GLOBALS['shop_item_path']['group'];
foreach ($set as $key => $value)
{
$param['current_group_id'][] = $value;
}
а внизу перед ShowShop оставил
$param['xml_show_group_property'] = true;
$param['xml_show_group_type']='all';
Результат... постоянно полный список разделов. Что необходимо исправить... (я почемуто думаю что это в шаблоне надо править) hххp://ibit.com.ua/shop/ посмотрите как у меня это отображается
$mas_group = array();
$mas_group = $GLOBALS['shop']->GetGroupsTree($GLOBALS['shop_item_path']['group'],
$current_shop_id, $mas_group);
$set = array();
$set = SetGroups($mas_group, $set);
$elements = array();
$param['current_group_id'] = array();
$param['current_group_id'][] = $GLOBALS['shop_item_path']['group'];
foreach ($set as $key => $value)
{
$param['current_group_id'][] = $value;
}
а внизу перед ShowShop оставил
$param['xml_show_group_property'] = true;
$param['xml_show_group_type']='all';
Результат... постоянно полный список разделов. Что необходимо исправить... (я почемуто думаю что это в шаблоне надо править) hххp://ibit.com.ua/shop/ посмотрите как у меня это отображается
В типовой нужно править. Код:
добавьте внутрь условия:
if($GLOBALS['shop_item_path']['group'] != 0)
{
...
}
$mas_group = array();
$mas_group = $GLOBALS['shop']->GetGroupsTree($GLOBALS['shop_item_path']['group'],
$current_shop_id, $mas_group);
$set = array();
$set = SetGroups($mas_group, $set);
$elements = array();
$param['current_group_id'] = array();
$param['current_group_id'][] = $GLOBALS['shop_item_path']['group'];
foreach ($set as $key => $value)
{
$param['current_group_id'][] = $value;
}
$mas_group = $GLOBALS['shop']->GetGroupsTree($GLOBALS['shop_item_path']['group'],
$current_shop_id, $mas_group);
$set = array();
$set = SetGroups($mas_group, $set);
$elements = array();
$param['current_group_id'] = array();
$param['current_group_id'][] = $GLOBALS['shop_item_path']['group'];
foreach ($set as $key => $value)
{
$param['current_group_id'][] = $value;
}
добавьте внутрь условия:
if($GLOBALS['shop_item_path']['group'] != 0)
{
...
}
Наконец !!!!!! Исправил. Спасибо огромное!! За терпение. За подарок на день рождения!!! 



я немного по другому сделал.... в конце
я добавил
а в шаблоне вместо
изменил на
<xsl:variable name="parent_group_id"><xsl:choose>
<xsl:when test="ТекущаяГруппа/node()"><xsl:value-of select="ТекущаяГруппа"/></xsl:when>
<xsl:otherwise><xsl:value-of select="/shop/@current_group_id"/></xsl:otherwise>
</xsl:choose></xsl:variable>
и так по всему шаблону где встречается
$mas_group = array();
$mas_group = $GLOBALS['shop']->GetGroupsTree($GLOBALS['shop_item_path']['group'],
$current_shop_id, $mas_group);
$set = array();
$set = SetGroups($mas_group, $set);
$elements = array();
$param['current_group_id'] = array();
$param['current_group_id'][] = $GLOBALS['shop_item_path']['group'];
foreach ($set as $key => $value)
{
$param['current_group_id'][] = $value;
}
$mas_group = $GLOBALS['shop']->GetGroupsTree($GLOBALS['shop_item_path']['group'],
$current_shop_id, $mas_group);
$set = array();
$set = SetGroups($mas_group, $set);
$elements = array();
$param['current_group_id'] = array();
$param['current_group_id'][] = $GLOBALS['shop_item_path']['group'];
foreach ($set as $key => $value)
{
$param['current_group_id'][] = $value;
}
я добавил
$external_propertys['ТекущаяГруппа'] = $GLOBALS['shop_item_path']['group'];
а в шаблоне вместо
<xsl:variable name="parent_group_id" select="@current_group_id"/>
изменил на
<xsl:variable name="parent_group_id"><xsl:choose>
<xsl:when test="ТекущаяГруппа/node()"><xsl:value-of select="ТекущаяГруппа"/></xsl:when>
<xsl:otherwise><xsl:value-of select="/shop/@current_group_id"/></xsl:otherwise>
</xsl:choose></xsl:variable>
и так по всему шаблону где встречается
<xsl:variable name="parent_group_id" select="@current_group_id"/>
ставим такую замену только смотрите на путь внимательно select="@current_group_id" есть и такие select="/shop/@current_group_id"
Авторизация