Answer the question
In order to leave comments, you need to log in
UMI.CMS - adding option selector to xsl template - blank page?
Good afternoon, a question about UMI.CMS.
Tell me, please, when adding the output of the add. options in the product template, just a white page appears. I add a code to object-view.xsl that is responsible for displaying additional product parameters such as size, color, quantity, an empty page comes out, the parameter code itself is from the popup-add-options.xsl file.
The main task is to display a list of product parameters not in a drop-down window when you click on the Add to Cart button, but on the very page of a detailed product description with a photo. Where after choosing, for example, the size, the buyer adds the product to the cart.
I work with UMI for the first time, I study the documentation, but there were difficulties with this issue. The point is that the add. the parameters are displayed in a modal window, I try to insert the code into the template and this is where it all starts :). I put approximate type options - it works without errors, I take the code to display optional parameters:
<xsl:template match="/">
<form class="options" action="/emarket/basket/put/element/{udata/page/@id}/">
<xsl:apply-templates select="//group[@name = 'catalog_option_props']/property" />
<input type="submit" class="button" value="Добавить"/>
</form>
</xsl:template>
<xsl:template match="property">
<table>
<thead>
<tr>
<th colspan="3" align="left">
<xsl:value-of select="concat(title, ':')" />
</th>
</tr>
</thead>
<tbody>
<xsl:apply-templates select="value/option" />
</tbody>
</table>
</xsl:template>
<xsl:template match="option">
<tr class="param_{object/@id}">
<td style="width:20px;">
<input type="radio" name="options[{../../@name}]" value="{object/@id}" id="{generate-id()}">
<xsl:if test="position() = 1">
<xsl:attribute name="checked">
<xsl:text>checked</xsl:text>
</xsl:attribute>
</xsl:if>
</input>
</td>
<td>
<label for="{generate-id()}">
<xsl:value-of select="object/@name" />
</label>
</td>
<td align="right">
<label for="{generate-id()}">
<p class="price"><span class="sum"><xsl:value-of select="@float" /> </span><span class="suffix">p</span></p>
<div class="add_amount">
<img class="minus" src="/templates/public/images/minus_amount.png"/>
<input id="amount_{@id}" class="amount" type="text" name="amount" value="1" maxlength="3"/>
<img class="plus" src="/templates/public/images/plus_amoun.png" />
</div>
</label>
</td>
</tr>
</xsl:template>
Answer the question
In order to leave comments, you need to log in
The reason for a blank page when working with an XSLT templating engine may indicate that there is an error in the template. Enable error display mode (config.ini):
[debug]
enabled = "1"
show-backtrace = "1"
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<!-- debug tools -->
<xsl:template match="*" mode="debug">
<textarea>
<xsl:copy-of select="*"/>
</textarea>
</xsl:template>
</xsl:stylesheet>
<xsl:include href="debug.xsl"/>
and used in any xsl:apply-templates
adding mode="debug"
, for example, like this:<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="property">
<xsl:apply-templates select="value/option" mode="debug" />
</xsl:template>
</xsl:stylesheet>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question