Вывод подгрупп магазина в два (несколько) столбцов

#
Вывод подгрупп магазина в два (несколько) столбцов
Добрый день. Подскажите, пожалуйста, как разделить подгруппы на два и более столбца. Вот код того, что имеется сейчас:

<!-- Шаблон для групп товара -->
<xsl:template match="group">
<xsl:variable name="parent_id" select="@parent"/>

<xsl:if test="not(propertys/property[@xml_name='xml_main']) or propertys/property[@xml_name='xml_main']/value = 0">

   <div  style="background: url('{small_image}') no-repeat right bottom;">
<xsl:choose>
  <xsl:when test="propertys/property[@xml_name='subg']">
      <xsl:attribute name="class">group_block_big<xsl:if test="position() = 1 or position() mod 3 = 1"><xsl:text> first</xsl:text></xsl:if><xsl:if test="position() mod 3 = 0"><xsl:text> last</xsl:text></xsl:if>
      </xsl:attribute>
  </xsl:when>
  <xsl:otherwise>
      <xsl:attribute name="class">group_block<xsl:if test="position() = 1 or position() mod 3 = 1"><xsl:text> first</xsl:text></xsl:if><xsl:if test="position() mod 3 = 0"><xsl:text> last</xsl:text></xsl:if>
      </xsl:attribute>
  </xsl:otherwise>
</xsl:choose>
      <div class="item">
         <xsl:choose>
            <xsl:when test="small_image != ''">
            <div class="title-text">
                      
                      
         <a href="{/shop/path}{fullpath}" class="group-a">
            <xsl:value-of disable-output-escaping="yes" select="name"/>&#160;<span style="color: #aaaaaa">(<xsl:value-of select="count_all_items"/>)</span>
         </a>
                                <!--a href="{/shop/path}{fullpath}"><img src="{small_image}" width="160" alt="{propertys/property[@xml_name='xml_alt']/value}"/></a--></div>
            </xsl:when>
            <xsl:otherwise>
            <div><!--a href="{/shop/path}{fullpath}"><img src="/images/nopict_small.png" class="image" width="160"/></a--></div>
            </xsl:otherwise>
         </xsl:choose>

                     <xsl:if test="propertys/property[@xml_name='subg']">
                        <xsl:apply-templates select="group" mode="sub_group" />
                     </xsl:if>

         <xsl:if test="propertys/property[@xml_name='xml_description']/value != ''">
            <a href="{/shop/path}{fullpath}" class="description"><xsl:value-of disable-output-escaping="yes" select="propertys/property[@xml_name='xml_description']/value"/></a>
         </xsl:if>
      </div>
   </div>
</xsl:if>
</xsl:template>


<!-- Шаблон для подразделов -->
<xsl:template match="group" mode="sub_group">

                <a href="{/shop/path}{fullpath}" class="group-a"><xsl:value-of disable-output-escaping="yes" select="name"/>&#160;<span style="color: #aaaaaa">(<xsl:value-of select="count_all_items"/>)</span></a>
      <!--xsl:if test="propertys/property[@xml_name='xml_description']/value != ''">
         <a href="{/shop/path}{fullpath}" class="description"><xsl:value-of disable-output-escaping="yes" select="propertys/property[@xml_name='xml_description']/value"/></a>
      </xsl:if-->

<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>

www.btb.su
#
Re: Вывод подгрупп магазина в два (несколько) столбцов
если честно не пойму вы хотели на базе допсвойств разбить товары?
вот код со стандартного шаблона
<!-- Отображение подгрупп данной группы, только если подгруппы есть и не идет фильтра по меткам -->
      <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>

и далее вывод:
   <!-- Шаблон для групп товара -->
   <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>
#
Re: Вывод подгрупп магазина в два (несколько) столбцов
далее если делить подгруппы на например 2 столбца ну соответсвенно

<!-- Шаблон для групп товара -->
    <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">
             <table><tr><xsl:apply-templates select="group" mode="sub_group"/></tr></table>
          </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">
       <td valign="top" width="50%"><a href="{/shop/path}{fullpath}">
          <xsl:value-of disable-output-escaping="yes" select="name"/>
       </a></td>
    </xsl:template>

<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>

Проверить в данный момент не могу но логика думаю понятна
Авторизация