Помогите советом с реализацией данного фильтра.
Пробовал на JavaScript не понравилось оно мне. Да и оттачивать до идеала долго нужно.


Skype:ferdinant1988 ICQ:311960596 E-mail: ferdinant@i.ua
Тут все более-менее просто.
Каждая из строк - это допсвойство типа "список".
При формировании фильтра, в xsl есть специальный темплейт, который вызывается для построения списков (select)
вот его-то и надо модифицировать так, чтобы он вместо набора тегов option выдавал набор тегов a.
Правда будет немного гемора с href - для каждой ссылки вам надо будет учесть все ранее переданные фильтры. Лучше всего, перед каждым вызовом теплейта вычислять переменную href от остальных запросов, а потом дописывать к ней варианты из списка. а для варианта "все" - ничего не дописывать.
Каждая из строк - это допсвойство типа "список".
При формировании фильтра, в xsl есть специальный темплейт, который вызывается для построения списков (select)
вот его-то и надо модифицировать так, чтобы он вместо набора тегов option выдавал набор тегов a.
Правда будет немного гемора с href - для каждой ссылки вам надо будет учесть все ранее переданные фильтры. Лучше всего, перед каждым вызовом теплейта вычислять переменную href от остальных запросов, а потом дописывать к ней варианты из списка. а для варианта "все" - ничего не дописывать.
Заказов не беру. Консультирую редко.
Kotoff писал(а):
Вот именно в этом мне и нужна помощь.
Правда будет немного гемора с href — для каждой ссылки вам надо будет учесть все ранее переданные фильтры. Лучше всего, перед каждым вызовом теплейта вычислять переменную href от остальных запросов, а потом дописывать к ней варианты из списка. а для варианта «все» — ничего не дописывать.
Вот именно в этом мне и нужна помощь.
Skype:ferdinant1988 ICQ:311960596 E-mail: ferdinant@i.ua
Примерно так.
Сначала заменяем тот фрагмент, который формирует саму форму фильтра (это в темплейте /shop)
Теперь заменим следующие темплейты:
и добавим еще один новый
Должно работать )
На ссылки будут заменяться те доп.свойства, у которых в в настройках выбрано отображение "Список-списком".
Сначала заменяем тот фрагмент, который формирует саму форму фильтра (это в темплейте /shop)
<div class="shop_block">
<!-- Если есть доступные производители -->
<xsl:if test="count(producerslist/producer) > 0">
<p>Производитель: 
<!--вычислим строку с переданными фильтрами и загоним ее в переменную
Обратите внимание на комментарий внутри переменной!
с помощью него я отключаю тот параметр, который будет меняться в списке,
в данном случае это производитель-->
<xsl:variable name="filter_string">
<!--<xsl:if test="/shop/producer_id/node()">&producer_id=<xsl:value-of select="/shop/producer_id"/></xsl:if>-->
<xsl:if test="/shop/saller_id/node()">&saller_id=<xsl:value-of select="/shop/saller_id"/></xsl:if>
<xsl:if test="/shop/on_page/node()">&on_page=<xsl:value-of select="/shop/on_page"/></xsl:if>
<xsl:if test="/shop/price_from/node()">&price_from=<xsl:value-of select="/shop/price_from"/></xsl:if>
<xsl:if test="/shop/price_to/node()">&price_to=<xsl:value-of select="/shop/price_to"/></xsl:if>
<xsl:if test="/shop/sort_by_field/node()">&sort_by_field=<xsl:value-of select="/shop/sort_by_field"/></xsl:if>
<xsl:if test="/shop/order_direction/node()">
<xsl:text>&order_direction=</xsl:text>
<xsl:if test="/shop/order_direction = 'ASC'">1</xsl:if>
<xsl:if test="/shop/order_direction = 'DESC'">2</xsl:if>
</xsl:if>
<xsl:if test="/shop/property_xml/node()">
<xsl:value-of select="/shop/property_xml"/>
</xsl:if>
</xsl:variable>
<a href="./?apply_filter=1{$filter_string}">все</a>, 
<xsl:apply-templates select="producerslist/producer">
<xsl:with-param name="add_filter" select="$filter_string"/>
</xsl:apply-templates>
</p>
</xsl:if>
<!-- Если есть доступные продавцы -->
<xsl:if test="count(sallers/saller) > 0">
<p>Продавец: 
<xsl:variable name="filter_string">
<xsl:if test="/shop/producer_id/node()">&producer_id=<xsl:value-of select="/shop/producer_id"/></xsl:if>
<!--<xsl:if test="/shop/saller_id/node()">&saller_id=<xsl:value-of select="/shop/saller_id"/></xsl:if>-->
<xsl:if test="/shop/on_page/node()">&on_page=<xsl:value-of select="/shop/on_page"/></xsl:if>
<xsl:if test="/shop/price_from/node()">&price_from=<xsl:value-of select="/shop/price_from"/></xsl:if>
<xsl:if test="/shop/price_to/node()">&price_to=<xsl:value-of select="/shop/price_to"/></xsl:if>
<xsl:if test="/shop/sort_by_field/node()">&sort_by_field=<xsl:value-of select="/shop/sort_by_field"/></xsl:if>
<xsl:if test="/shop/order_direction/node()">
<xsl:text>&order_direction=</xsl:text>
<xsl:if test="/shop/order_direction = 'ASC'">1</xsl:if>
<xsl:if test="/shop/order_direction = 'DESC'">2</xsl:if>
</xsl:if>
<xsl:if test="/shop/property_xml/node()">
<xsl:value-of select="/shop/property_xml"/>
</xsl:if>
</xsl:variable>
<a href="./?apply_filter=1{$filter_string}">все</a>, 
<xsl:apply-templates select="sallers/saller">
<xsl:with-param name="add_filter" select="$filter_string"/>
</xsl:apply-templates>
</p>
</xsl:if>Цена от: 
<input name="price_from" size="5" type="text">
<xsl:if test="/shop/price_from != 0">
<xsl:attribute name="value">
<xsl:value-of disable-output-escaping="yes" select="/shop/price_from"/>
</xsl:attribute>
</xsl:if>
</input> 
до: 
<input name="price_to" size="5" type="text">
<xsl:if test="/shop/price_to != 0">
<xsl:attribute name="value">
<xsl:value-of disable-output-escaping="yes" select="/shop/price_to"/>
</xsl:attribute>
</xsl:if>
</input> 
<p>
<span style="white-space: nowrap">Товаров на странице:</span> 
<xsl:variable name="filter_string">
<xsl:if test="/shop/producer_id/node()">&producer_id=<xsl:value-of select="/shop/producer_id"/></xsl:if>
<xsl:if test="/shop/saller_id/node()">&saller_id=<xsl:value-of select="/shop/saller_id"/></xsl:if>
<!--<xsl:if test="/shop/on_page/node()">&on_page=<xsl:value-of select="/shop/on_page"/></xsl:if>-->
<xsl:if test="/shop/price_from/node()">&price_from=<xsl:value-of select="/shop/price_from"/></xsl:if>
<xsl:if test="/shop/price_to/node()">&price_to=<xsl:value-of select="/shop/price_to"/></xsl:if>
<xsl:if test="/shop/sort_by_field/node()">&sort_by_field=<xsl:value-of select="/shop/sort_by_field"/></xsl:if>
<xsl:if test="/shop/order_direction/node()">
<xsl:text>&order_direction=</xsl:text>
<xsl:if test="/shop/order_direction = 'ASC'">1</xsl:if>
<xsl:if test="/shop/order_direction = 'DESC'">2</xsl:if>
</xsl:if>
<xsl:if test="/shop/property_xml/node()">
<xsl:value-of select="/shop/property_xml"/>
</xsl:if>
</xsl:variable>
<xsl:call-template name="for_on_page">
<xsl:with-param name="i" select="10"/>
<xsl:with-param name="n" select="50"/>
<xsl:with-param name="add_filter" select="$filter_string"/>
</xsl:call-template>
</p> 
<input name="apply_filter" value="Применить" type="submit"/>
<xsl:if test="count(properties_for_group/property[property_show_kind != 0 and (shop_list_of_properties_type = 0 or shop_list_of_properties_type = 2 or shop_list_of_properties_type = 7)]) > 0">
<p>
<b>Фильтр по дополнительным свойствам товара:</b>
</p>
<table cellpadding="10px" cellspacing="0">
<tr valign="top">
<xsl:variable name="filter_string">
<xsl:if test="/shop/producer_id/node()">&producer_id=<xsl:value-of select="/shop/producer_id"/></xsl:if>
<xsl:if test="/shop/saller_id/node()">&saller_id=<xsl:value-of select="/shop/saller_id"/></xsl:if>
<xsl:if test="/shop/on_page/node()">&on_page=<xsl:value-of select="/shop/on_page"/></xsl:if>
<xsl:if test="/shop/price_from/node()">&price_from=<xsl:value-of select="/shop/price_from"/></xsl:if>
<xsl:if test="/shop/price_to/node()">&price_to=<xsl:value-of select="/shop/price_to"/></xsl:if>
<xsl:if test="/shop/sort_by_field/node()">&sort_by_field=<xsl:value-of select="/shop/sort_by_field"/></xsl:if>
<xsl:if test="/shop/order_direction/node()">
<xsl:text>&order_direction=</xsl:text>
<xsl:if test="/shop/order_direction = 'ASC'">1</xsl:if>
<xsl:if test="/shop/order_direction = 'DESC'">2</xsl:if>
</xsl:if>
<!--<xsl:if test="/shop/property_xml/node()">
<xsl:value-of select="/shop/property_xml"/>
</xsl:if>-->
</xsl:variable>
<xsl:apply-templates select="properties_for_group/property[property_show_kind != 0 and (shop_list_of_properties_type = 0 or shop_list_of_properties_type = 2 or shop_list_of_properties_type = 7)]">
<xsl:with-param name="std_filter" select="$filter_string"/>
</xsl:apply-templates>
</tr>
</table>
</xsl:if>
</div>
<!-- Если есть доступные производители -->
<xsl:if test="count(producerslist/producer) > 0">
<p>Производитель: 
<!--вычислим строку с переданными фильтрами и загоним ее в переменную
Обратите внимание на комментарий внутри переменной!
с помощью него я отключаю тот параметр, который будет меняться в списке,
в данном случае это производитель-->
<xsl:variable name="filter_string">
<!--<xsl:if test="/shop/producer_id/node()">&producer_id=<xsl:value-of select="/shop/producer_id"/></xsl:if>-->
<xsl:if test="/shop/saller_id/node()">&saller_id=<xsl:value-of select="/shop/saller_id"/></xsl:if>
<xsl:if test="/shop/on_page/node()">&on_page=<xsl:value-of select="/shop/on_page"/></xsl:if>
<xsl:if test="/shop/price_from/node()">&price_from=<xsl:value-of select="/shop/price_from"/></xsl:if>
<xsl:if test="/shop/price_to/node()">&price_to=<xsl:value-of select="/shop/price_to"/></xsl:if>
<xsl:if test="/shop/sort_by_field/node()">&sort_by_field=<xsl:value-of select="/shop/sort_by_field"/></xsl:if>
<xsl:if test="/shop/order_direction/node()">
<xsl:text>&order_direction=</xsl:text>
<xsl:if test="/shop/order_direction = 'ASC'">1</xsl:if>
<xsl:if test="/shop/order_direction = 'DESC'">2</xsl:if>
</xsl:if>
<xsl:if test="/shop/property_xml/node()">
<xsl:value-of select="/shop/property_xml"/>
</xsl:if>
</xsl:variable>
<a href="./?apply_filter=1{$filter_string}">все</a>, 
<xsl:apply-templates select="producerslist/producer">
<xsl:with-param name="add_filter" select="$filter_string"/>
</xsl:apply-templates>
</p>
</xsl:if>
<!-- Если есть доступные продавцы -->
<xsl:if test="count(sallers/saller) > 0">
<p>Продавец: 
<xsl:variable name="filter_string">
<xsl:if test="/shop/producer_id/node()">&producer_id=<xsl:value-of select="/shop/producer_id"/></xsl:if>
<!--<xsl:if test="/shop/saller_id/node()">&saller_id=<xsl:value-of select="/shop/saller_id"/></xsl:if>-->
<xsl:if test="/shop/on_page/node()">&on_page=<xsl:value-of select="/shop/on_page"/></xsl:if>
<xsl:if test="/shop/price_from/node()">&price_from=<xsl:value-of select="/shop/price_from"/></xsl:if>
<xsl:if test="/shop/price_to/node()">&price_to=<xsl:value-of select="/shop/price_to"/></xsl:if>
<xsl:if test="/shop/sort_by_field/node()">&sort_by_field=<xsl:value-of select="/shop/sort_by_field"/></xsl:if>
<xsl:if test="/shop/order_direction/node()">
<xsl:text>&order_direction=</xsl:text>
<xsl:if test="/shop/order_direction = 'ASC'">1</xsl:if>
<xsl:if test="/shop/order_direction = 'DESC'">2</xsl:if>
</xsl:if>
<xsl:if test="/shop/property_xml/node()">
<xsl:value-of select="/shop/property_xml"/>
</xsl:if>
</xsl:variable>
<a href="./?apply_filter=1{$filter_string}">все</a>, 
<xsl:apply-templates select="sallers/saller">
<xsl:with-param name="add_filter" select="$filter_string"/>
</xsl:apply-templates>
</p>
</xsl:if>Цена от: 
<input name="price_from" size="5" type="text">
<xsl:if test="/shop/price_from != 0">
<xsl:attribute name="value">
<xsl:value-of disable-output-escaping="yes" select="/shop/price_from"/>
</xsl:attribute>
</xsl:if>
</input> 
до: 
<input name="price_to" size="5" type="text">
<xsl:if test="/shop/price_to != 0">
<xsl:attribute name="value">
<xsl:value-of disable-output-escaping="yes" select="/shop/price_to"/>
</xsl:attribute>
</xsl:if>
</input> 
<p>
<span style="white-space: nowrap">Товаров на странице:</span> 
<xsl:variable name="filter_string">
<xsl:if test="/shop/producer_id/node()">&producer_id=<xsl:value-of select="/shop/producer_id"/></xsl:if>
<xsl:if test="/shop/saller_id/node()">&saller_id=<xsl:value-of select="/shop/saller_id"/></xsl:if>
<!--<xsl:if test="/shop/on_page/node()">&on_page=<xsl:value-of select="/shop/on_page"/></xsl:if>-->
<xsl:if test="/shop/price_from/node()">&price_from=<xsl:value-of select="/shop/price_from"/></xsl:if>
<xsl:if test="/shop/price_to/node()">&price_to=<xsl:value-of select="/shop/price_to"/></xsl:if>
<xsl:if test="/shop/sort_by_field/node()">&sort_by_field=<xsl:value-of select="/shop/sort_by_field"/></xsl:if>
<xsl:if test="/shop/order_direction/node()">
<xsl:text>&order_direction=</xsl:text>
<xsl:if test="/shop/order_direction = 'ASC'">1</xsl:if>
<xsl:if test="/shop/order_direction = 'DESC'">2</xsl:if>
</xsl:if>
<xsl:if test="/shop/property_xml/node()">
<xsl:value-of select="/shop/property_xml"/>
</xsl:if>
</xsl:variable>
<xsl:call-template name="for_on_page">
<xsl:with-param name="i" select="10"/>
<xsl:with-param name="n" select="50"/>
<xsl:with-param name="add_filter" select="$filter_string"/>
</xsl:call-template>
</p> 
<input name="apply_filter" value="Применить" type="submit"/>
<xsl:if test="count(properties_for_group/property[property_show_kind != 0 and (shop_list_of_properties_type = 0 or shop_list_of_properties_type = 2 or shop_list_of_properties_type = 7)]) > 0">
<p>
<b>Фильтр по дополнительным свойствам товара:</b>
</p>
<table cellpadding="10px" cellspacing="0">
<tr valign="top">
<xsl:variable name="filter_string">
<xsl:if test="/shop/producer_id/node()">&producer_id=<xsl:value-of select="/shop/producer_id"/></xsl:if>
<xsl:if test="/shop/saller_id/node()">&saller_id=<xsl:value-of select="/shop/saller_id"/></xsl:if>
<xsl:if test="/shop/on_page/node()">&on_page=<xsl:value-of select="/shop/on_page"/></xsl:if>
<xsl:if test="/shop/price_from/node()">&price_from=<xsl:value-of select="/shop/price_from"/></xsl:if>
<xsl:if test="/shop/price_to/node()">&price_to=<xsl:value-of select="/shop/price_to"/></xsl:if>
<xsl:if test="/shop/sort_by_field/node()">&sort_by_field=<xsl:value-of select="/shop/sort_by_field"/></xsl:if>
<xsl:if test="/shop/order_direction/node()">
<xsl:text>&order_direction=</xsl:text>
<xsl:if test="/shop/order_direction = 'ASC'">1</xsl:if>
<xsl:if test="/shop/order_direction = 'DESC'">2</xsl:if>
</xsl:if>
<!--<xsl:if test="/shop/property_xml/node()">
<xsl:value-of select="/shop/property_xml"/>
</xsl:if>-->
</xsl:variable>
<xsl:apply-templates select="properties_for_group/property[property_show_kind != 0 and (shop_list_of_properties_type = 0 or shop_list_of_properties_type = 2 or shop_list_of_properties_type = 7)]">
<xsl:with-param name="std_filter" select="$filter_string"/>
</xsl:apply-templates>
</tr>
</table>
</xsl:if>
</div>
Теперь заменим следующие темплейты:
<!-- Шаблон для фильтра производителей -->
<xsl:template match="producerslist/producer">
<xsl:param name="add_filter" select="''"/>
<a href="./?producer_id={@id}{$add_filter}&apply_filter=1">
<xsl:if test="@id = /shop/producer_id">
<xsl:attribute name="class">current</xsl:attribute>
</xsl:if>
<xsl:value-of disable-output-escaping="yes" select="name"/>
</a>
<xsl:if test="position() != last()">,<xsl:text> </xsl:text></xsl:if>
</xsl:template>
<xsl:template match="producerslist/producer">
<xsl:param name="add_filter" select="''"/>
<a href="./?producer_id={@id}{$add_filter}&apply_filter=1">
<xsl:if test="@id = /shop/producer_id">
<xsl:attribute name="class">current</xsl:attribute>
</xsl:if>
<xsl:value-of disable-output-escaping="yes" select="name"/>
</a>
<xsl:if test="position() != last()">,<xsl:text> </xsl:text></xsl:if>
</xsl:template>
<!-- Шаблон для фильтра продавцов -->
<xsl:template match="sallers/saller">
<xsl:param name="add_filter" select="''"/>
<a href="./?saller_id={@id}{$add_filter}&apply_filter=1">
<xsl:if test="@id = /shop/saller_id">
<xsl:attribute name="class">current</xsl:attribute>
</xsl:if>
<xsl:value-of disable-output-escaping="yes" select="name"/>
</a>
<xsl:if test="position() != last()">,<xsl:text> </xsl:text></xsl:if>
</xsl:template>
<xsl:template match="sallers/saller">
<xsl:param name="add_filter" select="''"/>
<a href="./?saller_id={@id}{$add_filter}&apply_filter=1">
<xsl:if test="@id = /shop/saller_id">
<xsl:attribute name="class">current</xsl:attribute>
</xsl:if>
<xsl:value-of disable-output-escaping="yes" select="name"/>
</a>
<xsl:if test="position() != last()">,<xsl:text> </xsl:text></xsl:if>
</xsl:template>
<!-- Цикл с шагом 10 для select'a количества элементов на страницу -->
<xsl:template name="for_on_page">
<xsl:param name="i" select="0"/>
<xsl:param name="n"/>
<xsl:param name="add_filter" select="''"/>
<a href="./?on_page={$i}{$add_filter}&apply_filter=1">
<xsl:if test="$i = /shop/on_page">
<xsl:attribute name="class">current</xsl:attribute>
</xsl:if>
<xsl:value-of select="$i"/>
</a>
<xsl:if test="$n > $i">
<xsl:text>, </xsl:text>
<!-- Рекурсивный вызов шаблона -->
<xsl:call-template name="for_on_page">
<xsl:with-param name="i" select="$i + 10"/>
<xsl:with-param name="n" select="$n"/>
<xsl:with-param name="add_filter" select="$add_filter"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template name="for_on_page">
<xsl:param name="i" select="0"/>
<xsl:param name="n"/>
<xsl:param name="add_filter" select="''"/>
<a href="./?on_page={$i}{$add_filter}&apply_filter=1">
<xsl:if test="$i = /shop/on_page">
<xsl:attribute name="class">current</xsl:attribute>
</xsl:if>
<xsl:value-of select="$i"/>
</a>
<xsl:if test="$n > $i">
<xsl:text>, </xsl:text>
<!-- Рекурсивный вызов шаблона -->
<xsl:call-template name="for_on_page">
<xsl:with-param name="i" select="$i + 10"/>
<xsl:with-param name="n" select="$n"/>
<xsl:with-param name="add_filter" select="$add_filter"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<!-- Шаблон для фильтра по дополнительным свойствам -->
<xsl:template match="properties_for_group/property">
<xsl:param name="std_filter" select="''"/>
<xsl:variable name="nodename">property_id_<xsl:value-of select="@id"/></xsl:variable>
<xsl:variable name="nodename_from">property_id_<xsl:value-of select="@id"/>_from</xsl:variable>
<xsl:variable name="nodename_to">property_id_<xsl:value-of select="@id"/>_to</xsl:variable>
<td>
<xsl:value-of disable-output-escaping="yes" select="property_name"/> 
<xsl:if test="property_show_kind = 1">
<!-- Отображаем поле ввода -->
<br/>
<input type="text" name="property_id_{@id}">
<xsl:if test="/shop/*[name()=$nodename] != ''">
<xsl:attribute name="value">
<xsl:value-of select="/shop/*[name()=$nodename]"/>
</xsl:attribute>
</xsl:if>
</input>
</xsl:if>
<xsl:if test="property_show_kind = 2">
<!-- Отображаем список -->
<xsl:variable name="current_property_id" select="@id"/>
<xsl:variable name="other_property_filter">
<xsl:apply-templates select="/shop/properties_for_group/property[property_show_kind != 0 and (shop_list_of_properties_type = 0 or shop_list_of_properties_type = 2 or shop_list_of_properties_type = 7)][@id != $current_property_id]"
mode="property_filter"/>
</xsl:variable>
<xsl:variable name="result_filter">
<xsl:value-of select="$std_filter"/>
<xsl:value-of select="$other_property_filter"/>
</xsl:variable>
<p>
<a href="./?apply_filter=1{$result_filter}">все</a>, 
<xsl:apply-templates select="list_items/list_item">
<xsl:with-param name="add_filter" select="$result_filter"/>
</xsl:apply-templates>
</p>
</xsl:if>
<xsl:if test="property_show_kind = 3">
<!-- Отображаем переключатели -->
<br/>
<input type="radio" name="property_id_{@id}" value="0" id="id_prop_radio_{@id}_0"></input>
<label for="id_prop_radio_{@id}_0">Любой вариант</label>
<xsl:apply-templates select="list_items/list_item"/>
</xsl:if>
<xsl:if test=" property_show_kind = 4">
<!-- Отображаем флажки -->
<xsl:apply-templates select="list_items/list_item"/>
</xsl:if>
<xsl:if test=" property_show_kind = 5">
<!-- Отображаем флажок -->
<br/>
<input type="checkbox" name="property_id_{@id}" id="property_id_{@id}" style="padding-top:4px">
<xsl:if test="/shop/*[name()=$nodename] != ''">
<xsl:attribute name="checked">
<xsl:value-of select="/shop/*[name()=$nodename]"/>
</xsl:attribute>
</xsl:if>
</input>
<label for="property_id_{@id}">Да</label>
</xsl:if>
<xsl:if test=" property_show_kind = 6">
<!-- Отображение полей "От.. До.." -->
<br/>от: <input type="text" name="property_id_{@id}_from" size="5" value="{/shop/*[name()=$nodename_from]}"/> до: <input type="text" name="property_id_{@id}_to" size="5" value="{/shop/*[name()=$nodename_to]}"/></xsl:if>
<xsl:if test="property_show_kind = 7">
<!-- Отображаем список с множественным выбором-->
<br/>
<select name="property_id_{@id}[]" multiple="">
<xsl:apply-templates select="list_items/list_item"/>
</select>
</xsl:if>
</td>
<xsl:if test="position() mod 6 = 0">
<xsl:text disable-output-escaping="yes">
</tr>
<tr valign="top">
</xsl:text>
</xsl:if>
</xsl:template>
<xsl:template match="properties_for_group/property">
<xsl:param name="std_filter" select="''"/>
<xsl:variable name="nodename">property_id_<xsl:value-of select="@id"/></xsl:variable>
<xsl:variable name="nodename_from">property_id_<xsl:value-of select="@id"/>_from</xsl:variable>
<xsl:variable name="nodename_to">property_id_<xsl:value-of select="@id"/>_to</xsl:variable>
<td>
<xsl:value-of disable-output-escaping="yes" select="property_name"/> 
<xsl:if test="property_show_kind = 1">
<!-- Отображаем поле ввода -->
<br/>
<input type="text" name="property_id_{@id}">
<xsl:if test="/shop/*[name()=$nodename] != ''">
<xsl:attribute name="value">
<xsl:value-of select="/shop/*[name()=$nodename]"/>
</xsl:attribute>
</xsl:if>
</input>
</xsl:if>
<xsl:if test="property_show_kind = 2">
<!-- Отображаем список -->
<xsl:variable name="current_property_id" select="@id"/>
<xsl:variable name="other_property_filter">
<xsl:apply-templates select="/shop/properties_for_group/property[property_show_kind != 0 and (shop_list_of_properties_type = 0 or shop_list_of_properties_type = 2 or shop_list_of_properties_type = 7)][@id != $current_property_id]"
mode="property_filter"/>
</xsl:variable>
<xsl:variable name="result_filter">
<xsl:value-of select="$std_filter"/>
<xsl:value-of select="$other_property_filter"/>
</xsl:variable>
<p>
<a href="./?apply_filter=1{$result_filter}">все</a>, 
<xsl:apply-templates select="list_items/list_item">
<xsl:with-param name="add_filter" select="$result_filter"/>
</xsl:apply-templates>
</p>
</xsl:if>
<xsl:if test="property_show_kind = 3">
<!-- Отображаем переключатели -->
<br/>
<input type="radio" name="property_id_{@id}" value="0" id="id_prop_radio_{@id}_0"></input>
<label for="id_prop_radio_{@id}_0">Любой вариант</label>
<xsl:apply-templates select="list_items/list_item"/>
</xsl:if>
<xsl:if test=" property_show_kind = 4">
<!-- Отображаем флажки -->
<xsl:apply-templates select="list_items/list_item"/>
</xsl:if>
<xsl:if test=" property_show_kind = 5">
<!-- Отображаем флажок -->
<br/>
<input type="checkbox" name="property_id_{@id}" id="property_id_{@id}" style="padding-top:4px">
<xsl:if test="/shop/*[name()=$nodename] != ''">
<xsl:attribute name="checked">
<xsl:value-of select="/shop/*[name()=$nodename]"/>
</xsl:attribute>
</xsl:if>
</input>
<label for="property_id_{@id}">Да</label>
</xsl:if>
<xsl:if test=" property_show_kind = 6">
<!-- Отображение полей "От.. До.." -->
<br/>от: <input type="text" name="property_id_{@id}_from" size="5" value="{/shop/*[name()=$nodename_from]}"/> до: <input type="text" name="property_id_{@id}_to" size="5" value="{/shop/*[name()=$nodename_to]}"/></xsl:if>
<xsl:if test="property_show_kind = 7">
<!-- Отображаем список с множественным выбором-->
<br/>
<select name="property_id_{@id}[]" multiple="">
<xsl:apply-templates select="list_items/list_item"/>
</select>
</xsl:if>
</td>
<xsl:if test="position() mod 6 = 0">
<xsl:text disable-output-escaping="yes">
</tr>
<tr valign="top">
</xsl:text>
</xsl:if>
</xsl:template>
<xsl:template match="list_items/list_item">
<xsl:param name="add_filter" select="''"/>
<xsl:if test="../../property_show_kind = 2">
<!-- Отображаем список ссылками -->
<xsl:variable name="nodename">property_id_<xsl:value-of select="../../@id"/></xsl:variable>
<a href="./?{$nodename}={@id}{$add_filter}&apply_filter=1">
<xsl:if test="/shop/*[name()=$nodename] = @id">
<xsl:attribute name="class">current</xsl:attribute>
</xsl:if>
<xsl:value-of disable-output-escaping="yes" select="list_item_value"/>
</a>
<xsl:if test="position() != last()">,<xsl:text> </xsl:text></xsl:if>
</xsl:if>
<xsl:if test="../../property_show_kind = 3">
<!-- Отображаем переключатели -->
<xsl:variable name="nodename">property_id_<xsl:value-of select="../../@id"/></xsl:variable>
<br/>
<input type="radio" name="property_id_{../../@id}" value="{@id}" id="id_property_id_{../../@id}_{@id}">
<xsl:if test="/shop/*[name()=$nodename] = @id">
<xsl:attribute name="checked">checked</xsl:attribute>
</xsl:if>
<label for="id_property_id_{../../@id}_{@id}">
<xsl:value-of disable-output-escaping="yes" select="list_item_value"/>
</label>
</input>
</xsl:if>
<xsl:if test="../../property_show_kind = 4">
<!-- Отображаем флажки -->
<xsl:variable name="nodename">property_id_<xsl:value-of select="../../@id"/>_item_id_<xsl:value-of select="@id"/></xsl:variable>
<br/>
<input type="checkbox" name="property_id_{../../@id}_item_id_{@id}" id="id_property_id_{../../@id}_{@id}">
<xsl:if test="/shop/*[name()=$nodename] = @id">
<xsl:attribute name="checked">checked</xsl:attribute>
</xsl:if>
<label for="id_property_id_{../../@id}_{@id}">
<xsl:value-of disable-output-escaping="yes" select="list_item_value"/>
</label>
</input>
</xsl:if>
<xsl:if test="../../property_show_kind = 7">
<!-- Отображаем список -->
<xsl:variable name="nodename">property_id_<xsl:value-of select="../../@id"/></xsl:variable>
<option value="{@id}">
<xsl:if test="/shop/*[name()=$nodename] = @id">
<xsl:attribute name="selected">
</xsl:attribute>
</xsl:if>
<xsl:value-of disable-output-escaping="yes" select="list_item_value"/>
</option>
</xsl:if>
</xsl:template>
<xsl:param name="add_filter" select="''"/>
<xsl:if test="../../property_show_kind = 2">
<!-- Отображаем список ссылками -->
<xsl:variable name="nodename">property_id_<xsl:value-of select="../../@id"/></xsl:variable>
<a href="./?{$nodename}={@id}{$add_filter}&apply_filter=1">
<xsl:if test="/shop/*[name()=$nodename] = @id">
<xsl:attribute name="class">current</xsl:attribute>
</xsl:if>
<xsl:value-of disable-output-escaping="yes" select="list_item_value"/>
</a>
<xsl:if test="position() != last()">,<xsl:text> </xsl:text></xsl:if>
</xsl:if>
<xsl:if test="../../property_show_kind = 3">
<!-- Отображаем переключатели -->
<xsl:variable name="nodename">property_id_<xsl:value-of select="../../@id"/></xsl:variable>
<br/>
<input type="radio" name="property_id_{../../@id}" value="{@id}" id="id_property_id_{../../@id}_{@id}">
<xsl:if test="/shop/*[name()=$nodename] = @id">
<xsl:attribute name="checked">checked</xsl:attribute>
</xsl:if>
<label for="id_property_id_{../../@id}_{@id}">
<xsl:value-of disable-output-escaping="yes" select="list_item_value"/>
</label>
</input>
</xsl:if>
<xsl:if test="../../property_show_kind = 4">
<!-- Отображаем флажки -->
<xsl:variable name="nodename">property_id_<xsl:value-of select="../../@id"/>_item_id_<xsl:value-of select="@id"/></xsl:variable>
<br/>
<input type="checkbox" name="property_id_{../../@id}_item_id_{@id}" id="id_property_id_{../../@id}_{@id}">
<xsl:if test="/shop/*[name()=$nodename] = @id">
<xsl:attribute name="checked">checked</xsl:attribute>
</xsl:if>
<label for="id_property_id_{../../@id}_{@id}">
<xsl:value-of disable-output-escaping="yes" select="list_item_value"/>
</label>
</input>
</xsl:if>
<xsl:if test="../../property_show_kind = 7">
<!-- Отображаем список -->
<xsl:variable name="nodename">property_id_<xsl:value-of select="../../@id"/></xsl:variable>
<option value="{@id}">
<xsl:if test="/shop/*[name()=$nodename] = @id">
<xsl:attribute name="selected">
</xsl:attribute>
</xsl:if>
<xsl:value-of disable-output-escaping="yes" select="list_item_value"/>
</option>
</xsl:if>
</xsl:template>
и добавим еще один новый
<!-- Шаблон для подстроки фильтра по дополнительным свойствам -->
<xsl:template match="properties_for_group/property" mode="property_filter">
<xsl:param name="std_filter" select="''"/>
<xsl:variable name="nodename">property_id_<xsl:value-of select="@id"/></xsl:variable>
<xsl:variable name="nodename_from">property_id_<xsl:value-of select="@id"/>_from</xsl:variable>
<xsl:variable name="nodename_to">property_id_<xsl:value-of select="@id"/>_to</xsl:variable>
<xsl:if test="/shop/*[name()=$nodename] != ''">
<xsl:text>&</xsl:text>
<xsl:value-of select="$nodename"/>
<xsl:text>=</xsl:text>
<xsl:value-of select="/shop/*[name()=$nodename]"/>
</xsl:if>
<xsl:if test="/shop/*[name()=$nodename_from] != ''">
<xsl:text>&</xsl:text>
<xsl:value-of select="$nodename_from"/>
<xsl:text>=</xsl:text>
<xsl:value-of select="/shop/*[name()=$nodename_from]"/>
</xsl:if>
<xsl:if test="/shop/*[name()=$nodename_to] != ''">
<xsl:text>&</xsl:text>
<xsl:value-of select="$nodename_to"/>
<xsl:text>=</xsl:text>
<xsl:value-of select="/shop/*[name()=$nodename_to]"/>
</xsl:if>
</xsl:template>
<xsl:template match="properties_for_group/property" mode="property_filter">
<xsl:param name="std_filter" select="''"/>
<xsl:variable name="nodename">property_id_<xsl:value-of select="@id"/></xsl:variable>
<xsl:variable name="nodename_from">property_id_<xsl:value-of select="@id"/>_from</xsl:variable>
<xsl:variable name="nodename_to">property_id_<xsl:value-of select="@id"/>_to</xsl:variable>
<xsl:if test="/shop/*[name()=$nodename] != ''">
<xsl:text>&</xsl:text>
<xsl:value-of select="$nodename"/>
<xsl:text>=</xsl:text>
<xsl:value-of select="/shop/*[name()=$nodename]"/>
</xsl:if>
<xsl:if test="/shop/*[name()=$nodename_from] != ''">
<xsl:text>&</xsl:text>
<xsl:value-of select="$nodename_from"/>
<xsl:text>=</xsl:text>
<xsl:value-of select="/shop/*[name()=$nodename_from]"/>
</xsl:if>
<xsl:if test="/shop/*[name()=$nodename_to] != ''">
<xsl:text>&</xsl:text>
<xsl:value-of select="$nodename_to"/>
<xsl:text>=</xsl:text>
<xsl:value-of select="/shop/*[name()=$nodename_to]"/>
</xsl:if>
</xsl:template>
Должно работать )
На ссылки будут заменяться те доп.свойства, у которых в в настройках выбрано отображение "Список-списком".
Заказов не беру. Консультирую редко.
Kotoff писал(а):
Все действительно работает! Вы Гений! Единственный нюанс а как то выделить выбранный параметр можно?
Должно работать)
Все действительно работает! Вы Гений! Единственный нюанс а как то выделить выбранный параметр можно?
Skype:ferdinant1988 ICQ:311960596 E-mail: ferdinant@i.ua
ferdinant, как-то можно 
Я сейчас в отпуске, поэтому пример написать не могу )
Но обратите внимание, как в исходном шаблоне сделано свойство selected для тега option, и сделайте по аналогии

Я сейчас в отпуске, поэтому пример написать не могу )
Но обратите внимание, как в исходном шаблоне сделано свойство selected для тега option, и сделайте по аналогии
Заказов не беру. Консультирую редко.
Kotoff писал(а):
С э этим я разобрался там класс current. Я с другой проблемой столкнулся! это цена от до и кнопкой применить. При нажатии применить обнуляется все параметры выбранные в фильтре! Как-то я хочу придумать что цену впихнуть в этот фильтр. и убрать кнопку применить. И вторая проблема при начатии фильтра с не первой страницы например page-3 то выбранные товары не показываются и пагинация пропадает!
Kotoff
Главное отдохните робота подождет! С э этим я разобрался там класс current. Я с другой проблемой столкнулся! это цена от до и кнопкой применить. При нажатии применить обнуляется все параметры выбранные в фильтре! Как-то я хочу придумать что цену впихнуть в этот фильтр. и убрать кнопку применить. И вторая проблема при начатии фильтра с не первой страницы например page-3 то выбранные товары не показываются и пагинация пропадает!
Skype:ferdinant1988 ICQ:311960596 E-mail: ferdinant@i.ua
Авторизация