А как сделать отображение всех товаров одного производителя?
Господа, перестал работать код
Не показывает ни имя, ни описание
Версия HostCMS: 5.9.36
<xsl:if test="producer_id/node()">
<xsl:apply-templates select="producer"/>
<xsl:variable name="prod_id" select="producer_id"/>
<h1>Товары компании <xsl:value-of disable-output-escaping="yes" select=".//producer[@id=$prod_id]/name"/></h1>
<em id="description">
<xsl:value-of disable-output-escaping="yes" select=".//producer[@id=$prod_id]/description"/></em>
<div id="link-here"></div>
</xsl:if>
<xsl:apply-templates select="producer"/>
<xsl:variable name="prod_id" select="producer_id"/>
<h1>Товары компании <xsl:value-of disable-output-escaping="yes" select=".//producer[@id=$prod_id]/name"/></h1>
<em id="description">
<xsl:value-of disable-output-escaping="yes" select=".//producer[@id=$prod_id]/description"/></em>
<div id="link-here"></div>
</xsl:if>
Не показывает ни имя, ни описание
Версия HostCMS: 5.9.36
http://www.aiventa.ru
Доброго времени суток!
Уважаемые гуру hostcms, помогите решить проблему.
Не работает пошаговая навигация, чует мое мягкое место, что дело в xsl шаблоне
Работаю на этом движке неделю, не судите строго.
Была создана следующая динамическая страница:
<?php
if (class_exists('shop'
)
{
$shop = & singleton('shop'
;
$param = array();
$element['type'] = 1;
$element['prefix'] = 'AND (';
$element['property_id'] = 232; //ID до. свойства
$element['if'] = '=';
$element['value'] = '1';
$element['sufix'] = '
';
$param['select'][] = $element;
// Товары выбираем из всех групп
$param['current_group_id'] = false;
$param['xml_show_group_type'] = 'all';
$param['sql_select_modification'] = false;
$param['items_on_page'] = 51;
$param['items_order'] = 'date';
$shop->ShowShop(3, 'МагазинКаталогТоваровКомнаты', $param);
}
?>
и методом копипаста был создан шаблон 'МагазинКаталогТоваровКомнаты'(с отсечением лишнего кода) из МагазинКаталогТоваров'
Вот код навигации
<!-- Цикл для вывода строк ссылок -->
<xsl:template name="for">
<xsl:param name="items_on_page"/>
<xsl:param name="current_page"/>
<xsl:param name="pre_count_page"/>
<xsl:param name="post_count_page"/>
<xsl:param name="i" select="0"/>
<xsl:param name="count_items"/>
<xsl:param name="visible_pages"/>
<xsl:variable name="n" select="ceiling($count_items div $items_on_page)"/>
<xsl:variable name="start_page"><xsl:choose>
<xsl:when test="$current_page + 1 = $n"><xsl:value-of select="$current_page - $visible_pages + 1"/></xsl:when>
<xsl:when test="$current_page - $pre_count_page > 0"><xsl:value-of select="$current_page - $pre_count_page"/></xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose></xsl:variable>
<xsl:if test="$i = $start_page and $current_page != 0">
<span class="ctrl">
← Ctrl
</span>
</xsl:if>
<xsl:if test="$i = ($current_page + $post_count_page + 1) and $n != ($current_page+1)">
<span class="ctrl">
Ctrl →
</span>
</xsl:if>
<xsl:if test="$count_items > $items_on_page and ($current_page + $post_count_page + 1) > $i">
<!-- Заносим в переменную $parent_group_id идентификатор текущей группы -->
<xsl:variable name="parent_group_id" select="/shop/@current_group_id"/>
<!-- Путь для тэга -->
<xsl:variable name="tag_path">
<xsl:if test="count(/shop/selected_tags/tag) = 1">tag/<xsl:value-of select="/shop/selected_tags/tag/tag_path_name"/>/</xsl:if>
</xsl:variable>
<!-- Определяем группу для формирования адреса ссылки -->
<xsl:variable name="group_link">
<xsl:choose>
<!-- Если группа не корневая (!=0) -->
<xsl:when test="$parent_group_id != 0">
<xsl:value-of select="/shop//group[@id=$parent_group_id]/fullpath"/>
</xsl:when>
<!-- Иначе если нулевой уровень - просто ссылка на страницу со списком элементов -->
<xsl:otherwise>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- Определяем адрес ссылки -->
<xsl:variable name="number_link">
<xsl:choose>
<!-- Если не нулевой уровень -->
<xsl:when test="$i != 0">page-<xsl:value-of select="$i + 1"/>/</xsl:when>
<!-- Иначе если нулевой уровень - просто ссылка на страницу со списком элементов -->
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- Передаем фильтр -->
<xsl:variable name="filter">
?action=apply_filter&producer_id=<xsl:value-of select="/shop/producer_id"/>&saller_id=<xsl:value-of select="/shop/saller_id"/>&price_from=<xsl:value-of select="/shop/price_from"/>&price_to=<xsl:value-of select="/shop/price_to"/>&on_page=<xsl:value-of select="/shop/on_page"/>
<xsl:if test="/shop/property_xml/node()">
<!-- GET для доп. свойств -->
<xsl:value-of select="/shop/property_xml"/>
</xsl:if>
</xsl:variable>
<!-- Определяем первый символ вопрос или амперсанд -->
<xsl:variable name="first_symbol">
<xsl:choose>
<xsl:when test="$filter != ''">&</xsl:when>
<xsl:otherwise>?</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- Данные для стрелок сортировки -->
<xsl:variable name="arrows">
<xsl:choose>
<xsl:when test="(/shop/sort_by_field = 1) or (/shop/sort_by_field = 2)">
<xsl:choose>
<!-- Стрелка вверх -->
<xsl:when test="/shop/order_direction = 'ASC'">
<xsl:value-of select="$first_symbol"/>sort_by_field=<xsl:value-of select="/shop/sort_by_field"/>&order_direction=1</xsl:when>
<!-- Стрелка вниз -->
<xsl:otherwise>
<xsl:value-of select="$first_symbol"/>sort_by_field=<xsl:value-of select="/shop/sort_by_field"/>&order_direction=2</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- Выводим ссылку на первую страницу -->
<xsl:if test="$current_page - $pre_count_page > 0 and $i = $start_page">
<a href="{/shop/path}{$group_link}{$tag_path}{$filter}{$arrows}{/shop/all_groups}" class="page_link" style="text-decoration: none;">←</a>
</xsl:if>
<!-- Ставим ссылку на страницу-->
<xsl:if test="$i != $current_page">
<xsl:if test="($current_page - $pre_count_page) <= $i and $i < $n">
<!-- Выводим ссылки на видимые страницы -->
<a href="{/shop/path}{$group_link}{$tag_path}{$number_link}{$filter}{$arrows}{/shop/all_groups}" class="page_link">
<xsl:value-of select="$i + 1"/>
</a>
</xsl:if>
<!-- Выводим ссылку на последнюю страницу -->
<xsl:if test="$i+1 >= ($current_page + $post_count_page + 1) and $n > ($current_page + 1 + $post_count_page)">
<!-- Выводим ссылку на последнюю страницу -->
<a href="{/shop/path}{$group_link}{$tag_path}page-{$n}/{$filter}{$arrows}{/shop/all_groups}" class="page_link" style="text-decoration: none;">→</a>
</xsl:if>
</xsl:if>
<!-- Ссылка на предыдущую страницу для Ctrl + влево -->
<xsl:if test="$current_page != 0 and $i = $current_page">
<xsl:variable name="prev_number_link">
<xsl:choose>
<!-- Если не нулевой уровень -->
<xsl:when test="($current_page - 1) != 0">page-<xsl:value-of select="$i"/>/</xsl:when>
<!-- Иначе если нулевой уровень - просто ссылка на страницу со списком элементов -->
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<a href="{/shop/path}{$group_link}{$tag_path}{$prev_number_link}{$filter}{$arrows}{/shop/all_groups}" id="id_prev"></a>
</xsl:if>
<!-- Ссылка на следующую страницу для Ctrl + вправо -->
<xsl:if test="($n - 1) > $current_page and $i = $current_page">
<a href="{/shop/path}{$group_link}{$tag_path}page-{$current_page+2}/{$filter}{$arrows}{/shop/all_groups}" id="id_next"></a>
</xsl:if>
<!-- Не ставим ссылку на страницу-->
<xsl:if test="$i = $current_page">
<span class="current">
<xsl:value-of select="$i+1"/>
</span>
</xsl:if>
<!-- Рекурсивный вызов шаблона. НЕОБХОДИМО ПЕРЕДАВАТЬ ВСЕ НЕОБХОДИМЫЕ ПАРАМЕТРЫ! -->
<xsl:call-template name="for">
<xsl:with-param name="i" select="$i + 1"/>
<xsl:with-param name="items_on_page" select="$items_on_page"/>
<xsl:with-param name="current_page" select="$current_page"/>
<xsl:with-param name="count_items" select="$count_items"/>
<xsl:with-param name="pre_count_page" select="$pre_count_page"/>
<xsl:with-param name="post_count_page" select="$post_count_page"/>
<xsl:with-param name="visible_pages" select="$visible_pages"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<!-- Шаблон выводит рекурсивно ссылки на группы инф. элемента -->
<xsl:template match="group" mode="goup_path">
<xsl:param name="parent_id" select="@parent"/>
<!-- Получаем ID родительской группы и записываем в переменную $parent_group_id -->
<xsl:param name="parent_group_id" select="/shop/@current_group_id"/>
<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 disable-output-escaping="yes" select="name"/>
</a>
</xsl:template>
В пути для тега прописан tag_path_name
В линках {$tag_path} тоже есть.
Очень нужна Ваша помощь, можно и за денежку.
Вот собственно линк на проблему
Уважаемые гуру hostcms, помогите решить проблему.
Не работает пошаговая навигация, чует мое мягкое место, что дело в xsl шаблоне
Работаю на этом движке неделю, не судите строго.
Была создана следующая динамическая страница:
<?php
if (class_exists('shop'
){
$shop = & singleton('shop'
;$param = array();
$element['type'] = 1;
$element['prefix'] = 'AND (';
$element['property_id'] = 232; //ID до. свойства
$element['if'] = '=';
$element['value'] = '1';
$element['sufix'] = '
';$param['select'][] = $element;
// Товары выбираем из всех групп
$param['current_group_id'] = false;
$param['xml_show_group_type'] = 'all';
$param['sql_select_modification'] = false;
$param['items_on_page'] = 51;
$param['items_order'] = 'date';
$shop->ShowShop(3, 'МагазинКаталогТоваровКомнаты', $param);
}
?>
и методом копипаста был создан шаблон 'МагазинКаталогТоваровКомнаты'(с отсечением лишнего кода) из МагазинКаталогТоваров'
Вот код навигации
<!-- Цикл для вывода строк ссылок -->
<xsl:template name="for">
<xsl:param name="items_on_page"/>
<xsl:param name="current_page"/>
<xsl:param name="pre_count_page"/>
<xsl:param name="post_count_page"/>
<xsl:param name="i" select="0"/>
<xsl:param name="count_items"/>
<xsl:param name="visible_pages"/>
<xsl:variable name="n" select="ceiling($count_items div $items_on_page)"/>
<xsl:variable name="start_page"><xsl:choose>
<xsl:when test="$current_page + 1 = $n"><xsl:value-of select="$current_page - $visible_pages + 1"/></xsl:when>
<xsl:when test="$current_page - $pre_count_page > 0"><xsl:value-of select="$current_page - $pre_count_page"/></xsl:when>
<xsl:otherwise>0</xsl:otherwise>
</xsl:choose></xsl:variable>
<xsl:if test="$i = $start_page and $current_page != 0">
<span class="ctrl">
← Ctrl
</span>
</xsl:if>
<xsl:if test="$i = ($current_page + $post_count_page + 1) and $n != ($current_page+1)">
<span class="ctrl">
Ctrl →
</span>
</xsl:if>
<xsl:if test="$count_items > $items_on_page and ($current_page + $post_count_page + 1) > $i">
<!-- Заносим в переменную $parent_group_id идентификатор текущей группы -->
<xsl:variable name="parent_group_id" select="/shop/@current_group_id"/>
<!-- Путь для тэга -->
<xsl:variable name="tag_path">
<xsl:if test="count(/shop/selected_tags/tag) = 1">tag/<xsl:value-of select="/shop/selected_tags/tag/tag_path_name"/>/</xsl:if>
</xsl:variable>
<!-- Определяем группу для формирования адреса ссылки -->
<xsl:variable name="group_link">
<xsl:choose>
<!-- Если группа не корневая (!=0) -->
<xsl:when test="$parent_group_id != 0">
<xsl:value-of select="/shop//group[@id=$parent_group_id]/fullpath"/>
</xsl:when>
<!-- Иначе если нулевой уровень - просто ссылка на страницу со списком элементов -->
<xsl:otherwise>
</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- Определяем адрес ссылки -->
<xsl:variable name="number_link">
<xsl:choose>
<!-- Если не нулевой уровень -->
<xsl:when test="$i != 0">page-<xsl:value-of select="$i + 1"/>/</xsl:when>
<!-- Иначе если нулевой уровень - просто ссылка на страницу со списком элементов -->
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- Передаем фильтр -->
<xsl:variable name="filter">
?action=apply_filter&producer_id=<xsl:value-of select="/shop/producer_id"/>&saller_id=<xsl:value-of select="/shop/saller_id"/>&price_from=<xsl:value-of select="/shop/price_from"/>&price_to=<xsl:value-of select="/shop/price_to"/>&on_page=<xsl:value-of select="/shop/on_page"/>
<xsl:if test="/shop/property_xml/node()">
<!-- GET для доп. свойств -->
<xsl:value-of select="/shop/property_xml"/>
</xsl:if>
</xsl:variable>
<!-- Определяем первый символ вопрос или амперсанд -->
<xsl:variable name="first_symbol">
<xsl:choose>
<xsl:when test="$filter != ''">&</xsl:when>
<xsl:otherwise>?</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- Данные для стрелок сортировки -->
<xsl:variable name="arrows">
<xsl:choose>
<xsl:when test="(/shop/sort_by_field = 1) or (/shop/sort_by_field = 2)">
<xsl:choose>
<!-- Стрелка вверх -->
<xsl:when test="/shop/order_direction = 'ASC'">
<xsl:value-of select="$first_symbol"/>sort_by_field=<xsl:value-of select="/shop/sort_by_field"/>&order_direction=1</xsl:when>
<!-- Стрелка вниз -->
<xsl:otherwise>
<xsl:value-of select="$first_symbol"/>sort_by_field=<xsl:value-of select="/shop/sort_by_field"/>&order_direction=2</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<!-- Выводим ссылку на первую страницу -->
<xsl:if test="$current_page - $pre_count_page > 0 and $i = $start_page">
<a href="{/shop/path}{$group_link}{$tag_path}{$filter}{$arrows}{/shop/all_groups}" class="page_link" style="text-decoration: none;">←</a>
</xsl:if>
<!-- Ставим ссылку на страницу-->
<xsl:if test="$i != $current_page">
<xsl:if test="($current_page - $pre_count_page) <= $i and $i < $n">
<!-- Выводим ссылки на видимые страницы -->
<a href="{/shop/path}{$group_link}{$tag_path}{$number_link}{$filter}{$arrows}{/shop/all_groups}" class="page_link">
<xsl:value-of select="$i + 1"/>
</a>
</xsl:if>
<!-- Выводим ссылку на последнюю страницу -->
<xsl:if test="$i+1 >= ($current_page + $post_count_page + 1) and $n > ($current_page + 1 + $post_count_page)">
<!-- Выводим ссылку на последнюю страницу -->
<a href="{/shop/path}{$group_link}{$tag_path}page-{$n}/{$filter}{$arrows}{/shop/all_groups}" class="page_link" style="text-decoration: none;">→</a>
</xsl:if>
</xsl:if>
<!-- Ссылка на предыдущую страницу для Ctrl + влево -->
<xsl:if test="$current_page != 0 and $i = $current_page">
<xsl:variable name="prev_number_link">
<xsl:choose>
<!-- Если не нулевой уровень -->
<xsl:when test="($current_page - 1) != 0">page-<xsl:value-of select="$i"/>/</xsl:when>
<!-- Иначе если нулевой уровень - просто ссылка на страницу со списком элементов -->
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<a href="{/shop/path}{$group_link}{$tag_path}{$prev_number_link}{$filter}{$arrows}{/shop/all_groups}" id="id_prev"></a>
</xsl:if>
<!-- Ссылка на следующую страницу для Ctrl + вправо -->
<xsl:if test="($n - 1) > $current_page and $i = $current_page">
<a href="{/shop/path}{$group_link}{$tag_path}page-{$current_page+2}/{$filter}{$arrows}{/shop/all_groups}" id="id_next"></a>
</xsl:if>
<!-- Не ставим ссылку на страницу-->
<xsl:if test="$i = $current_page">
<span class="current">
<xsl:value-of select="$i+1"/>
</span>
</xsl:if>
<!-- Рекурсивный вызов шаблона. НЕОБХОДИМО ПЕРЕДАВАТЬ ВСЕ НЕОБХОДИМЫЕ ПАРАМЕТРЫ! -->
<xsl:call-template name="for">
<xsl:with-param name="i" select="$i + 1"/>
<xsl:with-param name="items_on_page" select="$items_on_page"/>
<xsl:with-param name="current_page" select="$current_page"/>
<xsl:with-param name="count_items" select="$count_items"/>
<xsl:with-param name="pre_count_page" select="$pre_count_page"/>
<xsl:with-param name="post_count_page" select="$post_count_page"/>
<xsl:with-param name="visible_pages" select="$visible_pages"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<!-- Шаблон выводит рекурсивно ссылки на группы инф. элемента -->
<xsl:template match="group" mode="goup_path">
<xsl:param name="parent_id" select="@parent"/>
<!-- Получаем ID родительской группы и записываем в переменную $parent_group_id -->
<xsl:param name="parent_group_id" select="/shop/@current_group_id"/>
<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 disable-output-escaping="yes" select="name"/>
</a>
</xsl:template>
В пути для тега прописан tag_path_name
В линках {$tag_path} тоже есть.
Очень нужна Ваша помощь, можно и за денежку.
Вот собственно линк на проблему
Авторизация