Модификации товаров

#
Re: Модификации товаров
Я так сделал хотя можно наверное и по другому...

<xsl:if test="type != 1 or (type = 1 and (eitem_count > 0 or eitem_count = -1))">
заменил на
<xsl:if test="(type != 1 or (type = 1 and (eitem_count > 0 or eitem_count = -1))) and modifications/item/property[@xml_name='cvet']/node()">

#
Re: Модификации товаров
МагазинКаталогТоваров

<?xml version="1.0" encoding="utf-8"?>
<!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="utf-8" indent="yes" method="html" omit-xml-declaration="no" version="1.0" media-type="text/xml"/>
   
   <xslecimal-format name="my" decimal-separator="," grouping-separator=" "/>
   
   <xsl:key name="property133" match="/shop/item/modifications/item/property[@xml_name='cvet']" use="value"/>
   <xsl:key name="property134" match="/shop/item/modifications/item/property[@xml_name='razmer']" use="value"/>
   <xsl:key name="property135" match="/shop/item/modifications/item/property[@xml_name='sterjen']" use="value"/>
   <xsl:key name="property136" match="/shop/item/modifications/item/property[@xml_name='nadpis']" use="value"/>
   <xsl:key name="property137" match="/shop/item/modifications/item/property[@xml_name='linbum']" use="value"/>
   <xsl:key name="property138" match="/shop/item/modifications/item/property[@xml_name='twerd']" use="value"/>
   
   <xsl:template match="/">
      <xsl:apply-templates select="/shop"/>
   </xsl:template>
   
   <!-- Шаблон для магазина -->
   <xsl:template match="/shop">
      
      <SCRIPT>
         <xsl:comment>
            <xsl:text disable-output-escaping="yes">
               <![CDATA[
               function GetSelectValue(selectName)
               {
               value=document.getElementById(selectName).value;
               return value;
               }
               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>";
               }
               // массив для хранения текущих рейтингов звезд
               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';
                  }
                  }
                  }
                  ]]>
               </xsl:text>
            </xsl:comment>
         </SCRIPT>      <!-- Получаем ID родительской группы и записываем в переменную $parent_group_id -->
         <xsl:variable name="parent_group_id" select="@current_group_id"/>
         
         <!-- Если в находимся корне - выводим название информационной системы -->
         <xsl:if test="$parent_group_id = 0">
            <h1>
               <xsl:value-of disable-output-escaping="yes" select="name"/>
            </h1>
         </xsl:if>
         
         <!-- Если в находимся в группе - выводим название группы -->
         <xsl:if test="$parent_group_id != 0">
            <h1>
               <xsl:value-of disable-output-escaping="yes" select=".//group[@id=$parent_group_id]/name"/>
            </h1>
         </xsl:if>
         
         <!-- Обработка выбранных тэгов -->
         <xsl:if test="count(selected_tags/tag) = 1">
         <h2>Метка &#8212; <strong><xsl:value-of select="selected_tags/tag/tag_name"/></strong>.</h2>
         </xsl:if>
         
         <!-- Путь к группе -->
         <div class="path">
            <xsl:apply-templates select=".//group[@id=$parent_group_id]" mode="goup_path"/>
         </div>
         <br/>
         <xsl:variable name="count">1</xsl:variable>
         
         <!-- Отображение подгрупп данной группы, только если подгруппы есть и не идет фильтра по меткам -->
         <xsl:if test="count(selected_tags/tag) = 0 and count(//group[@parent=$parent_group_id]) &gt; 0">
            <table width="100%" border="0" cellpadding="3" cellspacing="0">
               <tr>
                  <td valign="top">
                     <xsl:apply-templates select=".//group[@parent=$parent_group_id]"/>
                  </td>
               </tr>
            </table>
         </xsl:if>
         
         <!-- дополнение пути для action, если выбрана метка -->
      <xsl:variable name="form_tag_path"><xsl:if test="count(selected_tags/tag) = 1">tag/<xsl:value-of select="selected_tags/tag/tag_path_name"/>/</xsl:if></xsl:variable>
         <xsl:if test="count(item) &gt; 0  or apply_filter = 1">
            <form method="get" action="{/shop/path}{//group[@id=$parent_group_id]/fullpath}{$form_tag_path}">
               <div class="shop_block">
                  <div>
                     <!-- Если есть доступные производители -->
                     <xsl:if test="count(producerslist/producer) > 0">
                        Производитель:&#xA0;
                        <select name="producer_id">
                           <option value="0">&#x2026;</option>
                           <xsl:apply-templates select="producerslist/producer"/>
                        </select>&#xA0;
                     </xsl:if>
                     
                     <!-- Если есть доступные продавцы -->
                     <xsl:if test="count(sallers/saller) > 0">
                        Продавец:&#xA0;
                        <select name="saller_id">
                           <option value="0">&#x2026;</option>
                           <xsl:apply-templates select="sallers/saller"/>
                        </select>&#xA0;
                     </xsl:if>
                     
                     Цена от:&#xA0;
                     <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>&#xA0;
                     
                     до:&#xA0;
                     <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>&#xA0;
                     
                     <span style="white-space: nowrap">Товаров на странице:</span>&#xA0;
                     <select name="on_page">
                        <option value="0">&#x2026;</option>
                        <xsl:call-template name="for_on_page">
                           <xsl:with-param name="i" select="10"/>
                           <xsl:with-param name="n" select="50"/>
                        </xsl:call-template>
                     </select>&#xA0;
                  </div>
                  
                  <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)]) &gt; 0">
                     <p>
                        <b>Фильтр по дополнительным свойствам товара:</b>
                     </p>
                     <table cellpadding="10px" cellspacing="0">
                        <tr valign="top">
                           <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)]"/>
                        </tr>
                     </table>
                  </xsl:if>
                  <div class="nofloat" style="margin-left: 40%">
                     <div class="gray_button">
                        <div>
                           <input name="apply_filter" value="Применить" type="submit"/>
                        </div>
                     </div>
                  </div>
               </div>
               
               <!-- Таблица с элементами для сравнения -->
               <xsl:if test="count(/shop/compare_items/compare_item) &gt; 0">
                  <table cellpadding="5px" cellspacing="0" border="0">
                     <tr>
                        <td>
                           <input type="checkbox" onclick="SelectAllItemsByPrefix(this.checked, 'del_compare_id_'" />
                        </td>
                        <td>
                           <b>Сравниваемые элементы</b>
                        </td>
                     </tr>
                     <xsl:apply-templates select="compare_items/compare_item"/>
                  </table>
                  
                  <div class="nofloat" style="height: 47px; padding: 5px 0;">
                     <div class="gray_button left">
                        <div>
                           <input name="apply_compare" value="Сравнить" type="button" onclick="javascript:location='{/shop/path}compare_items/';"/>
                        </div>
                     </div>
                     <div class="gray_button right">
                        <div>
                           <input name="delete_compare" value="Удалить" type="submit"/>
                        </div>
                     </div>
                  </div>
                  
                  <!-- <input name="delete_all_compare" value="Удалить все" type="submit"/> -->
               </xsl:if>
               
               <!-- Сортировка товаров -->
               <div class="shop_block">
                  
                  <!-- Определяем ссылку с параметрами фильтра -->
                  <xsl:variable name="filter">
                     <xsl:if test="/shop/apply_filter/node()">?action=apply_filter&amp;producer_id=<xsl:value-of select="/shop/producer_id"/>&amp;saller_id=<xsl:value-of select="/shop/saller_id"/>&amp;price_from=<xsl:value-of select="/shop/price_from"/>&amp;price_to=<xsl:value-of select="/shop/price_to"/>&amp;on_page=<xsl:value-of select="/shop/on_page"/>
                        <xsl:if test="/shop/property_xml/node()">
                           <!-- GET для доп. свойств -->
                           <xsl:value-of select="/shop/property_xml"/>
                        </xsl:if>
                     </xsl:if>
                  </xsl:variable>
                  <!-- Определяем первый символ вопрос или амперсанд -->
                  <xsl:variable name="first_symbol">
                     <xsl:choose>
                        <xsl:when test="$filter != ''">&amp;</xsl:when>
                        <xsl:otherwise>?</xsl:otherwise>
                     </xsl:choose>
                  </xsl:variable>
                  <div style="float: left;">
                     Сортировать по алфавиту
                  </div>
                  <xsl:choose>
                     <xsl:when test="/shop/sort_by_field = 1 and /shop/order_direction = 'ASC'">
                        <div class="arrow_up">
                           <img src="/hostcmsfiles/images/arrow_up.png" style="float: left; filter: alpha(opacity=0); margin: 0px 0px -4px 0px" alt="по возрастанию"/>
                        </div>
                     </xsl:when>
                     <xsl:otherwise>
                        <div class="arrow_up_gray">
                           <a href="{$filter}{$first_symbol}sort_by_field=1&amp;order_direction=1" class="without_decor">
                              <img src="/hostcmsfiles/images/arrow_up_gray.png" alt="по возрастанию"/>
                           </a>
                        </div>
                     </xsl:otherwise>
                  </xsl:choose>
                  
                  <xsl:choose>
                     <xsl:when test="/shop/sort_by_field = 1 and /shop/order_direction = 'DESC'">
                        <div class="arrow_down">
                           <img src="/hostcmsfiles/images/arrow_down.png" alt="по убыванию"/>
                        </div>
                     </xsl:when>
                     <xsl:otherwise>
                        <div class="arrow_down_gray">
                           <a href="{$filter}{$first_symbol}sort_by_field=1&amp;order_direction=2" class="without_decor">
                              <img src="/hostcmsfiles/images/arrow_down_gray.png" alt="по убыванию"/>
                           </a>
                        </div>
                     </xsl:otherwise>
               </xsl:choose><div style="float: left;">,&#xA0;по цене</div>
                  
                  <xsl:choose>
                     <xsl:when test="/shop/sort_by_field = 2 and /shop/order_direction = 'ASC'">
                        <div class="arrow_up">
                           <img src="/hostcmsfiles/images/arrow_up.png" alt="по возрастанию"/>
                        </div>
                     </xsl:when>
                     <xsl:otherwise>
                        <div class="arrow_up_gray">
                           <a href="{$filter}{$first_symbol}sort_by_field=2&amp;order_direction=1" class="without_decor">
                              <img src="/hostcmsfiles/images/arrow_up_gray.png" alt="по возрастанию"/></a>
                        </div>
                     </xsl:otherwise>
                  </xsl:choose>
                  
                  <xsl:choose>
                     <xsl:when test="/shop/sort_by_field = 2 and /shop/order_direction = 'DESC'">
                        <div class="arrow_down">
                           <img src="/hostcmsfiles/images/arrow_down.png" style="filter: alpha(opacity=0); margin: 0px 0px -4px 0px" alt="по убыванию"/>
                        </div>
                     </xsl:when>
                     <xsl:otherwise>
                        <div class="arrow_down_gray">
                           <a href="{$filter}{$first_symbol}sort_by_field=2&amp;order_direction=2" class="without_decor">
                              <img src="/hostcmsfiles/images/arrow_down_gray.png" alt="по убыванию"/>
                           </a>
                        </div>
                     </xsl:otherwise>
                  </xsl:choose>
                  
                  <div class="clearing"></div>
               </div>
               
               <!-- Определяем ссылку с параметрами фильтра -->
               <xsl:variable name="filter">
                  <xsl:choose>
                     <xsl:when test="/shop/apply_filter/node()">?action=apply_filter&amp;producer_id=<xsl:value-of select="/shop/producer_id"/>&amp;saller_id=<xsl:value-of select="/shop/saller_id"/>&amp;price_from=<xsl:value-of select="/shop/price_from"/>&amp;price_to=<xsl:value-of select="/shop/price_to"/>&amp;on_page=<xsl:value-of select="/shop/on_page"/>
                        <xsl:if test="/shop/property_xml/node()">
                           <!-- GET для доп. свойств -->
                           <xsl:value-of select="/shop/property_xml"/>
                        </xsl:if>
                     </xsl:when>
                     <xsl:otherwise></xsl:otherwise>
                  </xsl:choose>
               </xsl:variable>
               <!-- Определяем первый символ вопрос или амперсанд -->
               <xsl:variable name="first_symbol">
                  <xsl:choose>
                     <xsl:when test="$filter != ''">&amp;</xsl:when>
                     <xsl:otherwise>?</xsl:otherwise>
                  </xsl:choose>
               </xsl:variable>
               
               <xsl:apply-templates select="item" />
               
               <xsl:if test="count_items &gt; 0">
                  <div class="nofloat" style="height: 27px; padding: 0 0 20px 0;">
                     <div class="gray_button">
                        <div>
                           <input name="add_compare" value="Добавить для сравнения" type="submit" />
                        </div>
                     </div>
                  </div>
               </xsl:if>
               
               <xsl:if test="count(/shop/group[@id = /shop/@current_group_id]/propertys/property) > 0">
                  <div style="margin: 10px 0px;">
                     <h2>Атрибуты группы товаров</h2>
                     
                     <xsl:if test="count(property[@dir_id = 0])">
                        <table border="0">
                           <xsl:apply-templates select="property[@dir_id = 0]"/>
                        </table>
                     </xsl:if>
                     
                     <xsl:apply-templates select="/shop/properties_groups_dir"/>
                  </div>
               </xsl:if>
               
               <xsl:if test="count_items &gt; 0 and items_on_page &gt; 0">
                  
                  <xsl:variable name="count_pages" select="ceiling(count_items div items_on_page)"/>
                  
                  <xsl:variable name="visible_pages" select="5"/>
                  
                  <xsl:variable name="real_visible_pages"><xsl:choose>
                        <xsl:when test="$count_pages &lt; $visible_pages"><xsl:value-of select="$count_pages"/></xsl:when>
                        <xsl:otherwise><xsl:value-of select="$visible_pages"/></xsl:otherwise>
                  </xsl:choose></xsl:variable>
                  
                  <!-- Считаем количество выводимых ссылок перед текущим элементом -->
                  <xsl:variable name="pre_count_page"><xsl:choose>
                        <xsl:when test="current_page  - (floor($real_visible_pages div 2)) &lt; 0">
                           <xsl:value-of select="current_page"/>
                        </xsl:when>
                        <xsl:when test="($count_pages  - current_page - 1) &lt; floor($real_visible_pages div 2)">
                           <xsl:value-of select="$real_visible_pages - ($count_pages  - current_page - 1) - 1"/>
                        </xsl:when>
                        <xsl:otherwise>
                           <xsl:choose>
                              <xsl:when test="round($real_visible_pages div 2) = $real_visible_pages div 2">
                                 <xsl:value-of select="floor($real_visible_pages div 2) - 1"/>
                              </xsl:when>
                              <xsl:otherwise>
                                 <xsl:value-of select="floor($real_visible_pages div 2)"/>
                              </xsl:otherwise>
                           </xsl:choose>
                        </xsl:otherwise>
                  </xsl:choose></xsl:variable>
                  
                  <!-- Считаем количество выводимых ссылок после текущего элемента -->
                  <xsl:variable name="post_count_page"><xsl:choose>
                        <xsl:when test="0 &gt; current_page - (floor($real_visible_pages div 2) - 1)">
                           <xsl:value-of select="$real_visible_pages - current_page - 1"/>
                        </xsl:when>
                        <xsl:when test="($count_pages  - current_page - 1) &lt; floor($real_visible_pages div 2)">
                           <xsl:value-of select="$real_visible_pages - $pre_count_page - 1"/>
                        </xsl:when>
                        <xsl:otherwise>
                           <xsl:value-of select="$real_visible_pages - $pre_count_page - 1"/>
                        </xsl:otherwise>
                  </xsl:choose></xsl:variable>
                  
                  <xsl:variable name="i"><xsl:choose>
                        <xsl:when test="current_page + 1 = $count_pages"><xsl:value-of select="current_page - $real_visible_pages + 1"/></xsl:when>
                        <xsl:when test="current_page - $pre_count_page &gt; 0"><xsl:value-of select="current_page - $pre_count_page"/></xsl:when>
                        <xsl:otherwise>0</xsl:otherwise>
                  </xsl:choose></xsl:variable>
                  
                  <p>
                     <xsl:call-template name="for">
                        <xsl:with-param name="items_on_page" select="items_on_page"/>
                        <xsl:with-param name="current_page" select="current_page"/>
                        <xsl:with-param name="count_items" select="count_items"/>
                        <xsl:with-param name="i" select="$i"/>
                        <xsl:with-param name="post_count_page" select="$post_count_page"/>
                        <xsl:with-param name="pre_count_page" select="$pre_count_page"/>
                        <xsl:with-param name="visible_pages" select="$real_visible_pages"/>
                     </xsl:call-template>
                  </p>
                  <div style="clear: both"></div>
               </xsl:if>
               
            </form>
         </xsl:if>
      </xsl:template>
      
      <!-- Вывод раздела для свойств группы товаров -->
      <xsl:template match="properties_groups_dir">
         
      <p><b><xsl:value-of select="shop_properties_groups_dir_name"/></b></p>
         
         <xsl:variable name="dir_id" select="@id"/>
         
         <xsl:if test="count(/shop/group[@id = /shop/@current_group_id]/propertys/property)">
            <table border="0">
               <xsl:apply-templates select="/shop/group[@id = /shop/@current_group_id]/propertys/property[@parent_id = $dir_id]"/>
            </table>
         </xsl:if>
         
         <xsl:if test="count(properties_groups_dir)">
            <blockquote>
               <xsl:apply-templates select="properties_groups_dir"/>
            </blockquote>
         </xsl:if>
      </xsl:template>
      
      <!-- Вывод строки со значением свойства -->
      <xsl:template match="property">
         <tr>
            <td style="padding: 5px" bgcolor="#eeeeee">
               <b><xsl:value-of select="name"/></b>
            </td>
            <td style="padding: 5px" bgcolor="#eeeeee">
               <xsl:choose>
                  <xsl:when test="type = 1">
                     <a href="{file_path}">Скачать файл</a>
                  </xsl:when>
                  <xsl:when test="type = 7">
                     <xsl:choose>
                        <xsl:when test="value = 1">
                           <input type="checkbox" checked="" disabled="" />
                        </xsl:when>
                        <xsl:otherwise>
                           <input type="checkbox" disabled="" />
                        </xsl:otherwise>
                     </xsl:choose>
                  </xsl:when>
                  <xsl:otherwise>
                     <xsl:value-of disable-output-escaping="yes" select="value"/>
                  </xsl:otherwise>
               </xsl:choose>
            </td>
         </tr>
      </xsl:template>
      
      <!-- Шаблон для списка товаров для сравнения -->
      <xsl:template match="compare_items/compare_item">
         <xsl:variable name="var_compare_id" select="."/>
         <tr>
            <td>
               <input type="checkbox" name="del_compare_id_{compare_item_id}" id="id_del_compare_id_{compare_item_id}"/>
            </td>
            <td>
               <a href="{/shop/path}{compare_item_fullpath}{compare_item_path}/">
                  <xsl:value-of disable-output-escaping="yes" select="compare_item_name"/>
               </a>
            </td>
         </tr>
      </xsl:template>
      
      <!-- Шаблон для фильтра производителей -->
      <xsl:template match="producerslist/producer">
         
         <xsl:param name="id_prod" select="@id"/>
         <!--
         <xsl:variable name="node_name" select="concat('производители', $id_prod)"/>
         
         <xsl:if test="count(/shop/*[name() = $node_name])">
            -->
            
            <option value="{@id}">
               <xsl:if test="@id = /shop/producer_id">
                  <xsl:attribute name="selected"> </xsl:attribute>
               </xsl:if>
               <xsl:value-of disable-output-escaping="yes" select="shop_producers_list_name"/>
            </option>
            <!--
         </xsl:if>
         -->
         
      </xsl:template>
      
      <!-- Шаблон для фильтра продавцов -->
      <xsl:template match="sallers/saller">
         <option value="{@id}">
            <xsl:if test="@id = /shop/saller_id">
               <xsl:attribute name="selected">
               </xsl:attribute>
            </xsl:if>
            <xsl:value-of select="sallers_name"/>
         </option>
      </xsl:template>
      
      <!-- Шаблон для фильтра по дополнительным свойствам -->
      <xsl:template match="properties_for_group/property">
         
         <xsl:variable name="nodename">property_id_<xsl:value-of select="@id"/></xsl:variable>
         
         <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"/>&#xA0;
            <xsl:if test="property_show_kind = 1">
               <!-- Отображаем поле ввода -->
               <br/>
               <input type="text" name="property_id_{@id}">
                  <xsl:if test="/shop/*[name()=$nodename] != ''">
                     <xsl:attribute name="value">
                        <xsl:value-of select="/shop/*[name()=$nodename]"/>
                     </xsl:attribute>
                  </xsl:if>
               </input>
            </xsl:if>
            <xsl:if test="property_show_kind = 2">
               <!-- Отображаем список -->
               <br/>
               <select name="property_id_{@id}">
                  <option value="0">...</option>-->
                  <xsl:apply-templates select="list_items/list_item"/>
               </select>
            </xsl:if>
            <xsl:if test="property_show_kind = 3">
               <!-- Отображаем переключатели -->
               <br/>
               <input type="radio" name="property_id_{@id}" value="0" id="id_prop_radio_{@id}_0"></input>
               <label for="id_prop_radio_{@id}_0">Любой вариант</label>
               <xsl:apply-templates select="list_items/list_item"/>
            </xsl:if>
            
            <xsl:if test=" property_show_kind = 4">
               <!-- Отображаем флажки -->
               <xsl:apply-templates select="list_items/list_item"/>
            </xsl:if>
            
            <xsl:if test=" property_show_kind = 5">
               <!-- Отображаем флажок -->
               <br/>
               <input type="checkbox" name="property_id_{@id}" id="property_id_{@id}" style="padding-top:4px">
                  <xsl:if test="/shop/*[name()=$nodename] != ''">
                     <xsl:attribute name="checked">
                        <xsl:value-of select="/shop/*[name()=$nodename]"/>
                     </xsl:attribute>
                  </xsl:if>
               </input>
               <label for="property_id_{@id}">Да</label>
            </xsl:if>
            
            <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 and position() != last()">
            <xsl:text disable-output-escaping="yes">
               &lt;/tr&gt;
               &lt;tr valign="top"&gt;
            </xsl:text>
         </xsl:if>
      </xsl:template>
      
      <xsl:template match="list_items/list_item">
         <xsl:if test="../../property_show_kind = 2">
            <!-- Отображаем список -->
            <xsl:variable name="nodename">property_id_<xsl:value-of select="../../@id"/></xsl:variable>
            <option value="{@id}">
               <xsl:if test="/shop/*[name()=$nodename] = @id">
                  <xsl:attribute name="selected">
                  </xsl:attribute>
               </xsl:if>
               <xsl:value-of disable-output-escaping="yes" select="list_item_value"/>
            </option>
         </xsl:if>
         <xsl:if test="../../property_show_kind = 3">
            <!-- Отображаем переключатели -->
            <xsl:variable name="nodename">property_id_<xsl:value-of select="../../@id"/></xsl:variable>
            <br/>
            <input type="radio" name="property_id_{../../@id}" value="{@id}" id="id_property_id_{../../@id}_{@id}">
               <xsl:if test="/shop/*[name()=$nodename] = @id">
                  <xsl:attribute name="checked">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>
      
      <!-- Цикл с шагом 10 для select'a количества элементов на страницу -->
      <xsl:template name="for_on_page">
         <xsl:param name="i" select="0"/>
         <xsl:param name="n"/>
         
         <option value="{$i}">
            <xsl:if test="$i = /shop/on_page">
               <xsl:attribute name="selected">
               </xsl:attribute>
            </xsl:if>
            <xsl:value-of select="$i"/>
         </option>
         
         <xsl:if test="$n &gt; $i">
            <!-- Рекурсивный вызов шаблона -->
            <xsl:call-template name="for_on_page">
               <xsl:with-param name="i" select="$i + 10"/>
               <xsl:with-param name="n" select="$n"/>
            </xsl:call-template>
         </xsl:if>
      </xsl:template>
      
      <!-- Шаблон для групп товара -->
      <xsl:template match="group">
         
         <xsl:variable name="parent_id" select="@parent"/>
         
         <div style="margin-bottom: 15px;">
            <a href="{/shop/path}{fullpath}" style="font-weight: bold">
               <xsl:value-of disable-output-escaping="yes" select="name"/>
         </a>&#xA0;<span style="color: #aaaaaa">(<xsl:value-of select="count_all_items"/></span>
            <br/>
            <xsl:value-of disable-output-escaping="yes" select="description"/>
            
            <xsl:if test="count(group) &gt; 1">
               <xsl:apply-templates select="group" mode="sub_group"/>
            </xsl:if>
         </div>
         
         <xsl:if test="position()= round(count(//group[@parent = $parent_id]) div 2)">
            <xsl:text disable-output-escaping="yes">
               &lt;/td&gt;
               &lt;td valign="top" width="50%"&gt;
            </xsl:text>
         </xsl:if>
      </xsl:template>
      
      <!-- Шаблон для подразделов -->
      <xsl:template match="group" mode="sub_group">
         <a href="{/shop/path}{fullpath}">
            <xsl:value-of disable-output-escaping="yes" select="name"/>
         </a>
         <xsl:variable name="parent_id" select="@parent"/>
         <!-- Ставим запятую после группы, за которой следуют еще группы из данной родителской группы -->
         <xsl:if test="position() != last() and count(//group[@parent = $parent_id]) &gt; 1">,&#xA0;</xsl:if>
      </xsl:template>
      
      <!-- Шаблон для товара -->
      <xsl:template match="item">
         
         <!-- Определяем цвет фона -->
         <xsl:variable name="background_color">
            <xsl:choose>
               <xsl:when test="(position() + 1) mod 2 &gt; 0">#f7f7f7</xsl:when>
               <xsl:otherwise>#ffffff</xsl:otherwise>
            </xsl:choose>
         </xsl:variable>
         
         <table width="97%" border="0" cellpadding="0" cellspacing="0" style="padding-bottom: 7px; margin-bottom: 15px; margin-right: 10px; border-bottom: 1px solid #dadada">
            <tr>
               <td colspan="4" style="padding-bottom: 4px">
                  <!-- Название товара -->
                  <div  style="font-size: 13pt">
                     <a href="{/shop/path}{fullpath}{path}/" class="cat_title">
                        <xsl:value-of disable-output-escaping="yes" select="name"/>
                     </a>
                  </div>
                  
               </td>
            </tr>
            <tr>
               <td class="cat_t" style="width: 110px" valign="top">
                  <!-- Изображение для товара, если есть -->
                  <xsl:if test="small_image!=''">
                     
                     <div id="gallery" style="float: left; width: {small_image/@width}px; margin: 0px 10px 10px 0px; color: #aaaaaa;">
                        <a href="{image}" target="_blank" class="highslide" onclick="return hs.expand(this)" title="{name}">
                           <img src="{small_image}" class="image" />
                        </a>
                        <div class="highslide-caption">
                           Внимание!  Цвет  и  рисунок  на  товаре  могут отличаться от реального внешнего вида.
                        </div>
                        
                  </div>            </xsl:if>
               </td>
               <td style="vertical-align: top; padding-left: 12px;">
                  
                  <!-- Описание товара -->
                  <xsl:value-of disable-output-escaping="yes" select="description"/>
                  
                  <!-- Если электронный товар, выведим доступное количество -->
                  <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>
                  
                  <!-- Метки -->
                  <xsl:if test="count(tags/tag) &gt; 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="saller!=0">
                     <!-- Идентификатор текущего продавца -->
                     <p>
                        <xsl:variable name="saller_id" select="saller"/>
                        <b>Продавец:&#xA0;</b>
                        <a href="{/shop/path}sallers/saller-{saller}/">
                           <xsl:value-of select="/shop/sallers/saller[@id=$saller_id]/sallers_name"/>
                        </a>
                     </p>
                  </xsl:if>
                  
                  <!-- Если указан вес товара -->
                  <xsl:if test="weight != 0">
                     <p>
                        Вес товара: <xsl:value-of select="weight"/>&#xA0;<xsl:value-of select="weight_mesure"/>
                     </p>
                  </xsl:if>
                  
                  <!-- Скидки -->
                  <xsl:if test="count(discount) &gt; 0">
                     <p>
                        Скидки: <xsl:apply-templates select="discount"/>
                     </p>
                  </xsl:if>
                  
                  <!-- Спеццены -->
                  <xsl:if test="count(shop_special_prices/special_price) &gt; 0">
                     <p>
                        <b>Специальные цены:</b>
                        <xsl:apply-templates select="shop_special_prices/special_price"/>
                     </p>
                  </xsl:if>
                  
                  <!-- Вывод цен в другой валюте -->
                  <!--   <xsl:variable name="price" select="price_discount"/> -->
                  
                  <!--   <xsl:if test="count(/shop/all_currency/shop_currency) > 1 and $price > 0"> -->
                     <!--      <p><b>Цена в других валютах:</b>-->
                        <!-- Выбираем валюты -->
                        <!--         <xsl:for-each select="/shop/all_currency/shop_currency"> -->
                           <!-- Выводим валюты кроме текущей -->
                           <!--            <xsl:if test="@id != /shop/shop_currency/@id"> -->
                              <!--               <br /><xsl:value-of select="format-number($price * shop_currency_coefficient, '### ##0,00', 'my'"/>&#xA0;<xsl:value-of disable-output-escaping="yes" select="shop_currency_name"/>-->
                              <!--            </xsl:if>-->
                           <!--         </xsl:for-each>-->
                        <!--      </p>-->
                     <!--   </xsl:if>-->
                  
                  
                  <!-- Модификации -->
                  <xsl:if test="count(modifications/item[not(property[@id=133]/node()) and not(property[@id=134]/node()) and not(property[@id=135]/node()) and not(property[@id=136]/node()) and not(property[@id=137]/node()) and not(property[@id=138]/node())]) &gt; 0">
                     <div>
                        <h2>Модификации:</h2>
                        <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[not(property[@id=133]/node()) and not(property[@id=146]/node())]"/>
                        </table>
                     </div>
                  </xsl:if>
                  <div style="margin-left: -4px; margin-top: 5px">
                     <xsl:variable name="var_compare_id" select="@id"/>
                     <input type="checkbox" name="compare_id_{@id}" id="id_compare_id_{@id}">
                     <label for="id_compare_id_{@id}">&#xA0;<span style="border-bottom: dashed 1px">Добавить для сравнения</span>&#xA0;</label>
                     </input>
                  </div>
               </td>
               
               <td width="128" valign="top" style="padding-left: 30px">
                  <xsl:if test="property[@xml_name = 'novinka']/value != '' and property[@xml_name = 'novinka']/value = 'Да'">
                     <img src="/images/new.gif"/>
                  </xsl:if>
                  
                  <xsl:if test="property[@xml_name = 'hot']/value != '' and property[@xml_name = 'hot']/value = 'Да'">
                     <img src="/images/hot.gif"/>
                  </xsl:if>
               </td>
               
               <td width="130" class="cat_price_label" style="padding-left: 10px" valign="top">
                  <!-- Цена товара -->
                  <div style="display: inline">
                     <xsl:choose>
                        <xsl:when test="price_discount != 0">
                           <span style="font-size: 11pt">
                              <b>
                                 <xsl:variable name="price" select="price_discount"/>
                                 <xsl:value-of select="format-number($price, '### ##0,00', 'my'"/>&#xA0;
                                 <!-- Валюта товара -->
                                 <xsl:value-of disable-output-escaping="yes" select="currency"/>
                              </b>
                           </span>
                        </xsl:when>
                        <xsl:otherwise>
                           <span style="font-size: 11pt">
                              <b>цена&#xA0;договорная</b>
                           </span>
                        </xsl:otherwise>
                     </xsl:choose>
                     <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'"/>&#xA0;<xsl:value-of disable-output-escaping="yes" select="currency"/></span>
                        </span>
                        <br/>
                     </xsl:if>
                     
                     <xsl:choose>
                        <xsl:when test="modifications/item/property[@xml_name='cvet']/node() or modifications/item/property[@xml_name='razmer']/node() or modifications/item/property[@xml_name='sterjen']/node() or modifications/item/property[@xml_name='nadpis']/node() or modifications/item/property[@xml_name='linbum']/node() or modifications/item/property[@xml_name='twerd']/node()">
                           
                           <!-- Ссылку на добавление в корзины выводим, если:
                           type != 1 - простой тип товара или делимый (0 - простой, 2 - делимый)
                           type = 1 - электронный товар, при этом остаток на складе больше 0 или -1,
                           что означает неограниченное количество -->
                           
                           
                           <xsl:if test="(type != 1 or (type = 1 and (eitem_count > 0 or eitem_count = -1))) and modifications/item/property[@xml_name='cvet']/node()">
                              <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&amp;item_id={@id}" onclick="return AddIntoCart('{/shop/path}', {@id}, document.getElementById('count_{@id}'.value + '&amp;property133=' + GetSelectValue('property133')">
                                    <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>
                           
                           <xsl:if test="(type != 1 or (type = 1 and (eitem_count > 0 or eitem_count = -1))) and modifications/item/property[@xml_name='razmer']/node()">
                              <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&amp;item_id={@id}" onclick="return AddIntoCart('{/shop/path}', {@id}, document.getElementById('count_{@id}'.value + '&amp;property134=' + GetSelectValue('property134')">
                                    <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>
                           
                           <xsl:if test="(type != 1 or (type = 1 and (eitem_count > 0 or eitem_count = -1))) and modifications/item/property[@xml_name='sterjen']/node()">
                              <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&amp;item_id={@id}" onclick="return AddIntoCart('{/shop/path}', {@id}, document.getElementById('count_{@id}'.value + '&amp;property135=' + GetSelectValue('property135')">
                                    <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>
                           
                           <xsl:if test="(type != 1 or (type = 1 and (eitem_count > 0 or eitem_count = -1))) and modifications/item/property[@xml_name='nadpis']/node()">
                              <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&amp;item_id={@id}" onclick="return AddIntoCart('{/shop/path}', {@id}, document.getElementById('count_{@id}'.value + '&amp;property136=' + GetSelectValue('property136')">
                                    <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>
                           
                           <xsl:if test="(type != 1 or (type = 1 and (eitem_count > 0 or eitem_count = -1))) and modifications/item/property[@xml_name='linbum']/node()">
                              <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&amp;item_id={@id}" onclick="return AddIntoCart('{/shop/path}', {@id}, document.getElementById('count_{@id}'.value + '&amp;property137=' + GetSelectValue('property137')">
                                    <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>
                           
                           <xsl:if test="(type != 1 or (type = 1 and (eitem_count > 0 or eitem_count = -1))) and modifications/item/property[@xml_name='twerd']/node()">
                              <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&amp;item_id={@id}" onclick="return AddIntoCart('{/shop/path}', {@id}, document.getElementById('count_{@id}'.value + '&amp;property138=' + GetSelectValue('property138')">
                                    <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>
                           
                           
                           
                           
                           <!-- Цвет-->
                           <xsl:if test="modifications/item/property[@xml_name='cvet']/node()">
                              <div style="width: 10px; float: left; padding:20 15px;">
                                 <b>Цвет</b>
                                 <select name="property133" id="property133">
                                    <xsl:apply-templates select="modifications/item/property[@xml_name='cvet' and generate-id(.)=generate-id(key('property133', value))]"/>
                                 </select>
                              </div>
                           </xsl:if>
                           <!-- Размер-->
                           <xsl:if test="modifications/item/property[@xml_name='razmer']/node()">
                              <div style="width: 10px; float: left; padding:20 15px;">
                                 <b>Размер</b>
                                 <select name="property134" id="property134">
                                    <xsl:apply-templates select="modifications/item/property[@xml_name='razmer' and generate-id(.)=generate-id(key('property134', value))]"/>
                                 </select>
                              </div>
                           </xsl:if><!-- Стержень-->
                           <xsl:if test="modifications/item/property[@xml_name='sterjen']/node()">
                              <div style="width: 10px; float: left; padding:20 15px;">
                                 <b>Стержень</b>
                                 <select name="property135" id="property135">
                                    <xsl:apply-templates select="modifications/item/property[@xml_name='sterjen' and generate-id(.)=generate-id(key('property135', value))]"/>
                                 </select>
                              </div>
                           </xsl:if><!-- Надпись-->
                           <xsl:if test="modifications/item/property[@xml_name='nadpis']/node()">
                              <div style="width: 10px; float: left; padding:20 15px;">
                                 <b>Надпись</b>
                                 <select name="property136" id="property136">
                                    <xsl:apply-templates select="modifications/item/property[@xml_name='nadpis' and generate-id(.)=generate-id(key('property136', value))]"/>
                                 </select>
                              </div>
                           </xsl:if><!-- Лин Бумага-->
                           <xsl:if test="modifications/item/property[@xml_name='linbum']/node()">
                              <div style="width: 10px; float: left; padding:20 15px;">
                                 <b>Линовка бумаги</b>
                                 <select name="property137" id="property137">
                                    <xsl:apply-templates select="modifications/item/property[@xml_name='linbum' and generate-id(.)=generate-id(key('property137', value))]"/>
                                 </select>
                              </div>
                           </xsl:if><!-- Твердость-->
                           <xsl:if test="modifications/item/property[@xml_name='twerd']/node()">
                              <div style="width: 10px; float: left; padding:20 15px;">
                                 <b>Твердость</b>
                                 <select name="property138" id="property138">
                                    <xsl:apply-templates select="modifications/item/property[@xml_name='twerd' and generate-id(.)=generate-id(key('property138', value))]"/>
                                 </select>
                              </div>
                           </xsl:if>
                        </xsl:when>
                        <xsl:otherwise>
                           
                           <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&amp;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:otherwise>
                     </xsl:choose>
                     
                  </div>
               </td>
            </tr>
         </table>
      </xsl:template>
      
      <!-- /// Метки для товаров /// -->
      <xsl:template match="tags/tag">
         <a href="{/shop/path}tag/{tag_path_name}/" class="tag">
            <xsl:value-of select="tag_name"/>
         </a>
      <xsl:if test="position() != last()"><xsl:text>, </xsl:text></xsl:if>
      </xsl:template>
      
      
      <!-- Шаблон для модификаций -->
      <xsl:template match="modifications/item">
         <tr>
            <td>
               
               <a href="{/shop/path}{fullpath}{path}/">
                  <img src="{small_image}" class="image" />
               </a>
               
            </td>
            <td>
               <!-- Название модификации -->
               <a href="{/shop/path}{fullpath}{path}/">
                  <xsl:value-of disable-output-escaping="yes" select="name"/>
               </a>
            </td>
            <td>
               <!-- Цена модификации -->
               <xsl:choose>
                  <xsl:when test="price_discount != 0">
                     <xsl:value-of disable-output-escaping="yes" select="price_discount"/>&#xA0;
                     <!-- Валюта товара -->
                     <xsl:value-of disable-output-escaping="yes" select="currency"/>
                  </xsl:when>
                  <xsl:otherwise>договорная</xsl:otherwise>
               </xsl:choose>
            </td>
         </tr>
      </xsl:template>
      
      <!-- Шаблон для скидки -->
      <xsl:template match="discount">
         <br/>
         <xsl:value-of disable-output-escaping="yes" select="name"/>&#xA0;
         <xsl:value-of disable-output-escaping="yes" select="value"/>%</xsl:template>
      
      <!-- Шаблон для спеццен -->
      <xsl:template match="special_price">
         
         <xsl:variable name="item_id" select="@item_id" />
         
         <br/>
         от <xsl:value-of select="shop_special_prices_from"/> до <xsl:value-of select="shop_special_prices_to"/>&#xA0;<xsl:value-of select="/shop/item[@id = $item_id]/mesure"/>
         <xsl:text> </xsl:text>
         &#8212;
         <xsl:text> </xsl:text>
         <xsl:value-of select="format-number(shop_special_prices_price,'### ##0,00', 'my'" />&#xA0;<xsl:value-of select="/shop/item[@id = $item_id]/currency"/>
         за 1 <xsl:value-of select="/shop/item[@id = $item_id]/mesure"/>
      </xsl:template>
      
      <!-- Цикл для вывода строк ссылок -->
      <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 &gt; 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">
               &#8592; Ctrl
            </span>
         </xsl:if>
         
         <xsl:if test="$i = ($current_page + $post_count_page + 1) and $n != ($current_page+1)">
            <span class="ctrl">
               Ctrl &#8594;
            </span>
         </xsl:if>
         
         <xsl:if test="$count_items &gt; $items_on_page and ($current_page + $post_count_page + 1) &gt; $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">
               <xsl:choose>
                  <xsl:when test="/shop/apply_filter/node()">?action=apply_filter&amp;producer_id=<xsl:value-of select="/shop/producer_id"/>&amp;saller_id=<xsl:value-of select="/shop/saller_id"/>&amp;price_from=<xsl:value-of select="/shop/price_from"/>&amp;price_to=<xsl:value-of select="/shop/price_to"/>&amp;on_page=<xsl:value-of select="/shop/on_page"/>
                     <xsl:if test="/shop/property_xml/node()">
                        <!-- GET для доп. свойств -->
                        <xsl:value-of select="/shop/property_xml"/>
                     </xsl:if>
                  </xsl:when>
                  <xsl:otherwise></xsl:otherwise>
               </xsl:choose>
            </xsl:variable>
            
            <!-- Определяем первый символ вопрос или амперсанд -->
            <xsl:variable name="first_symbol">
               <xsl:choose>
                  <xsl:when test="$filter != ''">&amp;</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"/>&amp;order_direction=1</xsl:when>
                        <!-- Стрелка вниз -->
                        <xsl:otherwise>
                           <xsl:value-of select="$first_symbol"/>sort_by_field=<xsl:value-of select="/shop/sort_by_field"/>&amp;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 &gt; 0 and $i = $start_page">
               <a href="{/shop/path}{$group_link}{$tag_path}{$filter}{$arrows}" class="page_link" style="text-decoration: none;">&#x2190;</a>
            </xsl:if>
            
            <!-- Ставим ссылку на страницу-->
            <xsl:if test="$i != $current_page">
               <xsl:if test="($current_page - $pre_count_page) &lt;= $i and $i &lt; $n">
                  <!-- Выводим ссылки на видимые страницы -->
                  <a href="{/shop/path}{$group_link}{$tag_path}{$number_link}{$filter}{$arrows}" class="page_link">
                     <xsl:value-of select="$i + 1"/>
                  </a>
               </xsl:if>
               
               <!-- Выводим ссылку на последнюю страницу -->
               <xsl:if test="$i+1 &gt;= ($current_page + $post_count_page + 1) and $n &gt; ($current_page + 1 + $post_count_page)">
                  <!-- Выводим ссылку на последнюю страницу -->
                  <a href="{/shop/path}{$group_link}{$tag_path}page-{$n}/{$filter}{$arrows}" class="page_link" style="text-decoration: none;">&#x2192;</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}" id="id_prev"></a>
            </xsl:if>
            
            <!-- Ссылка на следующую страницу для Ctrl + вправо -->
            <xsl:if test="($n - 1) > $current_page and $i = $current_page">
               <a href="{/shop/path}{$group_link}{$tag_path}page-{$current_page+2}/{$filter}{$arrows}" id="id_next"></a>
            </xsl:if>
            
            <!-- Не ставим ссылку на страницу-->
            <xsl:if test="$i = $current_page">
               <span class="current">
                  <xsl:value-of select="$i+1"/>
               </span>
            </xsl:if>
            
            <!-- Рекурсивный вызов шаблона. НЕОБХОДИМО ПЕРЕДАВАТЬ ВСЕ НЕОБХОДИМЫЕ ПАРАМЕТРЫ! -->
            <xsl:call-template name="for">
               <xsl:with-param name="i" select="$i + 1"/>
               <xsl:with-param name="items_on_page" select="$items_on_page"/>
               <xsl:with-param name="current_page" select="$current_page"/>
               <xsl:with-param name="count_items" select="$count_items"/>
               <xsl:with-param name="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">&#x2192;</span>
         
         <a href="{/shop/path}{fullpath}">
            <xsl:value-of disable-output-escaping="yes" select="name"/>
         </a>
      </xsl:template>
      <!-- для цвета -->
      <xsl:template match="modifications/item/property[@xml_name='cvet']">
         <xsl:variable name="value" select="value" />
         <option value="{/shop/properties_for_group/property[@xml_name='cvet']/list_items/list_item[list_item_value=$value]/@id}" ><xsl:value-of select="value"/></option>
      </xsl:template>
      
      <!-- для размеров -->
      <xsl:template match="modifications/item/property[@xml_name='razmer']">
         <xsl:variable name="value" select="value" />
         <option value="{/shop/properties_for_group/property[@xml_name='razmer']/list_items/list_item[list_item_value=$value]/@id}" ><xsl:value-of select="value"/></option>
      </xsl:template>
      <!-- для стержней -->
      <xsl:template match="modifications/item/property[@xml_name='sterjen']">
         <xsl:variable name="value" select="value" />
         <option value="{/shop/properties_for_group/property[@xml_name='sterjen']/list_items/list_item[list_item_value=$value]/@id}" ><xsl:value-of select="value"/></option>
      </xsl:template>
      
      <!-- для надписи -->
      <xsl:template match="modifications/item/property[@xml_name='nadpis']">
         <xsl:variable name="value" select="value" />
         <option value="{/shop/properties_for_group/property[@xml_name='nadpis']/list_items/list_item[list_item_value=$value]/@id}" ><xsl:value-of select="value"/></option>
      </xsl:template><!-- для линейной бумаги -->
      <xsl:template match="modifications/item/property[@xml_name='linbum']">
         <xsl:variable name="value" select="value" />
         <option value="{/shop/properties_for_group/property[@xml_name='linbum']/list_items/list_item[list_item_value=$value]/@id}" ><xsl:value-of select="value"/></option>
      </xsl:template>
      
      <!-- для твердости -->
      <xsl:template match="modifications/item/property[@xml_name='twerd']">
         <xsl:variable name="value" select="value" />
         <option value="{/shop/properties_for_group/property[@xml_name='twerd']/list_items/list_item[list_item_value=$value]/@id}" ><xsl:value-of select="value"/></option>
      </xsl:template>
   </xsl:stylesheet>
#
Re: Модификации товаров
А если сочетание модификаций? Например Колготки размера .. и цвета .., или кофта размера .., но без выбора цвета? Или, например, вообще товар без модификаций?
#
Re: Модификации товаров
А как быть, если модификаций товаров несколько? Например размер и цвет? Это ж сколько модификаций.. Да еще для разных групп товаром разных.. Может цвет можно обыграть проще?
#
Re: Модификации товаров
tanich писал(а):
А если сочетание модификаций? Например Колготки размера.. и цвета.. , или кофта размера.. , но без выбора цвета?
- третий параметр, передаваемый в функцию AddIntoCart, - это строка, вы можете предварительно ее сформировать на JavaScript-е, а только затем передать. С помощью метода getElementsByName можно проверить существует ли на странице список с заданным именем(которое может строиться из строки 'property' и идентификатора свойства, например). Такую проверку можно организовать в отдельном тэмплейте(перебирая все свойства, чтобы из их идентификаторов и строки 'property' строить имя списка), и в зависимости от нее добавлять или нет к результирующей строке(передаваемой в AddIntoCart) имя списка и его значение.
#
Re: Модификации товаров
Доброго всем времени суток.
Прошу помощи в таком вопросе: как и многие посетители данного топика, сражаюсь с нестандартным выводом/выбором модификаций товара (чтобы отдельно выбрать цвет/размер). Большую часть вопросов был снят отличным примером со второй страницы от natalya.
Затык, однако, возник на самом последнем этапе: добавление модификации с выбранными параметрами в корзину. Как в рассмотренном примере, у меня в AddIntoCart третьим параметром передается строка, учитывающая дополнительные свойства:
count_173=1&property124=2&property123=3&property125=010

Строка параметров формируется и отправляется, вроде, правильно (проверял отладчиком в Opera). Однако в корзину упорно добавляется первая из имеющихся модификаций товара, независимо от переданных параметров. Подскажите, п-та, где и что еще можно копнуть?
#
Re: Модификации товаров
MaaKut писал(а):
Однако в корзину упорно добавляется первая из имеющихся модификаций товара, независимо от переданных параметров
- если добавляется именно модификация(а не родительский товар), то искать причину проблемы нужно в PHP-коде, который вставляется в код настроек тип. дин. страницы корзины для реализации функционала. Т.е. у вас для товара с идентификатором 173 имеется модификация, у которой в базе данных в качестве значений ее доп. свойств с ID 124, 123 и 125 записано 2, 3 и 010 соответственно? Если да, то в коде настроек тип. дин. страницы корзины попробуйте распечатать массивы $property_array и $item_propertys_value(перед вызовом функции array_diff_assoc).
#
Re: Модификации товаров
natalya,
Кажется, разобрался. В вашем коде значения доп. свойств модификации приводятся к целочисленному типу:
// Получаем значение элемента списка
$item_propertys_value[$id] = to_int($list_property_value['shop_properties_items_value']);

У меня же одно из свойств (со значением "010" должно быть просто строкой; приведение его к целому числу и портило всю малину: с клиента приходит именно "010". Замена to_int на strval, вроде, решила проблему.
#
Re: Модификации товаров
Добрый день, подскажите следующее:
1. У товара есть модификации (т.е. у модификаций цена есть, а у основного товара нет) и при выводе в магазине пишет 0, что и где нужно написать чтобы проверялась цена основного товара и если 0, то вместо него выводилась модификация???
Заранее спасибо!
Программист без пива как шампанское без пробки- быстро выдыхается.
#
Re: Модификации товаров
Неужели никто не знает решения. хотя бы подскажите где копать?????
Дополнения к этому вопросу.... то же самое только с количеством......
(суммирую):
Исходные данные: все это надо делать в МагазинКаталогТоваров ну или в ТДС магазина
1. Есть товар: Лопата (кол-во:0, цена:0)
2. Есть модификации: красная лопата (кол-во:5, цена:50 руб)
                     Штыковая лопата(кол-во:3, цена: 100 руб)
                     Совковая лопата(кол-во:0, цена:120 руб)
Если вставляю:
  
$element['type'] = 0; // 0 - основное св-во, 1 - дополнительное
    $element['prefix'] = ' AND ';
    $element['name'] = 'shop_items_catalog_rest';
    $element['if'] = '>=';
    $element['value'] = '1';
    $element['sufix'] = '';
    $param['select'][] = $element;*/

   то непоказывает основной товар лопата т.к. количество 0, сделал в xsl проверку на количество модификации, теперь выводит только модификации с количеством больше 0....
но остались вопросы:
- как сделать проверку в ТДС или в xsl макете для товара(плана, если кол-во товара равно 0 и колво модификаций на складе равно 0 то товар не выводить, или наоборот выводить если количество товара или одной из модификаций больше 0)
- как программно установить цену для основного товара, цену нужно взять из цен модификаций (минимум и максимум -если цены разные, или одну цену-если они одинаковые).
Бъюсь уже несколько дней..... что то ничего в голову не приходит, да и полезных решений немного близких к этому не найду.... Поскажите хотя бы где, что и зачем.....
Заранее спасибо....

Программист без пива как шампанское без пробки- быстро выдыхается.
Авторизация