Опции товара в корзине
Copy
<!-- Шаблон для товара в корзине --><xsl:template match="shop_cart"> <xsl:variable name="item_id" select="shop_item_id"/> <xsl:variable name="id" select="shop_item[@id = $item_id]/@id"/> <xsl:variable name="shop_item" select="shop_item[@id = $item_id]"/> <xsl:variable name="price"><xsl:value-of disable-output-escaping="yes" select="sum(hostdev_shop_option_related_value/price) + sum(hostdev_shop_option_value/price) + $shop_item/price"/></xsl:variable> <xsl:variable name="oldoption_param"><xsl:call-template name="option_param"> <xsl:with-param name="shop_item" select="shop_item"/> <xsl:with-param name="prefix">oldoption</xsl:with-param> <xsl:with-param name="cart" select="."/> </xsl:call-template></xsl:variable> <xsl:variable name="option_param"><xsl:call-template name="option_param"> <xsl:with-param name="shop_item" select="shop_item"/> <xsl:with-param name="prefix">option</xsl:with-param> <xsl:with-param name="cart" select="."/> </xsl:call-template></xsl:variable> <tr> <td> <xsl:choose> <xsl:when test="/shop/hostdev_shop_share[shop_item[@id = $id]]"> <xsl:value-of disable-output-escaping="yes" select="shop_item/name"/> </xsl:when> <xsl:otherwise> <a href="{shop_item/url}"> <xsl:value-of disable-output-escaping="yes" select="shop_item/name"/> </a> </xsl:otherwise> </xsl:choose> <xsl:if test="/shop/hostdev_shop_share[shop_item[@id = $id]]"> <div><xsl:value-of disable-output-escaping="yes" select="/shop/hostdev_shop_share[shop_item[@id = $id]]/name"/></div> </xsl:if> <xsl:apply-templates select="/shop/hostdev_shop_options/hostdev_shop_option" mode="cart"> <xsl:with-param name="shop_item" select="$shop_item"/> <xsl:with-param name="oldoption" select="$oldoption_param"/> <xsl:with-param name="oldvariant" select="option_variant"/> <xsl:with-param name="cart" select="."/> <xsl:with-param name="position" select="position()"/> </xsl:apply-templates> <xsl:apply-templates select="/shop/hostdev_shop_related_options/hostdev_shop_option_related" mode="cart"> <xsl:with-param name="shop_item" select="$shop_item"/> <xsl:with-param name="oldoption" select="$oldoption_param"/> <xsl:with-param name="oldvariant" select="option_variant"/> <xsl:with-param name="cart" select="."/> <xsl:with-param name="position" select="position()"/> </xsl:apply-templates> </td> <td> <xsl:variable name="options_string"> <xsl:for-each select="hostdev_shop_option_value"> <xsl:sort order="ascending" data-type="number" select="@id"/>_<xsl:value-of disable-output-escaping="yes" select="@id"/></xsl:for-each>_v<xsl:value-of select="option_variant"/> </xsl:variable> <input type="text" size="3" name="quantity_{shop_item/@id}{$options_string}" id="quantity_{shop_item/@id}" value="{quantity}"/> </td> <td> <!-- Цена --> <xsl:value-of select="format-number($price, '### ##0.00', 'my')"/><xsl:text> </xsl:text><xsl:value-of select="shop_item/currency" disable-output-escaping="yes"/> </td> <td> <!-- Сумма --> <xsl:value-of disable-output-escaping="yes" select="format-number($price * quantity, '### ##0.00', 'my')"/><xsl:text> </xsl:text><xsl:value-of disable-output-escaping="yes" select="shop_item/currency"/> </td> <td align="center"> <xsl:if test="not(/shop/hostdev_shop_share[shop_item[@id = $id] and autoadd = 1])"> <a href="?delete={shop_item/@id}{$option_param}" onclick="return confirm('Вы уверены, что хотите удалить?')" title="Удалить товар из корзины" alt="Удалить товар из корзины">Удалить</a> </xsl:if></td> </tr></xsl:template>
30.03.2023