Вывод нескольких сопутствующих товаров случайном порядке.

#
Вывод нескольких сопутствующих товаров случайном порядке.
Надо сделать так, чтоб отображались не все сопутствующие товары, а только, допустим два из них, при чем в случайном порядке они отображались. Подскажите, пожалуйста, как реализовать.
Модератор
#
Re: Вывод нескольких сопутствующих товаров случайном порядке.
Сделайте ограничение на количество выводимых сопутствующих товаров на уровне XSL.
#
Re: Вывод нескольких сопутствующих товаров случайном порядке.
Подскажите, пожалуйста, конкретно, что менять. Я только начал вникать в xsl.

<xsl:if test="count(tying/item) &gt; 0">
<xsl:apply-templates select="tying/item"/>
</xsl:if>

вот код вывода
Модератор
#
Re: Вывод нескольких сопутствующих товаров случайном порядке.
<xsl:apply-templates select="tying/item[2 > position()]"/>
#
Re: Вывод нескольких сопутствующих товаров случайном порядке.
Не работает, выводит все 3 сопутствующих товара...
Модератор
#
Re: Вывод нескольких сопутствующих товаров случайном порядке.
Ffardz,
Покажите XSL-шаблон целиком.
#
Re: Вывод нескольких сопутствующих товаров случайном порядке.
<xsl:if test="count(tying/item) &gt; 0">
  <!--<xsl:apply-templates select="tying/item"/>-->
  <xsl:apply-templates select="tying/item[2 > position()]"/>
</xsl:if>
Модератор
#
Re: Вывод нескольких сопутствующих товаров случайном порядке.
Ffardz,
целиком, пожалуйста. и XML можно заодно.
#
Re: Вывод нескольких сопутствующих товаров случайном порядке.
Точно такая же история, не выводиться т.к. вы посоветовали:

вывод:
               <xsl:if test="count(tying/item) &gt; 0">
                  <p>
                     <b>Сопутствующие товары:</b>
                  </p>
                  <!-- Отображаем сопутствующие товары -->
                  <xsl:apply-templates select="tying/item[2 > position()]"/>
                  <div style="clear: both;"></div>
               </xsl:if>


кусочек xml


<tying id="4170">
         <tying_count>0</tying_count>
         <item id="4170" group="1044">
            <captcha_key>72636</captcha_key>
            <name>Trie MH-10-AB (античная-бронза)</name>
            <show_count>5</show_count>
            <saller>0</saller>
            <marking_of_goods></marking_of_goods>
            <description></description>
            <date>03.07.2011</date>
            <datetime>03.07.2011 03:54:56</datetime>
            <time>03:54:56</time>
            <putoff_date>03.07.2011 03:54:56</putoff_date>
            <putend_date>00.00.0000 00:00:00</putend_date>
            <text></text>
            <image width="215" height="89">/upload/shop_4/4/1/7/item_4170/shop_items_catalog_image4170.jpg</image>
            <small_image width="150" height="62">/upload/shop_4/4/1/7/item_4170/small_shop_items_catalog_image4170.jpg</small_image>
            <type>0</type>
            <weight>0</weight>
            <weight_mesure>шт</weight_mesure>
            <rest>0.00</rest>
            <mesure></mesure>
            <shop_tax_id>0</shop_tax_id>
            <price>585.00</price>
            <price_tax>585.00</price_tax>
            <price_discount>585.00</price_discount>
            <item_currency>руб.</item_currency>
            <currency>руб.</currency>
            <is_active>1</is_active>
            <order>0</order>
            <path>trie-mh-10-ab-antichnaya-bronza</path>
            <fullpath>furnitura/dvernie-ruchki/morelli/iskusstvo-epohi-vozrojdeniya/</fullpath>
            <seo_title></seo_title>
            <seo_description></seo_description>
            <seo_keywords></seo_keywords>
            <indexation>1</indexation>
            <vendorCode></vendorCode>
            <shop_items_cml_id>4CD620E3-4365-62BA-8E9F-8A92C8D6A782</shop_items_cml_id>
            <user_id>0</user_id>
            <site_users_id>0</site_users_id>
            <shop_special_prices>
            </shop_special_prices>
            <warehouses>
               <warehouse id="1">0.00</warehouse>
            </warehouses>
         </item>
      </tying>
      <tying id="4169">
         <tying_count>0</tying_count>
         <item id="4169" group="1044">
            <captcha_key>9691</captcha_key>
            <name>Trie MH-10-SG (матовое золото)</name>
            <show_count>6</show_count>
            <saller>0</saller>
            <marking_of_goods></marking_of_goods>
            <description></description>
            <date>03.07.2011</date>
            <datetime>03.07.2011 03:46:06</datetime>
            <time>03:46:06</time>
            <putoff_date>03.07.2011 03:46:06</putoff_date>
            <putend_date>00.00.0000 00:00:00</putend_date>
            <text></text>
            <image width="215" height="89">/upload/shop_4/4/1/6/item_4169/shop_items_catalog_image4169.jpg</image>
            <small_image width="150" height="62">/upload/shop_4/4/1/6/item_4169/small_shop_items_catalog_image4169.jpg</small_image>
            <type>0</type>
            <weight>0</weight>
            <weight_mesure>шт</weight_mesure>
            <rest>0.00</rest>
            <mesure></mesure>
            <shop_tax_id>0</shop_tax_id>
            <price>585.00</price>
            <price_tax>585.00</price_tax>
            <price_discount>585.00</price_discount>
            <item_currency>руб.</item_currency>
            <currency>руб.</currency>
            <is_active>1</is_active>
            <order>0</order>
            <path>trie-mh-10-sg-matovoe-zoloto</path>
            <fullpath>furnitura/dvernie-ruchki/morelli/iskusstvo-epohi-vozrojdeniya/</fullpath>
            <seo_title></seo_title>
            <seo_description></seo_description>
            <seo_keywords></seo_keywords>
            <indexation>1</indexation>
            <vendorCode></vendorCode>
            <shop_items_cml_id>335D8CC7-BC01-DDDA-1852-364E7687906D</shop_items_cml_id>
            <user_id>0</user_id>
            <site_users_id>0</site_users_id>
            <shop_special_prices>
            </shop_special_prices>
            <warehouses>
               <warehouse id="1">0.00</warehouse>
            </warehouses>
         </item>
      </tying>

#
Re: Вывод нескольких сопутствующих товаров случайном порядке.
Неужели никто не реализовал подобное?
HOSTcms, подскажите, пожалуйста.
Авторизация