Добрый день!
Я задавал вопрос в службу поддержки:
2. В Интернет-магазине создали доп. св-во для Групп. Свойство в виде
> флажка, суть свойства "Отображать в меню или нет".
> Какой код для отображения групп магазина с учетом этого свойства?
Мне ответили:
2. нужно вносить изменения в XSL-шаблон для вывода меню на основе групп магазина. Например:
<xsl:apply-templates select="//group[@parent=$parent_group_id and propertys/property[@xml_name='in_menu']/value='1']"/>
где вместо in_menu подставьте значение вашего xml-тэга, соответствующего доп. свойству "Отображать в меню или нет".
Я внес предложенные изменения в 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" />
<xsl:template match="/">
<xsl:apply-templates select="shop"/>
</xsl:template>
<!-- Шаблон для магазина -->
<xsl:template match="/shop">
<xsl:variable name="parent_group_id" select="@current_group_id"/>
<!-- Выводим группы магазина -->
<ul class="left-menu">
<xsl:apply-templates select="//group[@parent=0]"/>
</ul>
</xsl:template>
<!-- Шаблон для групп товара -->
<xsl:template match="group">
<xsl:variable name="current_group_id" select="/shop/ТекущаяГруппа"/>
<!-- Определяем стиль вывода ссылки -->
<xsl:variable name="link_style">
<xsl:choose>
<!-- Выделяем текущую страницу жирным (если это текущая страница, либо у нее есть ребенок с ID, равным текущей) -->
<xsl:when test="current_structure_id=@id or count(.//structure[@id=$current_structure_id])=1">font-weight: bold</xsl:when>
<!-- Иначе обычный вывод с пустым стилем -->
<xsl:otherwise></xsl:otherwise>
</xsl:choose>
</xsl:variable>
<xsl:choose>
<xsl:when test="$current_group_id = @id or count(.//group[@id=$current_group_id])=1">
<li><a href="{/shop/path}{fullpath}#content"><xsl:value-of disable-output-escaping="yes" select="name"/></a></li>
<xsl:if test="count_all_groups > 0">
<ul class="submenu">
<xsl:apply-templates select="//group[@parent=$parent_group_id] and propertys/property[@xml_name='show_cat_menu']/value='1']"/>
</ul>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<li><a href="{/shop/path}{fullpath}#content"><xsl:value-of disable-output-escaping="yes" select="name"/></a></li>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
На что мне система выдало это:
ПРЕДУПРЕЖЕДЕНИЕ: XSLTProcessor::importStylesheet() [xsltprocessor.importstylesheet]: Invalid expression в файле /home/h/humantraff/expert-video/public_html/modules/Xsl/Xsl.class.php (строка 0)
ПРЕДУПРЕЖЕДЕНИЕ: XSLTProcessor::importStylesheet() [xsltprocessor.importstylesheet]: compilation error: file /home/h/humantraff/expert-video/public_html/ line 36 element apply-templates в файле /home/h/humantraff/expert-video/public_html/modules/Xsl/Xsl.class.php (строка 0)
ПРЕДУПРЕЖЕДЕНИЕ: XSLTProcessor::importStylesheet() [xsltprocessor.importstylesheet]: XSLT-apply-templates: could not compile select expression '//group[@parent=$parent_group_id] and propertys/property[@xml_name='show_cat_menu']/value='1']' в файле /home/h/humantraff/expert-video/public_html/modules/Xsl/Xsl.class.php (строка 0)
ПРЕДУПРЕЖЕДЕНИЕ: XSLTProcessor::transformToDoc() [xsltprocessor.transformtodoc]: No stylesheet associated to this object в файле /home/h/humantraff/expert-video/public_html/modules/Xsl/Xsl.class.php (строка 0)