Вывод ссылок на предыдущий и следующий элементы при выводе инфоэлемента
hostcms
Модератор
9 ноября 2009 г.
1. information_blocks_items_order_field замените на information_systems_items_order_field
2. information_blocks_items_order_type замените на information_systems_items_order_type
Теперь об XSL-шаблоне, откуда у Вас взялось следующее:
2. information_blocks_items_order_type замените на information_systems_items_order_type
Теперь об XSL-шаблоне, откуда у Вас взялось следующее:
...
<xsl:template match="/document/item">
<SCRIPT>
<xsl:comment>
<xsl:text disable-output-escaping="yes">
<![CDATA[
function ShowImgWindow(title, src, width, height)
{
obj = window.open("", "", "scrollbars=0,dialog=0,minimizable=1,modal=1,width="+width+",height="+height+",resizable=0");
obj.document.write("<html>");
obj.document.write("<head>");
obj.document.write("<title>"+title+"</title>");
obj.document.write("</head>");
obj.document.write("<body topmargin=0 leftmargin=0 marginwidth=0 marginheight=0>");
obj.document.write("<img src=\""+src+"\" />");
obj.document.write("</body>");
obj.document.write("</html>");
}
]]>
</xsl:text>
</xsl:comment>
</SCRIPT>
<!-- Получаем ID родительской группы и записываем в переменную $parent_group_id -->
<xsl:variable name="parent_group_id" select="/document/information_system/parent_group_id"/>
<h2 align="center">
<xsl:value-of disable-output-escaping="yes" select="item_name"/>
</h2>
<xsl:template match="/document/item">
...
<xsl:template match="/document/item">
<SCRIPT>
<xsl:comment>
<xsl:text disable-output-escaping="yes">
<![CDATA[
function ShowImgWindow(title, src, width, height)
{
obj = window.open("", "", "scrollbars=0,dialog=0,minimizable=1,modal=1,width="+width+",height="+height+",resizable=0");
obj.document.write("<html>");
obj.document.write("<head>");
obj.document.write("<title>"+title+"</title>");
obj.document.write("</head>");
obj.document.write("<body topmargin=0 leftmargin=0 marginwidth=0 marginheight=0>");
obj.document.write("<img src=\""+src+"\" />");
obj.document.write("</body>");
obj.document.write("</html>");
}
]]>
</xsl:text>
</xsl:comment>
</SCRIPT>
<!-- Получаем ID родительской группы и записываем в переменную $parent_group_id -->
<xsl:variable name="parent_group_id" select="/document/information_system/parent_group_id"/>
<h2 align="center">
<xsl:value-of disable-output-escaping="yes" select="item_name"/>
</h2>
<xsl:template match="/document/item">
...
adm.dream
10 ноября 2009 г.
Спасибо все Получилось
adm.dream
10 ноября 2009 г.
Все очень хорошо работает.
Но подскажите пожалуйста еще один момент.
Как можно сделать подобную листалку между информационными группами
Но подскажите пожалуйста еще один момент.
Как можно сделать подобную листалку между информационными группами
hostcms
Модератор
10 ноября 2009 г.
adm.dream,
Пожалуйста. Проблемы листалок информационных групп уже ранее (мне кажется давно) обсуждались, поищите по форуму.
Пожалуйста. Проблемы листалок информационных групп уже ранее (мне кажется давно) обсуждались, поищите по форуму.
adm.dream
11 ноября 2009 г.
Извините за назойливость . Я поискал на страницах форума и не нашел ничего подхлодящего.
Дело обстоит так что мне для функционала необходимо перемещение как по вертикали так и по горизонтали на всех уровнях.
Тут просто ограничением отображения инф. группы на страничке не получится решить задачу.
Вот то что я хочу добиться (тут картинка):http://nagual.su/images/Shema.jpg
Инф. Элементы уже листаются, а вот инф. группы - увы
Помогите пожалуйста мне эту стену прошибить
Дело обстоит так что мне для функционала необходимо перемещение как по вертикали так и по горизонтали на всех уровнях.
Тут просто ограничением отображения инф. группы на страничке не получится решить задачу.
Вот то что я хочу добиться (тут картинка):
Инф. Элементы уже листаются, а вот инф. группы - увы
Помогите пожалуйста мне эту стену прошибить
adm.dream
11 ноября 2009 г.
Пардон ссылка не точная получилась . http://www.nagual.su/images/Shema.jpg
mihailru
3 декабря 2009 г.
Здравствуйте!
Все это понятно... А как можно зациклить ссылку например, на следующий элемент.
Т.е. дойдя до последнего, мы бы вставали на первый... Это тоже очень полезная штука.
Если можете, подскажите как!
Все это понятно... А как можно зациклить ссылку например, на следующий элемент.
Т.е. дойдя до последнего, мы бы вставали на первый... Это тоже очень полезная штука.
Если можете, подскажите как!
ferdinant
3 июня 2010 г.
А точно такое для Интернет-магазина реально сделать?
Skype:ferdinant1988 ICQ:311960596 E-mail: ferdinant@i.ua
Евгений007
23 июня 2010 г.
Что-то где-то не так....
Типовая страница:
<?php
function SetGroups($mas_groups, $set)
{
$mas_groups = to_array($mas_groups);
foreach ($mas_groups as $key=>$value)
{
foreach ($value as $key1=>$value1)
{
$set[] = $value1;
if ($value1 == $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)
{
$external_propertys = array();
if (class_exists("SiteUsers")
{
/* Получаем id текущего пользователя сайта */
$SiteUsers = & singleton('SiteUsers');
$site_user_id = $SiteUsers->GetCurrentSiteUser();
$param['user_id'] = $site_user_id;
$external_propertys['user_id'] = $SiteUsers->GetCurrentSiteUser();
}
else
{
$site_user_id = 0;
$external_propertys['user_id'] = 0;
}
// Если добавление комментария
if (isset($_POST['submit_comment']) && !empty($GLOBALS['shop_item_path']['item']))
{
/* Проверяем CAPCHA*/
$Captcha = new Captcha();
$xmlData = '<?xml version="1.0" encoding="' . SITE_CODING . '"?>' . "\n";
$xmlData .= '<document>' . "\n";
if ($site_user_id > 0
|| $Captcha->ValidCaptcha(to_str($_POST['captcha_key']), to_str($_POST['captcha_keystring'])))
{
$param['shop_items_catalog_item_id'] = $GLOBALS['shop_item_path']['item'];
$param['shop_comment_user_name'] = to_str($_REQUEST['shop_comment_user_name']);
$param['shop_comment_user_email'] = to_str($_REQUEST['shop_comment_user_email']);
$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'];
// Если есть модуль "Пользователи сайта", получим текущего пользователя
if (class_exists('SiteUsers'))
{
$SiteUsers = & singleton('SiteUsers');
$param['site_users_id'] = $SiteUsers->GetCurrentSiteUser();
}
else
{
$param['site_users_id'] = 0;
}
$shop_comment_id = $shop->InsertComment($param);
// Задан XSL для формирования письма администратору о добавлении комментария к товару
if (to_str($GLOBALS['LA']['xsl_add_comment_letter_to_admin']) != '')
{
// Формируем XML для комментария
$xmlData .= $shop->GenXml4Comment($shop_comment_id);
$xmlData .= '</document>' . "\n";
$xsl = new xsl();
// Формируем текст письма администратору
$message = $xsl->build($xmlData, $GLOBALS['LA']['xsl_add_comment_letter_to_admin']);
// Формат письма - текст
if (to_int($GLOBALS['LA']['comment_mail_type']) == 0)
{
$comment_mail_type = 'text/plain';
}
else
{
$comment_mail_type = 'text/html';
}
$subject = $GLOBALS['MSG_shops']['subject_report_for_comment'];
$kernel = & singleton('kernel');
// Получаем e-mail куратора магазина
$email_to = to_str($shop_row['shop_shops_admin_mail']);
if (!empty($email_to))
{
$kernel->SendMailWithFile($email_to, EMAIL_TO, $subject, $message, array(), $comment_mail_type);
}
}
}
else
{
/* Неправильно введен код изображенный на картинке */
$external_propertys['error'] = 1;
/* Запоминаем значения */
$external_propertys['shop_comment_user_name'] = strip_tags(to_str($_REQUEST['shop_comment_user_name']));
$external_propertys['shop_comment_user_email'] = strip_tags(to_str($_REQUEST['shop_comment_user_email']));
$external_propertys['shop_comment_subject'] = strip_tags(to_str($_REQUEST['shop_comment_subject']));
$external_propertys['shop_comment_text'] = strip_tags(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'])
{
$param['current_group_id'] = $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;
}
/* Ограничиваем по продавцу */
if (to_int($_GET['saller_id']) > 0)
{
$element['type'] = 0; // 0 - основное св-во, 1 - дополнительное
$element['name'] = 'shop_sallers_id';
$element['prefix'] = 'AND'; // префикс
$element['if'] = '='; // Условие
$element['value'] = to_int($_GET['saller_id']);
$element['sufix'] = '';
$param['select'][] = $element;
$external_propertys['saller_id'] = to_int($_GET['saller_id']);
/* Применять фильтр */
$external_propertys['apply_filter'] = true;
}
$price_from = str_replace(',', '.', to_float($_GET['price_from']));
/* Ограничиваем по цене ОТ */
if ($price_from > 0)
{
$external_propertys['price_from'] = $price_from;
/* Применять фильтр */
$external_propertys['apply_filter'] = true;
}
$price_to = str_replace(',', '.', to_float($_GET['price_to']));
/* Ограничиваем по цене ДО */
if ($price_to > 0)
{
$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_field_order'] = 'item_price_absolute';
$param['items_order'] = $order_direction;
$external_propertys['sort_by_field'] = $sort_field;
$external_propertys['order_direction'] = $order_direction;
break;
}
case 3: /* По оценке*/
{
$param['items_field_order'] = 'shop_comment_grade';
$param['items_order'] = $order_direction;
$external_propertys['sort_by_field'] = $sort_field;
$external_propertys['order_direction'] = $order_direction;
break;
}
}
// Задан фильтр и/или сортировка по цене
if ($price_from > 0 || $price_to > 0 || $sort_field == 2)
{
// Получаем список валют магазина
$currency_result = $shop->GetAllCurrency();
$query_currency_switch = 'shop_items_catalog_price';
// Цикл по валютам магазина
while ($currency_row = mysql_fetch_assoc($currency_result))
{
// Получаем коэффициент пересчета для каждой валюты
$currency_coefficient = $shop->GetCurrencyCoefficientToShopCurrency($currency_row['shop_currency_id'], $shop_row['shop_currency_id']);
$query_currency_switch = "IF (shop_items_catalog_table.shop_currency_id = {$currency_row['shop_currency_id']}, shop_items_catalog_table.shop_items_catalog_price * $currency_coefficient, $query_currency_switch)";
}
$param['sql_external_select'] = ' ,' . $query_currency_switch . ' AS item_price_absolute';
}
/* Обработка дополнительных свойств.
Получаем список свойств, разрешенных для отображения в данной группе и в фильтре */
$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);
// Массив идентификаторов доп. свойств, для которых задан тип отображения "Список - флажками"
$mas_key_list_checkbox = array();
for ($i = 0; $i < $count_properties; $i++)
{
$row = mysql_fetch_assoc($resource_properties);
$element['value'] = 0;
switch ($row['shop_list_of_properties_show_kind'])
{
case 1: // Поле ввода
case 2: // Список - списком
case 3: // Список - переключателями
case 5: // Флажок
{
/* Выбираем режим отображения */
$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'];
//$element['value'] = '%' . $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'] = ''; /* префикс */
// Способ отображения "Поле ввода"
if ($row['shop_list_of_properties_show_kind'] == 1 && !is_numeric($_GET[$get_param]))
{
$element['value'] = '%' . $element['value'] . '%';
$element['if'] = ' LIKE '; /* Условие */
}
else
{
$element['if'] = '='; /* Условие */
}
$element['sufix'] = '';
if ($count_condition)
{
$element['prefix'] = ' OR '; /* префикс */
}
else
{
$element['prefix'] = ' '; /* префикс */
}
$count_condition++;
$param['select'][] = $element;
}
}
case 4: // Тип отображения - список флажками
{
// Модуль "Списки" подключен и значенич доп. свойства не обработаны ранее
if (class_exists('lists') && !in_array($row['lists_id'], $mas_key_list_checkbox))
{
$mas_key_list_checkbox[] = $row['lists_id'];
$lists = & singleton('lists');
// Получаем информацию о элементах списка, который задан для доп. свойства
$list_items_resource = $lists->SelectListsItems($row['lists_id']);
$k = 0;
// Цикл по элементам списка
while($row_list_item = mysql_fetch_assoc($list_items_resource))
{
// Передано значение элемента списка. Формируем запрос.
if (isset($_GET['property_id_' . $row['shop_list_of_properties_id'] .'_item_id_' . $row_list_item['lists_items_id']]))
{
if ($count_condition || $k > 0)
{
$element['prefix'] = ' OR '; /* префикс */
}
else
{
$element['prefix'] = ' ';
}
$element['property_id'] = to_int($row['shop_list_of_properties_id']);
$element['type'] = 1; /* 0 - основное св-во, 1 - дополнительное */
$element['if'] = '='; /* Условие */
$element['value'] = $row_list_item['lists_items_id'];
$element['sufix'] = '';
$param['select'][] = $element;
$external_propertys['property_id_' . to_int($row['shop_list_of_properties_id']) . '_item_id_' . $row_list_item['lists_items_id']] = $element['value'];
$property_xml .= '&property_id_' . to_int($row['shop_list_of_properties_id']) . '_item_id_' . $row_list_item['lists_items_id'] . '=' . $element['value'];
$k++;
}
}
// Задан фильтр по одному из значений списка
if ($k > 0)
{
$count_condition++;
}
}
break;
}
case 6: // Тип отображения - диапазон
{
$get_param_from = 'property_id_' . $row['shop_list_of_properties_id'] . '_from';
$get_param_to = 'property_id_' . $row['shop_list_of_properties_id'] . '_to';
if (isset($_GET[$get_param_from]) && strlen($_GET[$get_param_from]) > 0)
{
$value = floatval($_GET[$get_param_from]);
/* Применять фильтр */
$external_propertys['apply_filter'] = true;
$external_propertys['property_id_'.to_int($row['shop_list_of_properties_id']) . '_from'] = $value;
$property_xml .= '&property_id_' . to_int($row['shop_list_of_properties_id']).'_from=' . $value;
$element['type'] = 1; /* 0 - основное св-во, 1 - дополнительное */
$element['property_id'] = to_int($row['shop_list_of_properties_id']);
$element['if'] = 'IS NOT NULL'; /* Условие */
$element['value'] = '';
$property_row = $shop->GetPropretyOfItems($element['property_id']);
if($property_row['shop_list_of_properties_type'] == 2)
{
$lists_id = to_int($property_row['lists_id']);
$lists = & singleton('lists');
$list_row = $lists->GetListItemsById($lists_id);
$in = array();
if (is_array($list_row) && count($list_row) > 0)
{
foreach ($list_row as $row_lists_items_value)
{
if ($row_lists_items_value['lists_items_value'] >= $value)
{
$in[] = $row_lists_items_value['lists_items_id'];
}
}
}
if(count($in) > 0)
{
$element['sufix'] = 'AND shop_properties_items_table.shop_properties_items_value - 0.0 IN ('.implode(',', $in).') ';
}
else
{
$element['sufix'] = "";
}
}
else
{
$element['sufix'] = " AND shop_properties_items_table.shop_properties_items_value - 0.0 >=$value";
}
if ($count_condition)
{
$element['prefix'] = ' OR '; /* префикс */
}
else
{
$element['prefix'] = ' '; /* префикс */
}
$param['select'][] = $element;
$count_condition++;
}
if (isset($_GET[$get_param_to]) && strlen($_GET[$get_param_to]) > 0)
{
$value = floatval($_GET[$get_param_to]);
/* Применять фильтр */
$external_propertys['apply_filter'] = true;
$external_propertys['property_id_'.to_int($row['shop_list_of_properties_id']) . '_to'] = $value;
$property_xml .= '&property_id_'.to_int($row['shop_list_of_properties_id']).'_to='.$value;
$element['property_id'] = to_int($row['shop_list_of_properties_id']);
$element['type'] = 1; /* 0 - основное св-во, 1 - дополнительное */
$element['if'] = 'IS NOT NULL'; /* Условие */
$element['value'] = '';
$property_row = $shop->GetPropretyOfItems($element['property_id']);
if ($property_row['shop_list_of_properties_type'] == 2)
{
$lists_id = to_int($property_row['lists_id']);
$lists = & singleton('lists');
$list_row = $lists->GetListItemsById($lists_id);
$in = array();
if (is_array($list_row) && count($list_row) > 0)
{
foreach ($list_row as $row_lists_items_value)
{
if($row_lists_items_value['lists_items_value'] <= $value)
{
$in[] = $row_lists_items_value['lists_items_id'];
}
}
}
if(count($in) > 0)
{
$element['sufix'] = 'AND shop_properties_items_table.shop_properties_items_value - 0.0 IN ('.implode(',', $in).') ';
}
else
{
$element['sufix'] = "";
}
}
else
{
$element['sufix'] = "AND shop_properties_items_table.shop_properties_items_value - 0.0 <= $value";
}
if (!(isset($_GET[$get_param_from]) && strlen($_GET[$get_param_from]) > 0))
{
if ($count_condition)
{
$element['prefix'] = ' OR '; /* префикс */
}
else
{
$element['prefix'] = ' '; /* префикс */
}
$count_condition++;
}
else
{
$element['prefix'] = ' AND ';
}
$param['select'][] = $element;
}
break;
}
case 7: // Список - список с множественным выбором
{
// Модуль "Списки" подключен и передан массив значений доп. свойства
if (class_exists('lists') && isset($_GET['property_id_' . $row['shop_list_of_properties_id']]) && is_array($_GET['property_id_' . $row['shop_list_of_properties_id']]))
{
$lists = & singleton('lists');
// Получаем информацию о элементах списка, который задан для доп. свойства
$list_items_resource = $lists->SelectListsItems($row['lists_id']);
$k = 0;
// Цикл по элементам списка
while($row_list_item = mysql_fetch_assoc($list_items_resource))
{
// Передано значение элемента списка. Формируем запрос.
if (in_array($row_list_item['lists_items_id'], $_GET['property_id_' . $row['shop_list_of_properties_id']]))
{
if ($count_condition || $k > 0)
{
$element['prefix'] = ' OR '; /* префикс */
}
else
{
$element['prefix'] = ' ';
}
$element['property_id'] = to_int($row['shop_list_of_properties_id']);
$element['type'] = 1; /* 0 - основное св-во, 1 - дополнительное */
$element['if'] = '='; /* Условие */
$element['value'] = $row_list_item['lists_items_id'];
$element['sufix'] = '';
$param['select'][] = $element;
$external_propertys['property_id_' . to_int($row['shop_list_of_properties_id']) . '_item_id_' . $row_list_item['lists_items_id']] = $element['value'];
$property_xml .= '&property_id_' . to_int($row['shop_list_of_properties_id']) . '_item_id_' . $row_list_item['lists_items_id'] . '=' . $element['value'];
$k++;
}
}
// Задан фильтр по одному из значений списка
if ($k > 0)
{
$count_condition++;
}
}
break;
}
}
}
if (!$count_condition)
{
$element['prefix'] = ' 1'; /* префикс */
}
else
{
$element['prefix'] = ''; // префикс
}
/* добавляем конечный элемент, содержащий HAVING */
$element['type'] = 0; /* 0 - основное св-во, 1 - дополнительное */
/* ОСТАВЛЯЕТЕ БЕЗ ИЗМЕНЕНИЙ, ЭТО НУЖНО ДЛЯ СОРТИРОВКИ */
$element['name'] = ''; /* Имя */
/* поля для основного св-ва, если тип = 1, то не указывается */
$element['if'] = ''; /* Условие */
/* Вот здесь передается ID доп. св-ва, по которому производится сортировка.
ID ВАШЕГО ПОЛЯ УКАЗЫВАЕТЕ ЗДЕСЬ */
$element['value'] = ''; // Значение поля (или параметра)
//if ($count_condition != 0 && ($price_from > 0 || $price_to >0))
if ($count_condition != 0)
{
$param['sql_group_by'] = 'GROUP BY shop_items_catalog_table.shop_items_catalog_item_id';
$param['sql_having'] = "HAVING COUNT(shop_properties_items_table.shop_properties_items_id) = {$count_condition}";
}
else
{
$param['sql_having'] = 'HAVING 1 ';
}
$element['sufix'] = ' ) ';
/* Добавляем в общий список условий */
$param['select'][] = $element;
}
else
{
$param['sql_having'] = 'HAVING 1 ';
}
if ($price_from > 0)
{
$param['sql_having'] .= ' AND item_price_absolute >= ' . $price_from;
}
if ($price_to > 0)
{
$param['sql_having'] .= ' AND item_price_absolute <= ' . $price_to;
}
/* добавляем конечный элемент, содержащий HAVING */
$element['type'] = 0; /* 0 - основное св-во, 1 - дополнительное */
$element['prefix'] = ' AND';
$element['name'] = 'shop_items_catalog_table.shop_shops_id'; /* Имя */
$element['if'] = '='; /* Условие */
$element['value'] = $current_shop_id; // Значение поля (или параметра)
$element['sufix'] = '';
/* Добавляем в общий список условий */
$param['select'][] = $element;
if (!empty($property_xml))
{
$external_propertys['property_xml'] = $property_xml;
}
// Если передано имя тэга - фильтруем
if (isset($GLOBALS['shop_item_path']['tag_name']))
{
if (class_exists('Tag'))
{
$oTag = & singleton('Tag');
$tag_row = $oTag->GetTagByPath($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;
// Разрешаем передачу в XML свойств групп
$param['xml_show_group_property'] = true;
$shop->ShowShop($current_shop_id, $xsl_catalog, $param, $external_propertys);
}
else
{
$mas = $GLOBALS['LA_InformationSystem']->GetInformationSystem($InformationSystem_id);
$order_field = $mas['information_systems_items_order_field'];
$order_type = $mas['information_systems_items_order_type'];
switch ($order_field)
{
default:
case 0:
$name_field = 'information_items_date';
break;
case 1:
$name_field = 'information_items_name';
break;
case 2:
$name_field = 'information_items_order';
break;
}
switch ($order_type)
{
default:
case 0:
$order_field = 'Asc';
break;
case 1:
$order_field = 'Desc';
break;
}
$DataBase = & singleton('DataBase');
$prev = false;
$next = false;
$current_date = date('Y-m-d H:i:s');
$current_group = intval($GLOBALS['INFSYS_result']['group']);
$query = "SELECT SQL_CALC_FOUND_ROWS DISTINCT information_items_table.information_items_id
FROM information_items_table
LEFT JOIN information_groups_table
ON information_items_table.information_groups_id = information_groups_table.information_groups_id
AND information_groups_table.information_groups_access IN (0,6,7,-1)
WHERE 1 AND information_items_table.information_systems_id = '$InformationSystem_id'
AND information_items_table.information_items_status = '1'
AND (information_items_table.information_items_putend_date >= '$current_date'
OR information_items_table.information_items_putend_date ='0000-00-00 00:00:00')
AND information_items_table.information_items_putoff_date <= '$current_date'
AND information_items_table.information_items_access IN (0,6,7,-1)
AND (information_items_table.information_groups_id = '$current_group')
ORDER BY $name_field $order_field LIMIT 0, 9999";
$result = $DataBase->select($query);
while ($row = mysql_fetch_assoc($result))
{
if ($row['information_items_id'] == $item_id)
{
$next_row = mysql_fetch_assoc($result);
$next = $next_row['information_items_id'];
break;
}
$prev = $row['information_items_id'];
}
$item_info = $GLOBALS['LA_InformationSystem']->GetInformationSystemItem($prev);
$item_path = $GLOBALS['LA_InformationSystem']->GetPathItem($prev, '');
if($item_path != '')
{
$external_propertys['PrevName'] = $item_info['information_items_name'];
$external_propertys['PrevLink'] = $item_path;
}
$item_info = $GLOBALS['LA_InformationSystem']->GetInformationSystemItem($next);
$item_path = $GLOBALS['LA_InformationSystem']->GetPathItem($next, '');
if($item_path != '')
{
$external_propertys['NextName'] = $item_info['information_items_name'];
$external_propertys['NextLink'] = $item_path;
}
/* Вывод конкретного элемент */
//$param['show_catalog_item_type'] = array('active', 'inactive');
/* Вывод конкретного элемент */
$shop->ShowItem($GLOBALS['shop_item_path']['item'], $xsl_item, $param, $external_propertys);
}
}
?>
XSL-шаблон:
<?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"/>
<!-- МагазинТовар -->
<xslecimal-format name="my" decimal-separator="," grouping-separator=" "/>
<xsl:template match="/shop">
<xsl:apply-templates select="item"/>
</xsl:template>
<xsl:template match="item">
<SCRIPT>
<xsl:comment>
<xsl:text disable-output-escaping="yes">
<![CDATA[
// массив для хранения текущих рейтингов звезд
var curr_rate = new Array();
// функция работы со звездами рейтинга
function set_rate(id, new_rate)
{
// устанавливаем атрибуты
curr_star = document.getElementById(id);
parent_id = parseInt(curr_star.parentNode.id);
// при первом пересчете ставим рейтинг для группы звезд в 0
if (!curr_rate[parent_id])
{
curr_rate[parent_id] = 0;
}
// устанавливаем новый рейтинг в массив рейтингов и значение скрытого поля
if (new_rate != curr_rate[parent_id] && parseInt(new_rate) > 0)
{
curr_rate[parent_id] = new_rate;
curr_form = document.getElementById('comment_form_0' + (parent_id != 0 ? parent_id : ''));
curr_form.shop_comment_grade.value = curr_rate[parent_id].charAt(curr_rate[parent_id].length - 1);
}
// пересчет стилей для звезд
for (i = 1; i < 6; i++)
{
if (parent_id != 0)
{
j = parent_id + '' + i + '_star_' + i;
}
else
{
j = i + '_star_' + i;
}
temp_obj = document.getElementById(j);
if (new_rate == 0)
{
id = curr_rate[parent_id];
}
if (parseInt(j) > parseInt(id))
{
temp_obj.className = '';
}
else
{
temp_obj.className = 'curr';
}
}
}
function set_count_mod(input_id, step)
{
var oCountMod = document.getElementById(input_id);
if (!(iCurrCount = parseInt(oCountMod.value))) {
iCurrCount = 0;
}
if (!(iCurrCount <= 0 && step < 0)) {
oCountMod.value = iCurrCount + step;
}
}
]]>
</xsl:text>
</xsl:comment>
</SCRIPT>
<!-- Получаем ID родительской группы и записываем в переменную $parent_group_id -->
<xsl:variable name="parent_group_id" select="/shop/@current_group_id"/>
<!-- Информация об ошибках -->
<xsl:variable name="error_code" select="/shop/error"/>
<xsl:if test="$error_code != 0">
<div id="error">
<b>Внимание!</b>Неправильно введен код подтвержения!</div>
</xsl:if>
<xsl:if test="not(/shop/error/node()) and /shop/comment_is_active/node()">
<!-- Информация о выполненном действии -->
<div style="border: 1px solid #dadada; padding: 10px; width: 400px">
<b>
<xsl:choose>
<xsl:when test="/shop/comment_is_active = '0'">Комментарий успешно добавлен и будет опубликован после проверки модератором!</xsl:when>
<xsl:otherwise>Комментарий успешно добавлен и опубликован!</xsl:otherwise>
</xsl:choose>
</b>
</div>
</xsl:if>
<div><table border="0" width="100%"><tr><td width="100%" align="center"><table align="center" border="0" width="100%"><tr><td width="30">
<xsl:if test="/document/PrevName/node()">
<a href="{/document/information_system/url}{/document/PrevLink}"><img src="/images/left.jpg"/></a>
</xsl:if></td><td>
<!-- Изображение для товара, если есть -->
<xsl:if test="image != ''">
<img src="{image}" />
</xsl:if></td><td width="30">
<xsl:if test="/document/NextName/node()">
<br/>
<a href="{/document/information_system/url}{/document/NextLink}"><img src="/images/right.jpg"/></a>
</xsl:if></td></tr></table></td></tr>
<tr><td><table border="0" width="100%"><tr><td width="50%" valign="top">
<p>
<xsl:if test="$parent_group_id = 0">
<a href="{/shop/path}">
<xsl:value-of disable-output-escaping="yes" select="/shop/name"/>
</a>
</xsl:if>
<!-- Путь к группе -->
<xsl:apply-templates select="//group[@id=$parent_group_id]" mode="goup_path"/>
<!-- Если модификация, выводим в пути родительский товар -->
<xsl:if test="/shop/parent_item/node()">
<span class="path_arrow">→</span>
<a href="{/shop/path}{/shop/parent_item/item/fullpath}{/shop/parent_item/item/path}/">
<xsl:value-of disable-output-escaping="yes" select="/shop/parent_item/item/name"/>
</a>
</xsl:if>
<span class="path_arrow">→</span>
<b>
<a href="{/path}">
<xsl:value-of disable-output-escaping="yes" select="name"/>
</a>
</b>
</p>
<p style="font-size: 20pt; font-style: italic;">
<xsl:value-of disable-output-escaping="yes" select="name"/>
</p>
<!-- Средняя оценка товара -->
<xsl:if test="comments/average_grade/node()">
<div style="float: left; margin: 20px 0px 0px 20px">
<xsl:call-template name="show_average_grade">
<xsl:with-param name="grade" select="comments/average_grade"/>
<xsl:with-param name="const_grade" select="5"/>
</xsl:call-template>
</div>
<div style="clear: both"></div>
</xsl:if>
<!-- Описание товара -->
<xsl:value-of disable-output-escaping="yes" select="description" />
</td><td align="left" valign="top">
<xsl:if test="count(property) > 0">
<!-- Свойства в корневой группе -->
<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_items_dir"/>
</xsl:if>
<br/>
<!-- Цена товара -->
<p align="left">Цена:
<span style="font-size: 11pt; font-weight: bold">
<xsl:choose>
<xsl:when test="price_discount != 0">
<xsl:value-of select="format-number(price_discount, '### ##0,00', 'my')"/> <xsl:value-of select="currency" disable-output-escaping="yes"/>
</xsl:when>
<xsl:otherwise>договорная</xsl:otherwise>
</xsl:choose>
</span>
<br/>
<!-- Если цена со скидкой - выводим ее -->
<xsl:if test="price_tax != price_discount">
<span style="color: gray; text-decoration: line-through;">
<xsl:variable name="price_tax" select="price_tax"/>
<span style="font-size: 11pt">
<xsl:value-of select="format-number($price_tax, '### ##0,00', 'my')"/> <xsl:value-of disable-output-escaping="yes" select="currency"/></span>
</span>
<br/>
</xsl:if>
</p>
<!-- Ссылку на добавление в корзины выводим, если:
type = 0 - простой тип товара
type = 1 - электронный товар, при этом остаток на складе больше 0 или -1,
что означает неограниченное количество -->
<xsl:if test="type = 0 or (type = 1 and (eitem_count > 0 or eitem_count = -1))">
<p>
<input type="text" size="3" value="1" id="count_{@id}"/>
<img src="/images/map_intocart.gif" width="12" height="21" border="0" usemap="#mapInToCart{@id}" style="margin: 0 0 -6px 1px;"/><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>
<map name="mapInToCart{@id}">
<area shape="rect" coords="0,0,12,10" onclick="set_count_mod('count_{@id}', 1);" nohref="nohref" />
<area shape="rect" coords="0,11,12,21" onclick="set_count_mod('count_{@id}', -1);" nohref="nohref" />
</map>
</p>
</xsl:if></td></tr></table>
<xsl:if test="marking_of_goods != ''">
<p>Артикул: <b><xsl:value-of disable-output-escaping="yes" select="marking_of_goods"/></b></p>
</xsl:if>
<xsl:if test="producer/name != ''">
<p>Производитель: <b><xsl:value-of disable-output-escaping="yes" select="producer/name"/></b></p>
</xsl:if>
<!-- Если электронный товар, выведим доступное количество -->
<xsl:if test="type = 1">
<p>
<strong>
<xsl:choose>
<xsl:when test="eitem_count = 0">
Электронный товар закончился.
</xsl:when>
<xsl:when test="eitem_count = -1">
Электронный товар доступен для заказа.
</xsl:when>
<xsl:otherwise>
На складе осталось: <xsl:value-of select="eitem_count" /><xsl:text> </xsl:text><xsl:value-of select="mesure" />
</xsl:otherwise>
</xsl:choose>
</strong>
</p>
</xsl:if>
<!-- Текст товара -->
<p>
<xsl:value-of disable-output-escaping="yes" select="text"/>
</p>
<div style="clear: both;"></div>
</td></tr></table>
</div>
<!-- Тэги для информационного элемента -->
<xsl:if test="count(tags/tag) > 0">
<p>
<img src="/hostcmsfiles/images/tags.gif" align="left" style="margin: 0px 5px -2px 0px"/>
<xsl:apply-templates select="tags/tag"/>
</p>
</xsl:if>
<!-- Модификации -->
<xsl:if test="count(modifications/item) > 0">
<b>Модификации:</b>
<table cellspacing="3" cellpadding="3" style="margin-left: -6px;">
<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>
<xsl:if test="count(tying/item) > 0">
<p>
<b>Сопутствующие товары:</b>
</p>
<!-- Отображаем сопутствующие товары -->
<xsl:apply-templates select="tying/item"/>
<div style="clear: both;"></div>
</xsl:if>
<!-- Отзывы о товаре -->
<xsl:if test="count(comments/comment) > 0">
<p class="title">
<a name="comments"></a>Отзывы о товаре</p>
<xsl:apply-templates select="comments/comment" />
</xsl:if>
<div id="ShowAddComment">
<a href="javascript:void(0)" onclick="javascript:cr('AddComment')">Добавить комментарий</a>
</div>
<div id="AddComment" style="display: none">
<xsl:call-template name="AddCommentForm"></xsl:call-template>
</div>
</xsl:template>
<!-- Шаблон вывода добавления комментария -->
<xsl:template name="AddCommentForm">
<xsl:param name="comment_id" select="0"/>
<!-- Заполняем форму -->
<xsl:variable name="subject">
<xsl:if test="/document/form_parent_id/node() and /document/form_parent_id/node() and /document/form_parent_id= $comment_id">
<xsl:value-of select="/document/form_subject"/>
</xsl:if>
</xsl:variable>
<xsl:variable name="email">
<xsl:if test="/document/form_user_email/node() and /document/form_parent_id/node() and /document/form_parent_id= $comment_id">
<xsl:value-of select="/document/form_user_email"/>
</xsl:if>
</xsl:variable>
<xsl:variable name="text">
<xsl:if test="/document/form_text/node() and /document/form_parent_id/node() and /document/form_parent_id= $comment_id">
<xsl:value-of disable-output-escaping="yes" select="/document/form_text"/>
</xsl:if>
</xsl:variable>
<xsl:variable name="name">
<xsl:if test="/document/form_user_name/node() and /document/form_parent_id/node() and /document/form_parent_id= $comment_id">
<xsl:value-of select="/document/form_user_name"/>
</xsl:if>
</xsl:variable>
<div class="comment">
<div class="tl"></div>
<div class="tr"></div>
<div class="bl"></div>
<div class="br"></div>
<!--Отображение формы добавления комментария-->
<form action="{/document/url}" name="comment_form_0{comment_id}" method="post">
<!-- Авторизированным не показываем -->
<xsl:if test="/shop/user_id = 0">
Имя
<br/>
<input type="text" size="70" name="shop_comment_user_name" value="{/shop/shop_comment_user_name}"/>
<p>
E-mail
<br/>
<input id="email{$comment_id}" type="text" size="70" name="shop_comment_user_email" value="{/shop/shop_comment_user_email}"
onblur="FieldCheckEmail(this.id)"
onkeyup="FieldCheckEmail(this.id)"
onkeydown="FieldCheckEmail(this.id)" />
<div id="error_email{$comment_id}"></div>
</p>
</xsl:if>
<p>
Тема
<br/>
<input type="text" size="70" name="shop_comment_subject" value="{/shop/shop_comment_subject}"/>
</p>
<p>
Комментарий
<br/>
<textarea name="shop_comment_text" cols="68" rows="5" class="mceEditor"><xsl:value-of select="/shop/shop_comment_text"/></textarea>
</p>
<p>
Оценка
<br/>
<input type="hidden" name="shop_comment_grade" value="0"/>
<xsl:variable name="ul_id">
<xsl:choose>
<xsl:when test="comment_id > 0"><xsl:value-of select="comment_id"/>_stars</xsl:when>
<xsl:otherwise>0_stars</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<ul id="{$ul_id}" class="stars">
<li onclick="set_rate(this.id, this.id)" onmouseover="set_rate(this.id, '-1')" onmouseout="set_rate(this.id, 0)" id="{comment_id}1_star_1"></li>
<li onclick="set_rate(this.id, this.id)" onmouseover="set_rate(this.id, '-1')" onmouseout="set_rate(this.id, 0)" id="{comment_id}2_star_2"></li>
<li onclick="set_rate(this.id, this.id)" onmouseover="set_rate(this.id, '-1')" onmouseout="set_rate(this.id, 0)" id="{comment_id}3_star_3"></li>
<li onclick="set_rate(this.id, this.id)" onmouseover="set_rate(this.id, '-1')" onmouseout="set_rate(this.id, 0)" id="{comment_id}4_star_4"></li>
<li onclick="set_rate(this.id, this.id)" onmouseover="set_rate(this.id, '-1')" onmouseout="set_rate(this.id, 0)" id="{comment_id}5_star_5"></li>
</ul>
</p>
<br/>
<!-- Обработка CAPTCHA -->
<xsl:if test="//captcha_key != 0 and /shop/user_id = 0">
Контрольные цифры
<sup>
<font color="red">*</font>
</sup>
<div style="float: left">
<img id="comment_{$comment_id}" style="border: 1px solid #000000" src="/captcha.php?get_captcha={captcha_key}{$comment_id}&height=30&width=100" title="Код подтверждения" name="captcha"/>
</div>
<div id="captcha" style="clear:both;">
<img style="border: 0px" src="/hostcmsfiles/images/refresh.gif" /> <a href="javascript:void(0);" onclick="ReNewCaptchaById('comment_{$comment_id}', '{//captcha_key}{$comment_id}', 30); return false;">Показать другое число</a>
</div>
<div style="float: left;margin-top: 5px">
<input type="hidden" name="captcha_key" value="{//captcha_key}{$comment_id}"/>
<input type="text" name="captcha_keystring" size="15"/>
</div>
<div id="captcha" style="clear:both;margin-bottom:10px;">
Введите число, которое указано выше.
</div>
</xsl:if>
<xsl:if test="$comment_id != 0">
<input type="hidden" name="comment_parent_id" value="{comment_id}"/>
</xsl:if>
<p>
<input id="submit_email{$comment_id}" type="submit" name="submit_comment" value="Опубликовать"/>
</p>
</form>
</div>
</xsl:template>
<!-- Вывод раздела для свойств товара -->
<xsl:template match="properties_items_dir">
<xsl:variable name="dir_id" select="@id"/>
<xsl:if test="count(/shop/item/property[@dir_id = $dir_id])">
<!-- Название группы свойств -->
<p><b><xsl:value-of select="shop_properties_items_dir_name"/></b></p>
<table border="0">
<xsl:apply-templates select="/shop/item/property[@dir_id = $dir_id]"/>
</table>
</xsl:if>
<xsl:if test="count(properties_items_dir) > 0">
<blockquote>
<xsl:apply-templates select="properties_items_dir"/>
</blockquote>
</xsl:if>
</xsl:template>
<!-- Вывод строки со значением свойства -->
<xsl:template match="property">
<xsl:if test="value != '' or (type = 1 and file_path != '')">
<tr>
<td>
<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:if>
</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:value-of disable-output-escaping="yes" select="price_discount"/> 
<!-- Валюта -->
<xsl:value-of disable-output-escaping="yes" select="currency"/>
</td>
</tr>
</xsl:template>
<!-- Вывод рейтинга товара -->
<xsl:template name="show_average_grade">
<xsl:param name="grade" select="0"/>
<xsl:param name="const_grade" select="0"/>
<!-- Чтобы избежать зацикливания -->
<xsl:variable name="current_grade" select="$grade * 1"/>
<xsl:choose>
<!-- Если число целое -->
<xsl:when test="floor($current_grade) = $current_grade and not($const_grade > ceiling($current_grade))">
<xsl:if test="$current_grade - 1 > 0">
<xsl:call-template name="show_average_grade">
<xsl:with-param name="grade" select="$current_grade - 1"/>
<xsl:with-param name="const_grade" select="$const_grade - 1"/>
</xsl:call-template>
</xsl:if>
<xsl:if test="$current_grade != 0">
<img src="/hostcmsfiles/images/stars_single.gif"/>
</xsl:if>
</xsl:when>
<xsl:when test="$current_grade != 0 and not($const_grade > ceiling($current_grade))">
<xsl:if test="$current_grade - 0.5 > 0">
<xsl:call-template name="show_average_grade">
<xsl:with-param name="grade" select="$current_grade - 0.5"/>
<xsl:with-param name="const_grade" select="$const_grade - 1"/>
</xsl:call-template>
</xsl:if>
<img src="/hostcmsfiles/images/stars_half.gif"/>
</xsl:when>
<xsl:otherwise>
<!-- Выводим серые звездочки, пока текущая позиция не дойдет то значения, увеличенного до целого -->
<xsl:call-template name="show_average_grade">
<xsl:with-param name="grade" select="$current_grade"/>
<xsl:with-param name="const_grade" select="$const_grade - 1"/>
</xsl:call-template>
<img src="/hostcmsfiles/images/stars_gray.gif"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- Шаблон для вывода звездочек (оценки) -->
<xsl:template name="for">
<xsl:param name="i" select="0"/>
<xsl:param name="n"/>
<input type="radio" name="shop_comment_grade" value="{$i}" id="id_shop_comment_grade_{$i}">
<xsl:if test="/shop/shop_comment_grade = $i">
<xsl:attribute name="checked">
</xsl:attribute>
</xsl:if>
</input> 
<label for="id_shop_comment_grade_{$i}">
<xsl:call-template name="show_average_grade">
<xsl:with-param name="grade" select="$i"/>
<xsl:with-param name="const_grade" select="5"/>
</xsl:call-template>
</label>
<br/>
<xsl:if test="$n > $i and $n > 1">
<xsl:call-template name="for">
<xsl:with-param name="i" select="$i + 1"/>
<xsl:with-param name="n" select="$n"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<!-- Шаблон для отзывов -->
<xsl:template match="comments/comment">
<a name="comment{@id}"></a>
<div class="comment">
<div class="tl"></div>
<div class="tr"></div>
<div class="bl"></div>
<div class="br"></div>
<xsl:if test="subject != ''">
<div>
<strong>
<xsl:value-of select="subject"/>
</strong>
</div>
</xsl:if>
<xsl:value-of select="text" disable-output-escaping="yes"/>
<!-- Оценка комментария -->
<xsl:if test="grade != 0">
<div>Оценка:
<xsl:call-template name="show_average_grade">
<xsl:with-param name="grade" select="grade"/>
<xsl:with-param name="const_grade" select="5"/>
</xsl:call-template>
</div>
</xsl:if>
</div>
<div class="comment_desc">
<xsl:choose>
<xsl:when test="user_name">
<xsl:value-of select="user_name"/>
</xsl:when>
<xsl:otherwise>
<img src="/hostcmsfiles/images/user.gif" style="margin: 0px 5px -4px 0px" />
<b>
<a href="/users/info/{site_user_login}/" class="c_u_l" ><xsl:value-of select="site_user_login"/></a>
</b>
</xsl:otherwise>
</xsl:choose> · <xsl:value-of select="date_time"/> · <a href="{/shop/path}{/shop/item/fullpath}{/shop/item/path}/#comment{@id}" title="ссылка">#</a>
</div>
</xsl:template>
<!-- Шаблон для скидки -->
<xsl:template match="discount">
<p>
<xsl:value-of disable-output-escaping="yes" select="name"/> <xsl:value-of disable-output-escaping="yes" select="value"/>%
</p>
</xsl:template>
<xsl:template match="tying/item">
<div style="clear: both">
<p>
<a href="{/shop/path}{fullpath}{path}/">
<xsl:value-of select="name"/>
</a>
</p>
<!-- Изображение для товара, если есть -->
<xsl:if test="small_image != ''">
<a href="{/shop/path}{fullpath}{path}/">
<img src="{small_image}" align="left" style="border: 1px solid #000000; margin: 0px 5px 5px 0px"/>
</a>
</xsl:if>
<p>
<xsl:value-of disable-output-escaping="yes" select="description"/>
</p>
<!-- Цена товара -->
<strong>
<xsl:choose>
<xsl:when test="price_discount != 0">
<xsl:value-of disable-output-escaping="yes" select="price_discount"/> 
<!-- Валюта товара -->
<xsl:value-of disable-output-escaping="yes" select="currency"/>
</xsl:when>
<xsl:otherwise>договорная</xsl:otherwise>
</xsl:choose>
</strong>
<!-- Если цена со скидкой - выводим ее -->
<xsl:if test="price_tax != price_discount">
<br/>
<font color="gray">
<strike>
<xsl:value-of disable-output-escaping="yes" select="price_tax"/> <xsl:value-of disable-output-escaping="yes" select="currency"/></strike>
</font>
</xsl:if>
<!-- Если указан вес товара -->
<xsl:if test="weight != 0">
<br/>Вес товара: <xsl:value-of select="weight"/> <xsl:value-of select="weight_mesure"/></xsl:if>
</div>
</xsl:template>
<!-- Шаблон выводит хлебные крошки -->
<xsl:template match="group" mode="goup_path">
<xsl:variable name="parent_id" select="@parent"/>
<!-- Выбираем рекурсивно вышестоящую группу -->
<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>
<a href="{/shop/path}{fullpath}">
<xsl:value-of select="name"/>
</a>
</xsl:template>
</xsl:stylesheet>
Итог - ошибка:
ЗАМЕЧАНИЕ: Undefined index: LA_InformationSystem в файле /home/kentavr8/public_html/2/lib/lib_6/lib_6.php (строка 795)
Fatal error: Call to a member function GetInformationSystem() on a non-object in /home/kentavr8/public_html/2/lib/lib_6/lib_6.php on line 795
Адрес:http://2.resurs-mk.ru/catalog-mebeli/nabory-dlya-gostinoy/angel/
Типовая страница:
<?php
function SetGroups($mas_groups, $set)
{
$mas_groups = to_array($mas_groups);
foreach ($mas_groups as $key=>$value)
{
foreach ($value as $key1=>$value1)
{
$set[] = $value1;
if ($value1 == $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)
{
$external_propertys = array();
if (class_exists("SiteUsers")
{
/* Получаем id текущего пользователя сайта */
$SiteUsers = & singleton('SiteUsers');
$site_user_id = $SiteUsers->GetCurrentSiteUser();
$param['user_id'] = $site_user_id;
$external_propertys['user_id'] = $SiteUsers->GetCurrentSiteUser();
}
else
{
$site_user_id = 0;
$external_propertys['user_id'] = 0;
}
// Если добавление комментария
if (isset($_POST['submit_comment']) && !empty($GLOBALS['shop_item_path']['item']))
{
/* Проверяем CAPCHA*/
$Captcha = new Captcha();
$xmlData = '<?xml version="1.0" encoding="' . SITE_CODING . '"?>' . "\n";
$xmlData .= '<document>' . "\n";
if ($site_user_id > 0
|| $Captcha->ValidCaptcha(to_str($_POST['captcha_key']), to_str($_POST['captcha_keystring'])))
{
$param['shop_items_catalog_item_id'] = $GLOBALS['shop_item_path']['item'];
$param['shop_comment_user_name'] = to_str($_REQUEST['shop_comment_user_name']);
$param['shop_comment_user_email'] = to_str($_REQUEST['shop_comment_user_email']);
$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'];
// Если есть модуль "Пользователи сайта", получим текущего пользователя
if (class_exists('SiteUsers'))
{
$SiteUsers = & singleton('SiteUsers');
$param['site_users_id'] = $SiteUsers->GetCurrentSiteUser();
}
else
{
$param['site_users_id'] = 0;
}
$shop_comment_id = $shop->InsertComment($param);
// Задан XSL для формирования письма администратору о добавлении комментария к товару
if (to_str($GLOBALS['LA']['xsl_add_comment_letter_to_admin']) != '')
{
// Формируем XML для комментария
$xmlData .= $shop->GenXml4Comment($shop_comment_id);
$xmlData .= '</document>' . "\n";
$xsl = new xsl();
// Формируем текст письма администратору
$message = $xsl->build($xmlData, $GLOBALS['LA']['xsl_add_comment_letter_to_admin']);
// Формат письма - текст
if (to_int($GLOBALS['LA']['comment_mail_type']) == 0)
{
$comment_mail_type = 'text/plain';
}
else
{
$comment_mail_type = 'text/html';
}
$subject = $GLOBALS['MSG_shops']['subject_report_for_comment'];
$kernel = & singleton('kernel');
// Получаем e-mail куратора магазина
$email_to = to_str($shop_row['shop_shops_admin_mail']);
if (!empty($email_to))
{
$kernel->SendMailWithFile($email_to, EMAIL_TO, $subject, $message, array(), $comment_mail_type);
}
}
}
else
{
/* Неправильно введен код изображенный на картинке */
$external_propertys['error'] = 1;
/* Запоминаем значения */
$external_propertys['shop_comment_user_name'] = strip_tags(to_str($_REQUEST['shop_comment_user_name']));
$external_propertys['shop_comment_user_email'] = strip_tags(to_str($_REQUEST['shop_comment_user_email']));
$external_propertys['shop_comment_subject'] = strip_tags(to_str($_REQUEST['shop_comment_subject']));
$external_propertys['shop_comment_text'] = strip_tags(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'])
{
$param['current_group_id'] = $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;
}
/* Ограничиваем по продавцу */
if (to_int($_GET['saller_id']) > 0)
{
$element['type'] = 0; // 0 - основное св-во, 1 - дополнительное
$element['name'] = 'shop_sallers_id';
$element['prefix'] = 'AND'; // префикс
$element['if'] = '='; // Условие
$element['value'] = to_int($_GET['saller_id']);
$element['sufix'] = '';
$param['select'][] = $element;
$external_propertys['saller_id'] = to_int($_GET['saller_id']);
/* Применять фильтр */
$external_propertys['apply_filter'] = true;
}
$price_from = str_replace(',', '.', to_float($_GET['price_from']));
/* Ограничиваем по цене ОТ */
if ($price_from > 0)
{
$external_propertys['price_from'] = $price_from;
/* Применять фильтр */
$external_propertys['apply_filter'] = true;
}
$price_to = str_replace(',', '.', to_float($_GET['price_to']));
/* Ограничиваем по цене ДО */
if ($price_to > 0)
{
$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_field_order'] = 'item_price_absolute';
$param['items_order'] = $order_direction;
$external_propertys['sort_by_field'] = $sort_field;
$external_propertys['order_direction'] = $order_direction;
break;
}
case 3: /* По оценке*/
{
$param['items_field_order'] = 'shop_comment_grade';
$param['items_order'] = $order_direction;
$external_propertys['sort_by_field'] = $sort_field;
$external_propertys['order_direction'] = $order_direction;
break;
}
}
// Задан фильтр и/или сортировка по цене
if ($price_from > 0 || $price_to > 0 || $sort_field == 2)
{
// Получаем список валют магазина
$currency_result = $shop->GetAllCurrency();
$query_currency_switch = 'shop_items_catalog_price';
// Цикл по валютам магазина
while ($currency_row = mysql_fetch_assoc($currency_result))
{
// Получаем коэффициент пересчета для каждой валюты
$currency_coefficient = $shop->GetCurrencyCoefficientToShopCurrency($currency_row['shop_currency_id'], $shop_row['shop_currency_id']);
$query_currency_switch = "IF (shop_items_catalog_table.shop_currency_id = {$currency_row['shop_currency_id']}, shop_items_catalog_table.shop_items_catalog_price * $currency_coefficient, $query_currency_switch)";
}
$param['sql_external_select'] = ' ,' . $query_currency_switch . ' AS item_price_absolute';
}
/* Обработка дополнительных свойств.
Получаем список свойств, разрешенных для отображения в данной группе и в фильтре */
$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);
// Массив идентификаторов доп. свойств, для которых задан тип отображения "Список - флажками"
$mas_key_list_checkbox = array();
for ($i = 0; $i < $count_properties; $i++)
{
$row = mysql_fetch_assoc($resource_properties);
$element['value'] = 0;
switch ($row['shop_list_of_properties_show_kind'])
{
case 1: // Поле ввода
case 2: // Список - списком
case 3: // Список - переключателями
case 5: // Флажок
{
/* Выбираем режим отображения */
$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'];
//$element['value'] = '%' . $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'] = ''; /* префикс */
// Способ отображения "Поле ввода"
if ($row['shop_list_of_properties_show_kind'] == 1 && !is_numeric($_GET[$get_param]))
{
$element['value'] = '%' . $element['value'] . '%';
$element['if'] = ' LIKE '; /* Условие */
}
else
{
$element['if'] = '='; /* Условие */
}
$element['sufix'] = '';
if ($count_condition)
{
$element['prefix'] = ' OR '; /* префикс */
}
else
{
$element['prefix'] = ' '; /* префикс */
}
$count_condition++;
$param['select'][] = $element;
}
}
case 4: // Тип отображения - список флажками
{
// Модуль "Списки" подключен и значенич доп. свойства не обработаны ранее
if (class_exists('lists') && !in_array($row['lists_id'], $mas_key_list_checkbox))
{
$mas_key_list_checkbox[] = $row['lists_id'];
$lists = & singleton('lists');
// Получаем информацию о элементах списка, который задан для доп. свойства
$list_items_resource = $lists->SelectListsItems($row['lists_id']);
$k = 0;
// Цикл по элементам списка
while($row_list_item = mysql_fetch_assoc($list_items_resource))
{
// Передано значение элемента списка. Формируем запрос.
if (isset($_GET['property_id_' . $row['shop_list_of_properties_id'] .'_item_id_' . $row_list_item['lists_items_id']]))
{
if ($count_condition || $k > 0)
{
$element['prefix'] = ' OR '; /* префикс */
}
else
{
$element['prefix'] = ' ';
}
$element['property_id'] = to_int($row['shop_list_of_properties_id']);
$element['type'] = 1; /* 0 - основное св-во, 1 - дополнительное */
$element['if'] = '='; /* Условие */
$element['value'] = $row_list_item['lists_items_id'];
$element['sufix'] = '';
$param['select'][] = $element;
$external_propertys['property_id_' . to_int($row['shop_list_of_properties_id']) . '_item_id_' . $row_list_item['lists_items_id']] = $element['value'];
$property_xml .= '&property_id_' . to_int($row['shop_list_of_properties_id']) . '_item_id_' . $row_list_item['lists_items_id'] . '=' . $element['value'];
$k++;
}
}
// Задан фильтр по одному из значений списка
if ($k > 0)
{
$count_condition++;
}
}
break;
}
case 6: // Тип отображения - диапазон
{
$get_param_from = 'property_id_' . $row['shop_list_of_properties_id'] . '_from';
$get_param_to = 'property_id_' . $row['shop_list_of_properties_id'] . '_to';
if (isset($_GET[$get_param_from]) && strlen($_GET[$get_param_from]) > 0)
{
$value = floatval($_GET[$get_param_from]);
/* Применять фильтр */
$external_propertys['apply_filter'] = true;
$external_propertys['property_id_'.to_int($row['shop_list_of_properties_id']) . '_from'] = $value;
$property_xml .= '&property_id_' . to_int($row['shop_list_of_properties_id']).'_from=' . $value;
$element['type'] = 1; /* 0 - основное св-во, 1 - дополнительное */
$element['property_id'] = to_int($row['shop_list_of_properties_id']);
$element['if'] = 'IS NOT NULL'; /* Условие */
$element['value'] = '';
$property_row = $shop->GetPropretyOfItems($element['property_id']);
if($property_row['shop_list_of_properties_type'] == 2)
{
$lists_id = to_int($property_row['lists_id']);
$lists = & singleton('lists');
$list_row = $lists->GetListItemsById($lists_id);
$in = array();
if (is_array($list_row) && count($list_row) > 0)
{
foreach ($list_row as $row_lists_items_value)
{
if ($row_lists_items_value['lists_items_value'] >= $value)
{
$in[] = $row_lists_items_value['lists_items_id'];
}
}
}
if(count($in) > 0)
{
$element['sufix'] = 'AND shop_properties_items_table.shop_properties_items_value - 0.0 IN ('.implode(',', $in).') ';
}
else
{
$element['sufix'] = "";
}
}
else
{
$element['sufix'] = " AND shop_properties_items_table.shop_properties_items_value - 0.0 >=$value";
}
if ($count_condition)
{
$element['prefix'] = ' OR '; /* префикс */
}
else
{
$element['prefix'] = ' '; /* префикс */
}
$param['select'][] = $element;
$count_condition++;
}
if (isset($_GET[$get_param_to]) && strlen($_GET[$get_param_to]) > 0)
{
$value = floatval($_GET[$get_param_to]);
/* Применять фильтр */
$external_propertys['apply_filter'] = true;
$external_propertys['property_id_'.to_int($row['shop_list_of_properties_id']) . '_to'] = $value;
$property_xml .= '&property_id_'.to_int($row['shop_list_of_properties_id']).'_to='.$value;
$element['property_id'] = to_int($row['shop_list_of_properties_id']);
$element['type'] = 1; /* 0 - основное св-во, 1 - дополнительное */
$element['if'] = 'IS NOT NULL'; /* Условие */
$element['value'] = '';
$property_row = $shop->GetPropretyOfItems($element['property_id']);
if ($property_row['shop_list_of_properties_type'] == 2)
{
$lists_id = to_int($property_row['lists_id']);
$lists = & singleton('lists');
$list_row = $lists->GetListItemsById($lists_id);
$in = array();
if (is_array($list_row) && count($list_row) > 0)
{
foreach ($list_row as $row_lists_items_value)
{
if($row_lists_items_value['lists_items_value'] <= $value)
{
$in[] = $row_lists_items_value['lists_items_id'];
}
}
}
if(count($in) > 0)
{
$element['sufix'] = 'AND shop_properties_items_table.shop_properties_items_value - 0.0 IN ('.implode(',', $in).') ';
}
else
{
$element['sufix'] = "";
}
}
else
{
$element['sufix'] = "AND shop_properties_items_table.shop_properties_items_value - 0.0 <= $value";
}
if (!(isset($_GET[$get_param_from]) && strlen($_GET[$get_param_from]) > 0))
{
if ($count_condition)
{
$element['prefix'] = ' OR '; /* префикс */
}
else
{
$element['prefix'] = ' '; /* префикс */
}
$count_condition++;
}
else
{
$element['prefix'] = ' AND ';
}
$param['select'][] = $element;
}
break;
}
case 7: // Список - список с множественным выбором
{
// Модуль "Списки" подключен и передан массив значений доп. свойства
if (class_exists('lists') && isset($_GET['property_id_' . $row['shop_list_of_properties_id']]) && is_array($_GET['property_id_' . $row['shop_list_of_properties_id']]))
{
$lists = & singleton('lists');
// Получаем информацию о элементах списка, который задан для доп. свойства
$list_items_resource = $lists->SelectListsItems($row['lists_id']);
$k = 0;
// Цикл по элементам списка
while($row_list_item = mysql_fetch_assoc($list_items_resource))
{
// Передано значение элемента списка. Формируем запрос.
if (in_array($row_list_item['lists_items_id'], $_GET['property_id_' . $row['shop_list_of_properties_id']]))
{
if ($count_condition || $k > 0)
{
$element['prefix'] = ' OR '; /* префикс */
}
else
{
$element['prefix'] = ' ';
}
$element['property_id'] = to_int($row['shop_list_of_properties_id']);
$element['type'] = 1; /* 0 - основное св-во, 1 - дополнительное */
$element['if'] = '='; /* Условие */
$element['value'] = $row_list_item['lists_items_id'];
$element['sufix'] = '';
$param['select'][] = $element;
$external_propertys['property_id_' . to_int($row['shop_list_of_properties_id']) . '_item_id_' . $row_list_item['lists_items_id']] = $element['value'];
$property_xml .= '&property_id_' . to_int($row['shop_list_of_properties_id']) . '_item_id_' . $row_list_item['lists_items_id'] . '=' . $element['value'];
$k++;
}
}
// Задан фильтр по одному из значений списка
if ($k > 0)
{
$count_condition++;
}
}
break;
}
}
}
if (!$count_condition)
{
$element['prefix'] = ' 1'; /* префикс */
}
else
{
$element['prefix'] = ''; // префикс
}
/* добавляем конечный элемент, содержащий HAVING */
$element['type'] = 0; /* 0 - основное св-во, 1 - дополнительное */
/* ОСТАВЛЯЕТЕ БЕЗ ИЗМЕНЕНИЙ, ЭТО НУЖНО ДЛЯ СОРТИРОВКИ */
$element['name'] = ''; /* Имя */
/* поля для основного св-ва, если тип = 1, то не указывается */
$element['if'] = ''; /* Условие */
/* Вот здесь передается ID доп. св-ва, по которому производится сортировка.
ID ВАШЕГО ПОЛЯ УКАЗЫВАЕТЕ ЗДЕСЬ */
$element['value'] = ''; // Значение поля (или параметра)
//if ($count_condition != 0 && ($price_from > 0 || $price_to >0))
if ($count_condition != 0)
{
$param['sql_group_by'] = 'GROUP BY shop_items_catalog_table.shop_items_catalog_item_id';
$param['sql_having'] = "HAVING COUNT(shop_properties_items_table.shop_properties_items_id) = {$count_condition}";
}
else
{
$param['sql_having'] = 'HAVING 1 ';
}
$element['sufix'] = ' ) ';
/* Добавляем в общий список условий */
$param['select'][] = $element;
}
else
{
$param['sql_having'] = 'HAVING 1 ';
}
if ($price_from > 0)
{
$param['sql_having'] .= ' AND item_price_absolute >= ' . $price_from;
}
if ($price_to > 0)
{
$param['sql_having'] .= ' AND item_price_absolute <= ' . $price_to;
}
/* добавляем конечный элемент, содержащий HAVING */
$element['type'] = 0; /* 0 - основное св-во, 1 - дополнительное */
$element['prefix'] = ' AND';
$element['name'] = 'shop_items_catalog_table.shop_shops_id'; /* Имя */
$element['if'] = '='; /* Условие */
$element['value'] = $current_shop_id; // Значение поля (или параметра)
$element['sufix'] = '';
/* Добавляем в общий список условий */
$param['select'][] = $element;
if (!empty($property_xml))
{
$external_propertys['property_xml'] = $property_xml;
}
// Если передано имя тэга - фильтруем
if (isset($GLOBALS['shop_item_path']['tag_name']))
{
if (class_exists('Tag'))
{
$oTag = & singleton('Tag');
$tag_row = $oTag->GetTagByPath($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;
// Разрешаем передачу в XML свойств групп
$param['xml_show_group_property'] = true;
$shop->ShowShop($current_shop_id, $xsl_catalog, $param, $external_propertys);
}
else
{
$mas = $GLOBALS['LA_InformationSystem']->GetInformationSystem($InformationSystem_id);
$order_field = $mas['information_systems_items_order_field'];
$order_type = $mas['information_systems_items_order_type'];
switch ($order_field)
{
default:
case 0:
$name_field = 'information_items_date';
break;
case 1:
$name_field = 'information_items_name';
break;
case 2:
$name_field = 'information_items_order';
break;
}
switch ($order_type)
{
default:
case 0:
$order_field = 'Asc';
break;
case 1:
$order_field = 'Desc';
break;
}
$DataBase = & singleton('DataBase');
$prev = false;
$next = false;
$current_date = date('Y-m-d H:i:s');
$current_group = intval($GLOBALS['INFSYS_result']['group']);
$query = "SELECT SQL_CALC_FOUND_ROWS DISTINCT information_items_table.information_items_id
FROM information_items_table
LEFT JOIN information_groups_table
ON information_items_table.information_groups_id = information_groups_table.information_groups_id
AND information_groups_table.information_groups_access IN (0,6,7,-1)
WHERE 1 AND information_items_table.information_systems_id = '$InformationSystem_id'
AND information_items_table.information_items_status = '1'
AND (information_items_table.information_items_putend_date >= '$current_date'
OR information_items_table.information_items_putend_date ='0000-00-00 00:00:00')
AND information_items_table.information_items_putoff_date <= '$current_date'
AND information_items_table.information_items_access IN (0,6,7,-1)
AND (information_items_table.information_groups_id = '$current_group')
ORDER BY $name_field $order_field LIMIT 0, 9999";
$result = $DataBase->select($query);
while ($row = mysql_fetch_assoc($result))
{
if ($row['information_items_id'] == $item_id)
{
$next_row = mysql_fetch_assoc($result);
$next = $next_row['information_items_id'];
break;
}
$prev = $row['information_items_id'];
}
$item_info = $GLOBALS['LA_InformationSystem']->GetInformationSystemItem($prev);
$item_path = $GLOBALS['LA_InformationSystem']->GetPathItem($prev, '');
if($item_path != '')
{
$external_propertys['PrevName'] = $item_info['information_items_name'];
$external_propertys['PrevLink'] = $item_path;
}
$item_info = $GLOBALS['LA_InformationSystem']->GetInformationSystemItem($next);
$item_path = $GLOBALS['LA_InformationSystem']->GetPathItem($next, '');
if($item_path != '')
{
$external_propertys['NextName'] = $item_info['information_items_name'];
$external_propertys['NextLink'] = $item_path;
}
/* Вывод конкретного элемент */
//$param['show_catalog_item_type'] = array('active', 'inactive');
/* Вывод конкретного элемент */
$shop->ShowItem($GLOBALS['shop_item_path']['item'], $xsl_item, $param, $external_propertys);
}
}
?>
XSL-шаблон:
<?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"/>
<!-- МагазинТовар -->
<xslecimal-format name="my" decimal-separator="," grouping-separator=" "/>
<xsl:template match="/shop">
<xsl:apply-templates select="item"/>
</xsl:template>
<xsl:template match="item">
<SCRIPT>
<xsl:comment>
<xsl:text disable-output-escaping="yes">
<![CDATA[
// массив для хранения текущих рейтингов звезд
var curr_rate = new Array();
// функция работы со звездами рейтинга
function set_rate(id, new_rate)
{
// устанавливаем атрибуты
curr_star = document.getElementById(id);
parent_id = parseInt(curr_star.parentNode.id);
// при первом пересчете ставим рейтинг для группы звезд в 0
if (!curr_rate[parent_id])
{
curr_rate[parent_id] = 0;
}
// устанавливаем новый рейтинг в массив рейтингов и значение скрытого поля
if (new_rate != curr_rate[parent_id] && parseInt(new_rate) > 0)
{
curr_rate[parent_id] = new_rate;
curr_form = document.getElementById('comment_form_0' + (parent_id != 0 ? parent_id : ''));
curr_form.shop_comment_grade.value = curr_rate[parent_id].charAt(curr_rate[parent_id].length - 1);
}
// пересчет стилей для звезд
for (i = 1; i < 6; i++)
{
if (parent_id != 0)
{
j = parent_id + '' + i + '_star_' + i;
}
else
{
j = i + '_star_' + i;
}
temp_obj = document.getElementById(j);
if (new_rate == 0)
{
id = curr_rate[parent_id];
}
if (parseInt(j) > parseInt(id))
{
temp_obj.className = '';
}
else
{
temp_obj.className = 'curr';
}
}
}
function set_count_mod(input_id, step)
{
var oCountMod = document.getElementById(input_id);
if (!(iCurrCount = parseInt(oCountMod.value))) {
iCurrCount = 0;
}
if (!(iCurrCount <= 0 && step < 0)) {
oCountMod.value = iCurrCount + step;
}
}
]]>
</xsl:text>
</xsl:comment>
</SCRIPT>
<!-- Получаем ID родительской группы и записываем в переменную $parent_group_id -->
<xsl:variable name="parent_group_id" select="/shop/@current_group_id"/>
<!-- Информация об ошибках -->
<xsl:variable name="error_code" select="/shop/error"/>
<xsl:if test="$error_code != 0">
<div id="error">
<b>Внимание!</b>Неправильно введен код подтвержения!</div>
</xsl:if>
<xsl:if test="not(/shop/error/node()) and /shop/comment_is_active/node()">
<!-- Информация о выполненном действии -->
<div style="border: 1px solid #dadada; padding: 10px; width: 400px">
<b>
<xsl:choose>
<xsl:when test="/shop/comment_is_active = '0'">Комментарий успешно добавлен и будет опубликован после проверки модератором!</xsl:when>
<xsl:otherwise>Комментарий успешно добавлен и опубликован!</xsl:otherwise>
</xsl:choose>
</b>
</div>
</xsl:if>
<div><table border="0" width="100%"><tr><td width="100%" align="center"><table align="center" border="0" width="100%"><tr><td width="30">
<xsl:if test="/document/PrevName/node()">
<a href="{/document/information_system/url}{/document/PrevLink}"><img src="/images/left.jpg"/></a>
</xsl:if></td><td>
<!-- Изображение для товара, если есть -->
<xsl:if test="image != ''">
<img src="{image}" />
</xsl:if></td><td width="30">
<xsl:if test="/document/NextName/node()">
<br/>
<a href="{/document/information_system/url}{/document/NextLink}"><img src="/images/right.jpg"/></a>
</xsl:if></td></tr></table></td></tr>
<tr><td><table border="0" width="100%"><tr><td width="50%" valign="top">
<p>
<xsl:if test="$parent_group_id = 0">
<a href="{/shop/path}">
<xsl:value-of disable-output-escaping="yes" select="/shop/name"/>
</a>
</xsl:if>
<!-- Путь к группе -->
<xsl:apply-templates select="//group[@id=$parent_group_id]" mode="goup_path"/>
<!-- Если модификация, выводим в пути родительский товар -->
<xsl:if test="/shop/parent_item/node()">
<span class="path_arrow">→</span>
<a href="{/shop/path}{/shop/parent_item/item/fullpath}{/shop/parent_item/item/path}/">
<xsl:value-of disable-output-escaping="yes" select="/shop/parent_item/item/name"/>
</a>
</xsl:if>
<span class="path_arrow">→</span>
<b>
<a href="{/path}">
<xsl:value-of disable-output-escaping="yes" select="name"/>
</a>
</b>
</p>
<p style="font-size: 20pt; font-style: italic;">
<xsl:value-of disable-output-escaping="yes" select="name"/>
</p>
<!-- Средняя оценка товара -->
<xsl:if test="comments/average_grade/node()">
<div style="float: left; margin: 20px 0px 0px 20px">
<xsl:call-template name="show_average_grade">
<xsl:with-param name="grade" select="comments/average_grade"/>
<xsl:with-param name="const_grade" select="5"/>
</xsl:call-template>
</div>
<div style="clear: both"></div>
</xsl:if>
<!-- Описание товара -->
<xsl:value-of disable-output-escaping="yes" select="description" />
</td><td align="left" valign="top">
<xsl:if test="count(property) > 0">
<!-- Свойства в корневой группе -->
<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_items_dir"/>
</xsl:if>
<br/>
<!-- Цена товара -->
<p align="left">Цена:
<span style="font-size: 11pt; font-weight: bold">
<xsl:choose>
<xsl:when test="price_discount != 0">
<xsl:value-of select="format-number(price_discount, '### ##0,00', 'my')"/> <xsl:value-of select="currency" disable-output-escaping="yes"/>
</xsl:when>
<xsl:otherwise>договорная</xsl:otherwise>
</xsl:choose>
</span>
<br/>
<!-- Если цена со скидкой - выводим ее -->
<xsl:if test="price_tax != price_discount">
<span style="color: gray; text-decoration: line-through;">
<xsl:variable name="price_tax" select="price_tax"/>
<span style="font-size: 11pt">
<xsl:value-of select="format-number($price_tax, '### ##0,00', 'my')"/> <xsl:value-of disable-output-escaping="yes" select="currency"/></span>
</span>
<br/>
</xsl:if>
</p>
<!-- Ссылку на добавление в корзины выводим, если:
type = 0 - простой тип товара
type = 1 - электронный товар, при этом остаток на складе больше 0 или -1,
что означает неограниченное количество -->
<xsl:if test="type = 0 or (type = 1 and (eitem_count > 0 or eitem_count = -1))">
<p>
<input type="text" size="3" value="1" id="count_{@id}"/>
<img src="/images/map_intocart.gif" width="12" height="21" border="0" usemap="#mapInToCart{@id}" style="margin: 0 0 -6px 1px;"/><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>
<map name="mapInToCart{@id}">
<area shape="rect" coords="0,0,12,10" onclick="set_count_mod('count_{@id}', 1);" nohref="nohref" />
<area shape="rect" coords="0,11,12,21" onclick="set_count_mod('count_{@id}', -1);" nohref="nohref" />
</map>
</p>
</xsl:if></td></tr></table>
<xsl:if test="marking_of_goods != ''">
<p>Артикул: <b><xsl:value-of disable-output-escaping="yes" select="marking_of_goods"/></b></p>
</xsl:if>
<xsl:if test="producer/name != ''">
<p>Производитель: <b><xsl:value-of disable-output-escaping="yes" select="producer/name"/></b></p>
</xsl:if>
<!-- Если электронный товар, выведим доступное количество -->
<xsl:if test="type = 1">
<p>
<strong>
<xsl:choose>
<xsl:when test="eitem_count = 0">
Электронный товар закончился.
</xsl:when>
<xsl:when test="eitem_count = -1">
Электронный товар доступен для заказа.
</xsl:when>
<xsl:otherwise>
На складе осталось: <xsl:value-of select="eitem_count" /><xsl:text> </xsl:text><xsl:value-of select="mesure" />
</xsl:otherwise>
</xsl:choose>
</strong>
</p>
</xsl:if>
<!-- Текст товара -->
<p>
<xsl:value-of disable-output-escaping="yes" select="text"/>
</p>
<div style="clear: both;"></div>
</td></tr></table>
</div>
<!-- Тэги для информационного элемента -->
<xsl:if test="count(tags/tag) > 0">
<p>
<img src="/hostcmsfiles/images/tags.gif" align="left" style="margin: 0px 5px -2px 0px"/>
<xsl:apply-templates select="tags/tag"/>
</p>
</xsl:if>
<!-- Модификации -->
<xsl:if test="count(modifications/item) > 0">
<b>Модификации:</b>
<table cellspacing="3" cellpadding="3" style="margin-left: -6px;">
<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>
<xsl:if test="count(tying/item) > 0">
<p>
<b>Сопутствующие товары:</b>
</p>
<!-- Отображаем сопутствующие товары -->
<xsl:apply-templates select="tying/item"/>
<div style="clear: both;"></div>
</xsl:if>
<!-- Отзывы о товаре -->
<xsl:if test="count(comments/comment) > 0">
<p class="title">
<a name="comments"></a>Отзывы о товаре</p>
<xsl:apply-templates select="comments/comment" />
</xsl:if>
<div id="ShowAddComment">
<a href="javascript:void(0)" onclick="javascript:cr('AddComment')">Добавить комментарий</a>
</div>
<div id="AddComment" style="display: none">
<xsl:call-template name="AddCommentForm"></xsl:call-template>
</div>
</xsl:template>
<!-- Шаблон вывода добавления комментария -->
<xsl:template name="AddCommentForm">
<xsl:param name="comment_id" select="0"/>
<!-- Заполняем форму -->
<xsl:variable name="subject">
<xsl:if test="/document/form_parent_id/node() and /document/form_parent_id/node() and /document/form_parent_id= $comment_id">
<xsl:value-of select="/document/form_subject"/>
</xsl:if>
</xsl:variable>
<xsl:variable name="email">
<xsl:if test="/document/form_user_email/node() and /document/form_parent_id/node() and /document/form_parent_id= $comment_id">
<xsl:value-of select="/document/form_user_email"/>
</xsl:if>
</xsl:variable>
<xsl:variable name="text">
<xsl:if test="/document/form_text/node() and /document/form_parent_id/node() and /document/form_parent_id= $comment_id">
<xsl:value-of disable-output-escaping="yes" select="/document/form_text"/>
</xsl:if>
</xsl:variable>
<xsl:variable name="name">
<xsl:if test="/document/form_user_name/node() and /document/form_parent_id/node() and /document/form_parent_id= $comment_id">
<xsl:value-of select="/document/form_user_name"/>
</xsl:if>
</xsl:variable>
<div class="comment">
<div class="tl"></div>
<div class="tr"></div>
<div class="bl"></div>
<div class="br"></div>
<!--Отображение формы добавления комментария-->
<form action="{/document/url}" name="comment_form_0{comment_id}" method="post">
<!-- Авторизированным не показываем -->
<xsl:if test="/shop/user_id = 0">
Имя
<br/>
<input type="text" size="70" name="shop_comment_user_name" value="{/shop/shop_comment_user_name}"/>
<p>
<br/>
<input id="email{$comment_id}" type="text" size="70" name="shop_comment_user_email" value="{/shop/shop_comment_user_email}"
onblur="FieldCheckEmail(this.id)"
onkeyup="FieldCheckEmail(this.id)"
onkeydown="FieldCheckEmail(this.id)" />
<div id="error_email{$comment_id}"></div>
</p>
</xsl:if>
<p>
Тема
<br/>
<input type="text" size="70" name="shop_comment_subject" value="{/shop/shop_comment_subject}"/>
</p>
<p>
Комментарий
<br/>
<textarea name="shop_comment_text" cols="68" rows="5" class="mceEditor"><xsl:value-of select="/shop/shop_comment_text"/></textarea>
</p>
<p>
Оценка
<br/>
<input type="hidden" name="shop_comment_grade" value="0"/>
<xsl:variable name="ul_id">
<xsl:choose>
<xsl:when test="comment_id > 0"><xsl:value-of select="comment_id"/>_stars</xsl:when>
<xsl:otherwise>0_stars</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<ul id="{$ul_id}" class="stars">
<li onclick="set_rate(this.id, this.id)" onmouseover="set_rate(this.id, '-1')" onmouseout="set_rate(this.id, 0)" id="{comment_id}1_star_1"></li>
<li onclick="set_rate(this.id, this.id)" onmouseover="set_rate(this.id, '-1')" onmouseout="set_rate(this.id, 0)" id="{comment_id}2_star_2"></li>
<li onclick="set_rate(this.id, this.id)" onmouseover="set_rate(this.id, '-1')" onmouseout="set_rate(this.id, 0)" id="{comment_id}3_star_3"></li>
<li onclick="set_rate(this.id, this.id)" onmouseover="set_rate(this.id, '-1')" onmouseout="set_rate(this.id, 0)" id="{comment_id}4_star_4"></li>
<li onclick="set_rate(this.id, this.id)" onmouseover="set_rate(this.id, '-1')" onmouseout="set_rate(this.id, 0)" id="{comment_id}5_star_5"></li>
</ul>
</p>
<br/>
<!-- Обработка CAPTCHA -->
<xsl:if test="//captcha_key != 0 and /shop/user_id = 0">
Контрольные цифры
<sup>
<font color="red">*</font>
</sup>
<div style="float: left">
<img id="comment_{$comment_id}" style="border: 1px solid #000000" src="/captcha.php?get_captcha={captcha_key}{$comment_id}&height=30&width=100" title="Код подтверждения" name="captcha"/>
</div>
<div id="captcha" style="clear:both;">
<img style="border: 0px" src="/hostcmsfiles/images/refresh.gif" /> <a href="javascript:void(0);" onclick="ReNewCaptchaById('comment_{$comment_id}', '{//captcha_key}{$comment_id}', 30); return false;">Показать другое число</a>
</div>
<div style="float: left;margin-top: 5px">
<input type="hidden" name="captcha_key" value="{//captcha_key}{$comment_id}"/>
<input type="text" name="captcha_keystring" size="15"/>
</div>
<div id="captcha" style="clear:both;margin-bottom:10px;">
Введите число, которое указано выше.
</div>
</xsl:if>
<xsl:if test="$comment_id != 0">
<input type="hidden" name="comment_parent_id" value="{comment_id}"/>
</xsl:if>
<p>
<input id="submit_email{$comment_id}" type="submit" name="submit_comment" value="Опубликовать"/>
</p>
</form>
</div>
</xsl:template>
<!-- Вывод раздела для свойств товара -->
<xsl:template match="properties_items_dir">
<xsl:variable name="dir_id" select="@id"/>
<xsl:if test="count(/shop/item/property[@dir_id = $dir_id])">
<!-- Название группы свойств -->
<p><b><xsl:value-of select="shop_properties_items_dir_name"/></b></p>
<table border="0">
<xsl:apply-templates select="/shop/item/property[@dir_id = $dir_id]"/>
</table>
</xsl:if>
<xsl:if test="count(properties_items_dir) > 0">
<blockquote>
<xsl:apply-templates select="properties_items_dir"/>
</blockquote>
</xsl:if>
</xsl:template>
<!-- Вывод строки со значением свойства -->
<xsl:template match="property">
<xsl:if test="value != '' or (type = 1 and file_path != '')">
<tr>
<td>
<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:if>
</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:value-of disable-output-escaping="yes" select="price_discount"/> 
<!-- Валюта -->
<xsl:value-of disable-output-escaping="yes" select="currency"/>
</td>
</tr>
</xsl:template>
<!-- Вывод рейтинга товара -->
<xsl:template name="show_average_grade">
<xsl:param name="grade" select="0"/>
<xsl:param name="const_grade" select="0"/>
<!-- Чтобы избежать зацикливания -->
<xsl:variable name="current_grade" select="$grade * 1"/>
<xsl:choose>
<!-- Если число целое -->
<xsl:when test="floor($current_grade) = $current_grade and not($const_grade > ceiling($current_grade))">
<xsl:if test="$current_grade - 1 > 0">
<xsl:call-template name="show_average_grade">
<xsl:with-param name="grade" select="$current_grade - 1"/>
<xsl:with-param name="const_grade" select="$const_grade - 1"/>
</xsl:call-template>
</xsl:if>
<xsl:if test="$current_grade != 0">
<img src="/hostcmsfiles/images/stars_single.gif"/>
</xsl:if>
</xsl:when>
<xsl:when test="$current_grade != 0 and not($const_grade > ceiling($current_grade))">
<xsl:if test="$current_grade - 0.5 > 0">
<xsl:call-template name="show_average_grade">
<xsl:with-param name="grade" select="$current_grade - 0.5"/>
<xsl:with-param name="const_grade" select="$const_grade - 1"/>
</xsl:call-template>
</xsl:if>
<img src="/hostcmsfiles/images/stars_half.gif"/>
</xsl:when>
<xsl:otherwise>
<!-- Выводим серые звездочки, пока текущая позиция не дойдет то значения, увеличенного до целого -->
<xsl:call-template name="show_average_grade">
<xsl:with-param name="grade" select="$current_grade"/>
<xsl:with-param name="const_grade" select="$const_grade - 1"/>
</xsl:call-template>
<img src="/hostcmsfiles/images/stars_gray.gif"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- Шаблон для вывода звездочек (оценки) -->
<xsl:template name="for">
<xsl:param name="i" select="0"/>
<xsl:param name="n"/>
<input type="radio" name="shop_comment_grade" value="{$i}" id="id_shop_comment_grade_{$i}">
<xsl:if test="/shop/shop_comment_grade = $i">
<xsl:attribute name="checked">
</xsl:attribute>
</xsl:if>
</input> 
<label for="id_shop_comment_grade_{$i}">
<xsl:call-template name="show_average_grade">
<xsl:with-param name="grade" select="$i"/>
<xsl:with-param name="const_grade" select="5"/>
</xsl:call-template>
</label>
<br/>
<xsl:if test="$n > $i and $n > 1">
<xsl:call-template name="for">
<xsl:with-param name="i" select="$i + 1"/>
<xsl:with-param name="n" select="$n"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<!-- Шаблон для отзывов -->
<xsl:template match="comments/comment">
<a name="comment{@id}"></a>
<div class="comment">
<div class="tl"></div>
<div class="tr"></div>
<div class="bl"></div>
<div class="br"></div>
<xsl:if test="subject != ''">
<div>
<strong>
<xsl:value-of select="subject"/>
</strong>
</div>
</xsl:if>
<xsl:value-of select="text" disable-output-escaping="yes"/>
<!-- Оценка комментария -->
<xsl:if test="grade != 0">
<div>Оценка:
<xsl:call-template name="show_average_grade">
<xsl:with-param name="grade" select="grade"/>
<xsl:with-param name="const_grade" select="5"/>
</xsl:call-template>
</div>
</xsl:if>
</div>
<div class="comment_desc">
<xsl:choose>
<xsl:when test="user_name">
<xsl:value-of select="user_name"/>
</xsl:when>
<xsl:otherwise>
<img src="/hostcmsfiles/images/user.gif" style="margin: 0px 5px -4px 0px" />
<b>
<a href="/users/info/{site_user_login}/" class="c_u_l" ><xsl:value-of select="site_user_login"/></a>
</b>
</xsl:otherwise>
</xsl:choose> · <xsl:value-of select="date_time"/> · <a href="{/shop/path}{/shop/item/fullpath}{/shop/item/path}/#comment{@id}" title="ссылка">#</a>
</div>
</xsl:template>
<!-- Шаблон для скидки -->
<xsl:template match="discount">
<p>
<xsl:value-of disable-output-escaping="yes" select="name"/> <xsl:value-of disable-output-escaping="yes" select="value"/>%
</p>
</xsl:template>
<xsl:template match="tying/item">
<div style="clear: both">
<p>
<a href="{/shop/path}{fullpath}{path}/">
<xsl:value-of select="name"/>
</a>
</p>
<!-- Изображение для товара, если есть -->
<xsl:if test="small_image != ''">
<a href="{/shop/path}{fullpath}{path}/">
<img src="{small_image}" align="left" style="border: 1px solid #000000; margin: 0px 5px 5px 0px"/>
</a>
</xsl:if>
<p>
<xsl:value-of disable-output-escaping="yes" select="description"/>
</p>
<!-- Цена товара -->
<strong>
<xsl:choose>
<xsl:when test="price_discount != 0">
<xsl:value-of disable-output-escaping="yes" select="price_discount"/> 
<!-- Валюта товара -->
<xsl:value-of disable-output-escaping="yes" select="currency"/>
</xsl:when>
<xsl:otherwise>договорная</xsl:otherwise>
</xsl:choose>
</strong>
<!-- Если цена со скидкой - выводим ее -->
<xsl:if test="price_tax != price_discount">
<br/>
<font color="gray">
<strike>
<xsl:value-of disable-output-escaping="yes" select="price_tax"/> <xsl:value-of disable-output-escaping="yes" select="currency"/></strike>
</font>
</xsl:if>
<!-- Если указан вес товара -->
<xsl:if test="weight != 0">
<br/>Вес товара: <xsl:value-of select="weight"/> <xsl:value-of select="weight_mesure"/></xsl:if>
</div>
</xsl:template>
<!-- Шаблон выводит хлебные крошки -->
<xsl:template match="group" mode="goup_path">
<xsl:variable name="parent_id" select="@parent"/>
<!-- Выбираем рекурсивно вышестоящую группу -->
<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>
<a href="{/shop/path}{fullpath}">
<xsl:value-of select="name"/>
</a>
</xsl:template>
</xsl:stylesheet>
Итог - ошибка:
ЗАМЕЧАНИЕ: Undefined index: LA_InformationSystem в файле /home/kentavr8/public_html/2/lib/lib_6/lib_6.php (строка 795)
Fatal error: Call to a member function GetInformationSystem() on a non-object in /home/kentavr8/public_html/2/lib/lib_6/lib_6.php on line 795
Адрес:
FlashXDesign - полный спектр услуг в области создания сайтов, дополнительных услуг и последующего обслуживания.
Knight-XIV
10 июля 2010 г.
спасибо, дружище. рабоатет, как часы!!
Авторизация