6. Публикация магазина

Для публикации магазина на сайте необходимо выполнить несколько этапов.

Создание интернет-магазина

Первоначально создадим магазин. В разделе КонтентИнтернет-магазины выберите пункт меню МагазинДобавить и заполните форму

Обратите внимание, что после выполнения пункта 2 вам нужно будет вернуться к магазину и в списке "Узел структуры" выбрать узел который будет создан в пункте 2.

Создание узла структуры

В левом меню выберите раздел Структура сайтаСтруктура сайта. После перехода в список узлов структуры сайта в меню Раздел выбираете пункт Добавить.

XSL-шаблоны

В данном примере у узла выбраны уже предустановленные в системе XSL-шаблоны.Вы можете также использовать их, либо написать свою реализацию. Примеры основы XSL-шаблонов списка товаров и самого товара:

XSL-шаблон списка товаров

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE xsl:stylesheet>
<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:hostcms="https://www.hostcms.ru/"
    exclude-result-prefixes="hostcms">
    <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"/>

    <xsl:decimal-format name="my" decimal-separator="," grouping-separator=" "/>

    <xsl:template match="/">
        <xsl:apply-templates select="/shop"/>
    </xsl:template>

    <xsl:variable name="n" select="number(3)"/>

    <xsl:template match="/shop">
        <!-- Store parent id in a variable -->
        <xsl:variable name="group" select="group"/>

        <xsl:choose>
            <xsl:when test="$group = 0">
                <div class="page-title category-title">
                    <h1>
                        <i class="fa fa-bookmark-o"></i><xsl:value-of disable-output-escaping="yes" select="name"/>
                    </h1>
                </div>
            </xsl:when>
            <xsl:otherwise>
                <xsl:variable name="currentGroup" select=".//shop_group[@id=$group]" />
                
                <!-- Breadcrumbs -->
                <div class="breadcrumbs" xmlns:v="http://rdf.data-vocabulary.org/#">
                    <xsl:apply-templates select="$currentGroup" mode="breadCrumbs"/>
                </div>
            </xsl:otherwise>
        </xsl:choose>
        
        <xsl:variable name="count">1</xsl:variable>

        <xsl:if test="count(shop_item) &gt; 0 or /shop/filter = 1">
            <!-- дополнение пути для action, если выбрана метка -->
        <xsl:variable name="form_tag_url"><xsl:if test="count(tag) = 1">tag/<xsl:value-of select="tag/urlencode"/>/</xsl:if></xsl:variable>

            <xsl:variable name="path"><xsl:choose>
                <xsl:when test="/shop//shop_group[@id=$group]/node()"><xsl:value-of select="/shop//shop_group[@id=$group]/url"/></xsl:when>
                <xsl:otherwise><xsl:value-of select="/shop/url"/><xsl:if test="/shop/shop_producer/node()">producer-<xsl:value-of select="/shop/shop_producer/@id" />/</xsl:if></xsl:otherwise>
            </xsl:choose></xsl:variable>

            <form method="get" action="{$path}{$form_tag_url}">
                <xsl:if test="1=0">
                    <div class="shop_filter">
                        <div class="sorting">
                            <select name="sorting" onchange="$(this).parents('form:first').submit()">
                                <option>Сортировать</option>
                                <option value="1">
                                <xsl:if test="/shop/sorting = 1"><xsl:attribute name="selected">selected</xsl:attribute></xsl:if>
                                    По цене (сначала дешевые)
                                </option>
                                <option value="2">
                                <xsl:if test="/shop/sorting = 2"><xsl:attribute name="selected">selected</xsl:attribute></xsl:if>
                                    По цене (сначала дорогие)
                                </option>
                                <option value="3">
                                <xsl:if test="/shop/sorting = 3"><xsl:attribute name="selected">selected</xsl:attribute></xsl:if>
                                    По названию
                                </option>
                            </select>
                        </div>

                        <div class="priceFilter">
                            <xsl:text>Цена от: </xsl:text>
                            <input name="price_from" size="5" type="text">
                                <xsl:if test="/shop/price_from != 0">
                                    <xsl:attribute name="value"><xsl:value-of select="/shop/price_from"/></xsl:attribute>
                                </xsl:if>
                            </input>

                            <xsl:text>до: </xsl:text>
                            <input name="price_to" size="5" type="text">
                                <xsl:if test="/shop/price_to != 0">
                                    <xsl:attribute name="value"><xsl:value-of select="/shop/price_to"/></xsl:attribute>
                                </xsl:if>
                            </input>
                        </div>

                        <!-- Фильтр по дополнительным свойствам товара: -->
                        <xsl:if test="count(shop_item_properties//property[filter != 0 and (type = 0 or type = 1 or type = 3 or type = 7 or type = 11)])">
                            <span class="table_row"></span>
                            <xsl:apply-templates select="shop_item_properties//property[filter != 0 and (type = 0 or type = 1 or type = 3 or type = 7 or type = 11)]" mode="propertyList"/>
                        </xsl:if>

                        <input name="filter" class="button" value="Применить" type="submit"/>
                    </div>
                </xsl:if>
                <!-- Таблица с элементами для сравнения -->
                <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>
                </xsl:if>

                <!-- Выводим товары магазина -->
                <div class="row products-grid">
                    <xsl:apply-templates select="shop_item" />
                </div>

                <a id="compareButton" class="hostcms-button hostcms-button-red" href="{/shop/url}compare_items/">
                    <xsl:if test="count(/shop/comparing/shop_item) = 0">
                        <xsl:attribute name="style">display: none</xsl:attribute>
                    </xsl:if>
                    Сравнить товары
                </a>

                <xsl:if test="total &gt; 0 and limit &gt; 0">

                    <xsl:variable name="count_pages" select="ceiling(total div limit)"/>

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

                    <!-- Links before current -->
                    <xsl:variable name="pre_count_page"><xsl:choose>
                            <xsl:when test="page - (floor($real_visible_pages div 2)) &lt; 0">
                                <xsl:value-of select="page"/>
                            </xsl:when>
                            <xsl:when test="($count_pages - page - 1) &lt; floor($real_visible_pages div 2)">
                                <xsl:value-of select="$real_visible_pages - ($count_pages - 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>

                    <!-- Links after current -->
                    <xsl:variable name="post_count_page"><xsl:choose>
                            <xsl:when test="0 &gt; page - (floor($real_visible_pages div 2) - 1)">
                                <xsl:value-of select="$real_visible_pages - page - 1"/>
                            </xsl:when>
                            <xsl:when test="($count_pages - 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="page + 1 = $count_pages"><xsl:value-of select="page - $real_visible_pages + 1"/></xsl:when>
                            <xsl:when test="page - $pre_count_page &gt; 0"><xsl:value-of select="page - $pre_count_page"/></xsl:when>
                            <xsl:otherwise>0</xsl:otherwise>
                    </xsl:choose></xsl:variable>

                    <nav>
                        <ul class="pagination">
                            <xsl:call-template name="for">
                                <xsl:with-param name="limit" select="limit"/>
                                <xsl:with-param name="page" select="page"/>
                                <xsl:with-param name="items_count" select="total"/>
                                <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>
                        </ul>
                    </nav>
                </xsl:if>

                <!-- Filter String -->
    <xsl:variable name="filter"><xsl:if test="/shop/filter/node()">&amp;filter=1&amp;sorting=<xsl:value-of select="/shop/sorting"/>&amp;price_from=<xsl:value-of select="/shop/price_from"/>&amp;price_to=<xsl:value-of select="/shop/price_to"/><xsl:for-each select="/shop/*"><xsl:if test="starts-with(name(), 'property_')">&amp;<xsl:value-of select="name()"/>[]=<xsl:value-of select="."/></xsl:if></xsl:for-each></xsl:if></xsl:variable>

                <span class="on-page">Показать по:
                <a href="{$path}?on_page=20{$filter}">20</a><xsl:text> </xsl:text>
                <a href="{$path}?on_page=50{$filter}">50</a><xsl:text> </xsl:text>
                    <a href="{$path}?on_page=100{$filter}">100</a>
                </span>

                <div style="clear: both"></div>
            </form>
        </xsl:if>
    </xsl:template>

    <!-- Шаблон для товара -->
    <xsl:template match="shop_item">
        <div class="col-12 col-md-6 col-lg-4 item">
            <div class="grid_wrap">
                <xsl:if test="discount != 0">
                    <div class="ribbon-wrapper">
                        <div class="ribbon bg-color2">HOT</div>
                    </div>
                </xsl:if>

                <div class="product-image">
                    <a href="{url}" title="{name}">
                        <xsl:choose>
                            <xsl:when test="image_small != ''">
                                <img src="{dir}{image_small}" alt="{name}" class="img-responsive"/>
                            </xsl:when>
                            <xsl:otherwise>
                                <i class="fa fa-camera"></i>
                            </xsl:otherwise>
                        </xsl:choose>
                    </a>
                </div>

                <div class="price-box">
                    <span id="product-price-12-new" class="regular-price">
                        <span class="price">
                        <xsl:value-of select="format-number(price, '### ##0,00', 'my')"/><xsl:text> </xsl:text><xsl:value-of disable-output-escaping="yes" select="currency"/><xsl:text> </xsl:text>
                        </span>
                        <xsl:if test="discount != 0">
                            <br/>
                            <span class="old-price">
                            <xsl:value-of select="format-number(price+discount, '### ##0,00', 'my')"/><xsl:text> </xsl:text><xsl:value-of disable-output-escaping="yes" select="currency"/><xsl:text> </xsl:text>
                            </span>
                        </xsl:if>
                    </span>

                    <!-- Бонусы для товара -->
                    <xsl:if test="count(shop_bonuses/shop_bonus)">
                        <div class="product-bonuses">
                            +<xsl:value-of select="shop_bonuses/total" /> бонусов
                        </div>
                    </xsl:if>
                </div>

                <div class="product-shop">
                    <h3 class="product-name">
                        <a href="{url}" title="{name}">
                            <xsl:value-of disable-output-escaping="yes" select="name"/>
                        </a>
                    </h3>

                    <div class="actions">
                        <button class="hostcms-button hostcms-button-red" onclick="return $.bootstrapAddIntoCart('{/shop/url}cart/', {@id}, 1)" type="button" title="Add to Cart">В корзину</button>

                        <button class="hostcms-button" onclick="return $.oneStepCheckout('{/shop/url}cart/', {@id}, 1)" type="button" title="Fast Order" data-toggle="modal" data-target="#oneStepCheckout{@id}">Быстрый заказ</button>

                        <xsl:variable name="shop_item_id" select="@id" />
                        <ul class="add-to-links">
                            <li>
                                <xsl:if test="/shop/favorite/shop_item[@id = $shop_item_id]/node()">
                                    <xsl:attribute name="class">link-wishlist-current</xsl:attribute>
                                </xsl:if>
                            <a class="link-wishlist" onclick="return $.addFavorite('{/shop/url}', {@id}, this)">
                                <xsl:if test="/shop/favorite/shop_item[@id = $shop_item_id]/node()">
                                    <xsl:attribute name="class">favorite_current</xsl:attribute>
                                </xsl:if>
                                <i class="fa fa-heart-o"></i>Избранное
                            </a>
                            </li>
                            <li>
                                <xsl:if test="/shop/comparing/shop_item[@id = $shop_item_id]/node()">
                                    <xsl:attribute name="class">link-compare-current</xsl:attribute>
                                </xsl:if>
                                <span class="separator">|</span>
                            <a class="link-compare" onclick="return $.addCompare('{/shop/url}', {@id}, this)">
                                <xsl:if test="/shop/comparing/shop_item[@id = $shop_item_id]/node()">
                                    <xsl:attribute name="class">current</xsl:attribute>
                                </xsl:if>
                                <i class="fa fa-bar-chart"></i>Сравнить
                            </a>
                            </li>
                        </ul>
                    </div>
                </div>
            </div>
        </div>
    </xsl:template>

    <!-- Шаблон выводит рекурсивно ссылки на группы магазина -->
    <xsl:template match="shop_group" mode="breadCrumbs">
        <xsl:param name="parent_id" select="parent_id"/>

        <!-- Store parent id in a variable -->
        <xsl:param name="group" select="/shop/shop_group"/>

        <xsl:apply-templates select="//shop_group[@id=$parent_id]" mode="breadCrumbs"/>

        <xsl:if test="parent_id=0">
            <span typeof="v:Breadcrumb">
                <a title="{/shop/name}" href="{/shop/url}" hostcms:id="{/shop/@id}" hostcms:field="name" hostcms:entity="shop" class="root" property="v:title" rel="v:url">
                    <xsl:value-of select="/shop/name"/>
                </a>
            </span>
        </xsl:if>

        <i class="fa fa-angle-right"></i>

        <span typeof="v:Breadcrumb">
            <a title="{name}" href="{url}" hostcms:id="{@id}" hostcms:field="name" hostcms:entity="shop_group" property="v:title" rel="v:url">
                <xsl:value-of disable-output-escaping="yes" select="name"/>
            </a>
        </span>
    </xsl:template>

    <!-- Pagination -->
    <xsl:template name="for">

        <xsl:param name="limit"/>
        <xsl:param name="page"/>
        <xsl:param name="pre_count_page"/>
        <xsl:param name="post_count_page"/>
        <xsl:param name="i" select="0"/>
        <xsl:param name="items_count"/>
        <xsl:param name="visible_pages"/>

        <xsl:variable name="n" select="ceiling($items_count div $limit)"/>

        <xsl:variable name="start_page"><xsl:choose>
                <xsl:when test="$page + 1 = $n"><xsl:value-of select="$page - $visible_pages + 1"/></xsl:when>
                <xsl:when test="$page - $pre_count_page &gt; 0"><xsl:value-of select="$page - $pre_count_page"/></xsl:when>
                <xsl:otherwise>0</xsl:otherwise>
        </xsl:choose></xsl:variable>

        <xsl:if test="$i = $start_page and $page != 0">
            <li>
            <span aria-hidden="true"><i class="fa fa-angle-double-left"></i></span>
            </li>
        </xsl:if>

        <xsl:if test="$i = ($page + $post_count_page + 1) and $n != ($page+1)">
            <li>
            <span aria-hidden="true"><i class="fa fa-angle-double-right"></i></span>
            </li>
        </xsl:if>

        <!-- Filter String -->
<xsl:variable name="filter"><xsl:if test="/shop/filter/node()">?filter=1&amp;sorting=<xsl:value-of select="/shop/sorting"/>&amp;price_from=<xsl:value-of select="/shop/price_from"/>&amp;price_to=<xsl:value-of select="/shop/price_to"/><xsl:for-each select="/shop/*"><xsl:if test="starts-with(name(), 'property_')">&amp;<xsl:value-of select="name()"/>[]=<xsl:value-of select="."/></xsl:if></xsl:for-each></xsl:if></xsl:variable>

<xsl:variable name="on_page"><xsl:if test="/shop/on_page/node() and /shop/on_page > 0"><xsl:choose><xsl:when test="/shop/filter/node()">&amp;</xsl:when><xsl:otherwise>?</xsl:otherwise></xsl:choose>on_page=<xsl:value-of select="/shop/on_page"/></xsl:if></xsl:variable>

        <xsl:if test="$items_count &gt; $limit and ($page + $post_count_page + 1) &gt; $i">
            <!-- Store in the variable $group ID of the current group -->
            <xsl:variable name="group" select="/shop/group"/>

            <!-- Tag Path -->
        <xsl:variable name="tag_path"><xsl:if test="count(/shop/tag) != 0">tag/<xsl:value-of select="/shop/tag/urlencode"/>/</xsl:if></xsl:variable>

            <!-- Compare Product Path -->
        <xsl:variable name="shop_producer_path"><xsl:if test="count(/shop/shop_producer)">producer-<xsl:value-of select="/shop/shop_producer/@id"/>/</xsl:if></xsl:variable>

            <!-- Choose Group Path -->
<xsl:variable name="group_link"><xsl:choose><xsl:when test="$group != 0"><xsl:value-of select="/shop//shop_group[@id=$group]/url"/></xsl:when><xsl:otherwise><xsl:value-of select="/shop/url"/></xsl:otherwise></xsl:choose></xsl:variable>

            <!-- Set $link variable -->
        <xsl:variable name="number_link"><xsl:if test="$i != 0">page-<xsl:value-of select="$i + 1"/>/</xsl:if></xsl:variable>

            <!-- First pagination item -->
            <xsl:if test="$page - $pre_count_page &gt; 0 and $i = $start_page">
                <li>
                    <a href="{$group_link}{$tag_path}{$shop_producer_path}{$filter}{$on_page}" class="page_link" style="text-decoration: none;">←</a>
                </li>
            </xsl:if>

            <!-- Pagination item -->
            <xsl:if test="$i != $page">
                <xsl:if test="($page - $pre_count_page) &lt;= $i and $i &lt; $n">
                    <!-- Pagination item -->
                    <li>
                        <a href="{$group_link}{$number_link}{$tag_path}{$shop_producer_path}{$filter}{$on_page}" class="page_link">
                            <xsl:value-of select="$i + 1"/>
                        </a>
                    </li>
                </xsl:if>

                <!-- Last pagination item -->
                <xsl:if test="$i+1 &gt;= ($page + $post_count_page + 1) and $n &gt; ($page + 1 + $post_count_page)">
                    <!-- Last pagination item -->
                    <li>
                        <a href="{$group_link}page-{$n}/{$tag_path}{$shop_producer_path}{$filter}{$on_page}" class="page_link" style="text-decoration: none;">→</a>
                    </li>
                </xsl:if>
            </xsl:if>

            <!-- Ctrl+left link -->
            <xsl:if test="$page != 0 and $i = $page">
                <xsl:variable name="prev_number_link">
                    <xsl:if test="$page &gt; 1">page-<xsl:value-of select="$i"/>/</xsl:if>
                </xsl:variable>

                <a href="{$group_link}{$prev_number_link}{$tag_path}{$shop_producer_path}{$filter}{$on_page}" id="id_prev"></a>
            </xsl:if>

            <!-- Ctrl+right link -->
            <xsl:if test="($n - 1) > $page and $i = $page">
                <a href="{$group_link}page-{$page+2}/{$tag_path}{$shop_producer_path}{$filter}{$on_page}" id="id_next"></a>
            </xsl:if>

            <!-- Current pagination item -->
            <xsl:if test="$i = $page">
                <span class="current">
                    <xsl:value-of select="$i+1"/>
                </span>
            </xsl:if>

            <!-- Recursive Template -->
            <xsl:call-template name="for">
                <xsl:with-param name="i" select="$i + 1"/>
                <xsl:with-param name="limit" select="$limit"/>
                <xsl:with-param name="page" select="$page"/>
                <xsl:with-param name="items_count" select="$items_count"/>
                <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:stylesheet>

XSL-шаблон товара

<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE xsl:stylesheet>
<xsl:stylesheet version="1.0"
    xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
    xmlns:hostcms="https://www.hostcms.ru/"
    exclude-result-prefixes="hostcms">
    <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"/>

    <!-- МагазинТовар -->

    <xsl:decimal-format name="my" decimal-separator="," grouping-separator=" "/>

    <xsl:template match="/shop">
        <div class="row">
            <xsl:apply-templates select="shop_item"/>
        </div>
    </xsl:template>

    <xsl:template match="shop_item">
        <!-- Store parent id in a variable -->
        <xsl:variable name="group" select="/shop/group"/>

        <!-- Breadcrumbs -->
        <div class="breadcrumbs" xmlns:v="http://rdf.data-vocabulary.org/#">

            <xsl:if test="$group = 0">
                <span typeof="v:Breadcrumb">
                    <a title="{/shop/name}" href="{/shop/url}" hostcms:id="{/shop/@id}" hostcms:field="name" hostcms:entity="shop" property="v:title" rel="v:url">
                        <xsl:value-of disable-output-escaping="yes" select="/shop/name"/>
                    </a>
                </span>
            </xsl:if>

            <xsl:apply-templates select="/shop//shop_group[@id=$group]" mode="breadCrumbs"/>

            <!-- Если модификация, выводим в пути родительский товар -->
            <xsl:if test="shop_item/node()">
                <i class="fa fa-angle-right"></i>

                <span typeof="v:Breadcrumb">
                    <a title="{shop_item/name}" href="{shop_item/url}" property="v:title" rel="v:url">
                        <xsl:value-of disable-output-escaping="yes" select="shop_item/name"/>
                    </a>
                </span>
            </xsl:if>

            <i class="fa fa-angle-right"></i>

            <span typeof="v:Breadcrumb">
                <a href="{url}" hostcms:id="{@id}" hostcms:field="name" hostcms:entity="shop_item" property="v:title" rel="v:url"><xsl:value-of disable-output-escaping="yes" select="name"/></a>
            </span>
        </div>

        <h1 class="item_title">
            <xsl:value-of disable-output-escaping="yes" select="name"/>
        </h1>

        <!-- Show Message -->
        <xsl:if test="/shop/message/node()">
            <xsl:value-of disable-output-escaping="yes" select="/shop/message"/>
        </xsl:if>

        <div class="col-xs-6 col-sm-6 col-md-5 col-lg-5">
            <!-- Изображение для товара, если есть -->
            <xsl:if test="image_small != ''">
                <img id="zoom" src="{dir}{image_small}" data-zoom-image="{dir}{image_large}"/>

                <div id="gallery" style="margin-top:30px;">
                    <a href="#" data-image="{dir}{image_small}" data-zoom-image="{dir}{image_large}">
                        <img id="zoom" src="{dir}{image_small}" height="100"/>
                    </a>

                    <xsl:for-each select="property_value[tag_name='img'][file !='']">
                        <a href="#" data-image="{../dir}{file_small}" data-zoom-image="{../dir}{file}">
                            <img id="zoom" src="{../dir}{file_small}" height="100"/>
                        </a>
                    </xsl:for-each>
                </div>
            </xsl:if>
        </div>

        <div class="col-xs-6 col-sm-6 col-md-7 col-lg-7">
            <!-- Описание товара -->
            <xsl:if test="description != ''">
                <div class="item-description" hostcms:id="{@id}" hostcms:field="text" hostcms:entity="shop_item" hostcms:type="wysiwyg"><xsl:value-of disable-output-escaping="yes" select="description"/></div>
            </xsl:if>

            <hr/>

            <!-- Цена товара -->
            <xsl:if test="price != 0">
                <div class="item-price">
                <xsl:value-of select="format-number(price, '### ##0,00', 'my')"/><xsl:text> </xsl:text><xsl:value-of select="currency"/><xsl:text> </xsl:text>

                    <!-- Если цена со скидкой - выводим ее -->
                    <xsl:if test="discount != 0">
                        <span class="item-old-price">
                            <xsl:value-of select="format-number(price + discount, '### ##0,00', 'my')"/><xsl:text> </xsl:text><xsl:value-of select="currency" />
                    </span><xsl:text> </xsl:text>
                    </xsl:if>
                </div>
            </xsl:if>

            <div class="actions">
                <button id="cart" class="hostcms-button hostcms-button-red" data-item-id="{@id}" onclick="return $.bootstrapAddIntoCart('{/shop/url}cart/', $(this).data('item-id'), 1)" type="button" title="Add to Cart">В корзину</button>

                <button id="fast_order" class="hostcms-button" data-item-id="{@id}" onclick="return $.oneStepCheckout('{/shop/url}cart/', $(this).data('item-id'), 1)" type="button" title="Fast Order" data-toggle="modal" data-target="#oneStepCheckout{@id}">Быстрый заказ</button>
            </div>
        </div>
    </xsl:template>

    <!-- Шаблон для вывода звездочек (оценки) -->
    <xsl:template name="for">
        <xsl:param name="i" select="0"/>
        <xsl:param name="n"/>

        <input type="radio" name="shop_grade" value="{$i}" id="id_shop_grade_{$i}">
            <xsl:if test="/shop/shop_grade = $i">
                <xsl:attribute name="checked"></xsl:attribute>
            </xsl:if>
    </input><xsl:text> </xsl:text>
        <label for="id_shop_grade_{$i}">
            <xsl:call-template name="show_average_grade">
                <xsl:with-param name="grade" select="$i"/>
                <xsl:with-param name="const_grade" select="5"/>
            </xsl:call-template>
        </label>
        <br/>
        <xsl:if test="$n &gt; $i and $n &gt; 1">
            <xsl:call-template name="for">
                <xsl:with-param name="i" select="$i + 1"/>
                <xsl:with-param name="n" select="$n"/>
            </xsl:call-template>
        </xsl:if>
    </xsl:template>

    <!-- Шаблон выводит рекурсивно ссылки на группы магазина -->
    <xsl:template match="shop_group" mode="breadCrumbs">
        <xsl:param name="parent_id" select="parent_id"/>

        <!-- Store parent id in a variable -->
        <xsl:param name="group" select="/shop/shop_group"/>

        <xsl:apply-templates select="//shop_group[@id=$parent_id]" mode="breadCrumbs"/>

        <xsl:if test="parent_id=0">
            <span typeof="v:Breadcrumb">
                <a title="{/shop/name}" href="{/shop/url}" hostcms:id="{/shop/@id}" hostcms:field="name" hostcms:entity="shop" class="root" property="v:title" rel="v:url">
                    <xsl:value-of select="/shop/name"/>
                </a>
            </span>
        </xsl:if>

        <i class="fa fa-angle-right"></i>

        <span typeof="v:Breadcrumb">
            <a title="{name}" href="{url}" hostcms:id="{@id}" hostcms:field="name" hostcms:entity="shop_group" property="v:title" rel="v:url">
                <xsl:value-of disable-output-escaping="yes" select="name"/>
            </a>
        </span>

    </xsl:template>

    <!-- Declension of the numerals -->
    <xsl:template name="declension">

        <xsl:param name="number" select="number"/>

        <!-- Nominative case / Именительный падеж -->
    <xsl:variable name="nominative"><xsl:text>просмотр</xsl:text></xsl:variable>

        <!-- Genitive singular / Родительный падеж, единственное число -->
    <xsl:variable name="genitive_singular"><xsl:text>просмотра</xsl:text></xsl:variable>

    <xsl:variable name="genitive_plural"><xsl:text>просмотров</xsl:text></xsl:variable>
        <xsl:variable name="last_digit"><xsl:value-of select="$number mod 10"/></xsl:variable>
        <xsl:variable name="last_two_digits"><xsl:value-of select="$number mod 100"/></xsl:variable>

        <xsl:choose>
            <xsl:when test="$last_digit = 1 and $last_two_digits != 11">
                <xsl:value-of select="$nominative"/>
            </xsl:when>
            <xsl:when test="$last_digit = 2 and $last_two_digits != 12
                or $last_digit = 3 and $last_two_digits != 13
                or $last_digit = 4 and $last_two_digits != 14">
                <xsl:value-of select="$genitive_singular"/>
            </xsl:when>
            <xsl:otherwise>
                <xsl:value-of select="$genitive_plural"/>
            </xsl:otherwise>
        </xsl:choose>
    </xsl:template>
</xsl:stylesheet>

Не нашли ответ на свой вопрос в документации? Направьте обращение в службу поддержки или онлайн чат.