Модификации товаров
kvasiliy писал(а):
Тоже самое абсолютно и для Select'ов
Цитата:
Перекидывает сразу в корзину и только главный товар! Почему? Помогите пожалуйста!
natalya писал(а):
»{/shop/path}cart/?action=add&item_id={@id}» onclick=«return AddIntoCart('{/shop/path}', {@id}, document.getElementById('count_{@id}'
.value + '&property145=' + GetRadioValueModif('property145'
+ '&property146=' + GetRadioValueModif('property146'
)»
так ссылка почему-то не работает… (перебрасывет сразу в корзину и добавляет только главный товар)
а вот так (без добавления второго товара работает)
"{/shop/path}cart/?action=add&item_id={@id}" onclick="return AddIntoCart('{/shop/path}', {@id}, document.getElementById('count_{@id}'
.value + '&property145=' + GetRadioValueModif('property145'
)"
так работает но добавляется только одна модификация из списка (разумеется)
Почему при дрбавлении фторой модификации в эту ссылку перекидывает сразу в корзину?
»{/shop/path}cart/?action=add&item_id={@id}» onclick=«return AddIntoCart('{/shop/path}', {@id}, document.getElementById('count_{@id}'
.value + '&property145=' + GetRadioValueModif('property145'
+ '&property146=' + GetRadioValueModif('property146'
)»так ссылка почему-то не работает… (перебрасывет сразу в корзину и добавляет только главный товар)
а вот так (без добавления второго товара работает)
"{/shop/path}cart/?action=add&item_id={@id}" onclick="return AddIntoCart('{/shop/path}', {@id}, document.getElementById('count_{@id}'
.value + '&property145=' + GetRadioValueModif('property145'
)"так работает но добавляется только одна модификация из списка (разумеется)
Почему при дрбавлении фторой модификации в эту ссылку перекидывает сразу в корзину?
Тоже самое абсолютно и для Select'ов
Цитата:
<a href="/shop/cart/?action=add&item_id=355" onclick="return AddIntoCart('/shop/', 355, document.getElementById('count_355'
.value + '&property133=' + GetSelectValue('property133'
+ '&property134=' + GetSelectValue('property134'
+ '&property135=' + GetSelectValue('property135'
+ '&property136=' + GetSelectValue('property136'
)">
.value + '&property133=' + GetSelectValue('property133'
+ '&property134=' + GetSelectValue('property134'
+ '&property135=' + GetSelectValue('property135'
+ '&property136=' + GetSelectValue('property136'
)">Перекидывает сразу в корзину и только главный товар! Почему? Помогите пожалуйста!
tanich писал(а):
Перекидывает сразу в корзину и только главный товар! Почему?
- на этот вопрос нет возможности дать точный ответ, не видя самой проблемы. Как правило, причина в ошибках JavaScript-а. Сообщите адрес страницы с проблемой.Вот полный 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">
<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
ecimal-format name="my" decimal-separator="," grouping-separator=" "/>
<xsl:key name="property133" match="/shop/item/modifications/item/property[@xml_name='razmer_obuvi']" use="value"/>
<xsl:key name="property134" match="/shop/item/modifications/item/property[@xml_name='razm_odez']" use="value"/>
<xsl:key name="property135" match="/shop/item/modifications/item/property[@xml_name='razm_kolg']" use="value"/>
<xsl:key name="property136" match="/shop/item/modifications/item/property[@xml_name='razm_nosk']" use="value"/>
<xsl:template match="/shop">
<xsl:apply-templates select="item"/>
</xsl:template>
<xsl:template match="item">
<SCRIPT>
<xsl:comment>
<xsl:text disable-output-escaping="yes">
<![CDATA[
function GetSelectValue(selectName)
{
value=document.getElementById(selectName).value;
return value;
}
function ShowImgWindow(title, src, width, height)
{
obj = window.open("", "", "scrollbars=0,dialog=0,minimizable=1,modal=1,width="+width+",height="+height+",resizable=0"
;
obj.document.write("<html>"
;
obj.document.write("<head>"
;
obj.document.write("<title>"+title+"</title>"
;
obj.document.write("</head>"
;
obj.document.write("<body topmargin=0 leftmargin=0 marginwidth=0 marginheight=0>"
;
obj.document.write("<img src=\""+src+"\" />"
;
obj.document.write("</body>"
;
obj.document.write("</html>"
;
}
// массив для хранения текущих рейтингов звезд
var curr_rate = new Array();
// функция работы со звездами рейтинга
function set_rate(id, new_rate)
{
// устанавливаем атрибуты
curr_star = document.getElementById(id);
parent_id = parseInt(curr_star.parentNode.id);
// при первом пересчете ставим рейтинг для группы звезд в 0
if (!curr_rate[parent_id])
{
curr_rate[parent_id] = 0;
}
// устанавливаем новый рейтинг в массив рейтингов и значение скрытого поля
if (new_rate != curr_rate[parent_id] && parseInt(new_rate) > 0)
{
curr_rate[parent_id] = new_rate;
curr_form = document.getElementById('comment_form_0' + (parent_id != 0 ? parent_id : ''
);
curr_form.shop_comment_grade.value = curr_rate[parent_id].charAt(curr_rate[parent_id].length - 1);
}
// пересчет стилей для звезд
for (i = 1; i < 6; i++)
{
if (parent_id != 0)
{
j = parent_id + '' + i + '_star_' + i;
}
else
{
j = i + '_star_' + i;
}
temp_obj = document.getElementById(j);
if (new_rate == 0)
{
id = curr_rate[parent_id];
}
if (parseInt(j) > parseInt(id))
{
temp_obj.className = '';
}
else
{
temp_obj.className = 'curr';
}
}
}
]]>
</xsl:text>
</xsl:comment>
</SCRIPT>
<h1>
<xsl:value-of disable-output-escaping="yes" select="name"/>
</h1>
<!-- Получаем ID родительской группы и записываем в переменную $parent_group_id -->
<xsl:variable name="parent_group_id" select="/shop/@current_group_id"/>
<p style="line-height: 1.5;">
<xsl:if test="$parent_group_id = 0">
<a href="{/shop/path}">
<xsl:value-of disable-output-escaping="yes" select="/shop/name"/>
</a>
</xsl:if>
<!-- Путь к группе -->
<xsl:apply-templates select="//group[@id=$parent_group_id]" mode="goup_path"/>
<!-- Если модификация, выводим в пути родительский товар -->
<xsl:if test="/shop/parent_item/node()">
<span class="path_arrow">→</span>
<a href="{/shop/path}{/shop/parent_item/item/fullpath}{/shop/parent_item/item/path}/">
<xsl:value-of disable-output-escaping="yes" select="/shop/parent_item/item/name"/>
</a>
</xsl:if>
<span class="path_arrow">→</span>
<b>
<a href="{/path}">
<xsl:value-of disable-output-escaping="yes" select="name"/>
</a>
</b>
</p>
<!-- Средняя оценка товара -->
<xsl:if test="comments/average_grade/node()">
<div style="float: left; margin: 20px 0px 0px 20px">
<xsl:call-template name="show_average_grade">
<xsl:with-param name="grade" select="comments/average_grade"/>
<xsl:with-param name="const_grade" select="5"/>
</xsl:call-template>
</div>
<div style="clear: both"></div>
</xsl:if>
<!-- Информация об ошибках -->
<xsl:variable name="error_code" select="/shop/error"/>
<xsl:if test="$error_code != 0">
<div id="error">
<b>Внимание!</b>Неправильно введен код подтвержения!</div>
</xsl:if>
<xsl:if test="not(/shop/error/node()) and /shop/comment_is_active/node()">
<!-- Информация о выполненном действии -->
<div id="message">
<xsl:choose>
<xsl:when test="/shop/comment_is_active = '0'">Комментарий успешно добавлен и будет опубликован после проверки модератором!</xsl:when>
<xsl:otherwise>Комментарий успешно добавлен и опубликован!</xsl:otherwise>
</xsl:choose>
</div>
</xsl:if>
<div style="margin-top: 20px;">
<!-- Изображение для товара, если есть -->
<xsl:if test="small_image != ''">
<div class="gallery" style="float: left; width: 350px; margin: 0px 10px 10px 0px;">
<a href="{image}" target="_blank">
<img src="{image}" class="image" width="350"/>
</a>
</div>
</xsl:if>
<!-- Цена товара -->
<p>Цена:
<span style="font-size: 11pt; font-weight: bold">
<xsl:choose>
<xsl:when test="price_discount != 0">
<xsl:value-of select="format-number(price_discount, '### ##0,00', 'my'
"/> <xsl:value-of select="currency" disable-output-escaping="yes"/>
</xsl:when>
<xsl:otherwise>договорная</xsl:otherwise>
</xsl:choose>
</span>
<br/>
<!-- Если цена со скидкой - выводим ее -->
<xsl:if test="price_tax != price_discount">
<span style="color: gray; text-decoration: line-through;">
<xsl:variable name="price_tax" select="price_tax"/>
<span style="font-size: 11pt">
<xsl:value-of select="format-number($price_tax, '### ##0,00', 'my'
"/> <xsl:value-of disable-output-escaping="yes" select="currency"/></span>
</span>
<br/>
</xsl:if>
</p>
<!-- Размер обуви-->
<xsl:if test="modifications/item/property[@xml_name='razmer_obuvi']/node()">
Размер: <select name="property133" id="property133">
<xsl:apply-templates select="modifications/item/property[@xml_name='razmer_obuvi' and generate-id(.)=generate-id(key('property133', value))]"/>
</select>
</xsl:if>
<!-- Размер одежды-->
<xsl:if test="modifications/item/property[@xml_name='razm_odez']/node()">
Размер: <select name="property134" id="property134">
<xsl:apply-templates select="modifications/item/property[@xml_name='razm_odez' and generate-id(.)=generate-id(key('property134', value))]"/>
</select>
</xsl:if>
<!-- Размер колготок-->
<xsl:if test="modifications/item/property[@xml_name='razm_kolg']/node()">
Размер: <select name="property135" id="property135">
<xsl:apply-templates select="modifications/item/property[@xml_name='razm_kolg' and generate-id(.)=generate-id(key('property135', value))]"/>
</select>
</xsl:if>
<!-- Размер носков-->
<xsl:if test="modifications/item/property[@xml_name='razm_nosk']/node()">
Размер: <select name="property136" id="property136">
<xsl:apply-templates select="modifications/item/property[@xml_name='razm_nosk' and generate-id(.)=generate-id(key('property136', value))]"/>
</select>
</xsl:if>
<!-- Ссылку на добавление в корзины выводим, если:
type != 1 - простой тип товара или делимый (0 - простой, 2 - делимый)
type = 1 - электронный товар, при этом остаток на складе больше 0 или -1,
что означает неограниченное количество -->
<xsl:if test="type != 1 or (type = 1 and (eitem_count > 0 or eitem_count = -1))">
<p>
<!--<input type="text" size="3" value="1" id="count_{@id}"/>
<img src="/images/map_intocart.gif" width="12" height="21" border="0" usemap="#mapInToCart{@id}" style="margin: 0 0 -6px 1px;"/>
<map name="mapInToCart{@id}" id="mapInToCart{@id}">
<area shape="rect" coords="0,0,12,10" onclick="set_count_mod('count_{@id}', 1);" nohref="nohref" />
<area shape="rect" coords="0,11,12,21" onclick="set_count_mod('count_{@id}', -1);" nohref="nohref" />
</map>-->
<a href="{/shop/path}cart/?action=add&item_id={@id}" onclick="return AddIntoCart('{/shop/path}', {@id}, document.getElementById('count_{@id}'
.value + '&property133=' + GetSelectValue('property133'
+ '&property134=' + GetSelectValue('property134'
+ '&property135=' + GetSelectValue('property135'
+ '&property136=' + GetSelectValue('property136'
)"><img alt="В корзину" title="В корзину" src="/images/korz.png" style="margin: 0px" /></a>
</p>
</xsl:if>
<xsl:if test="marking_of_goods != ''">
<p>Артикул: <b><xsl:value-of disable-output-escaping="yes" select="marking_of_goods"/></b></p>
</xsl:if>
<xsl:if test="producer/shop_producers_list_name != ''">
<p>Производитель: <b><xsl:value-of disable-output-escaping="yes" select="producer/shop_producers_list_name"/></b></p>
</xsl:if>
<!-- Если указан вес товара -->
<xsl:if test="weight != 0">
<p>Вес товара: <xsl:value-of select="weight"/> <xsl:value-of select="weight_mesure"/></p>
</xsl:if>
<!-- Показываем скидки -->
<xsl:if test="count(discount) > 0">
<xsl:apply-templates select="discount"/>
</xsl:if>
<!-- Показываем количество на складе, если больше нуля -->
<xsl:if test="rest > 0">
<p>В наличии: <xsl:value-of disable-output-escaping="yes" select="rest"/> <xsl:value-of disable-output-escaping="yes" select="mesure"/></p>
</xsl:if>
<!-- Описание товара -->
<xsl:value-of disable-output-escaping="yes" select="description" />
<!-- Если электронный товар, выведим доступное количество -->
<xsl:if test="type = 1">
<p>
<strong>
<xsl:choose>
<xsl:when test="eitem_count = 0">
Электронный товар закончился.
</xsl:when>
<xsl:when test="eitem_count = -1">
Электронный товар доступен для заказа.
</xsl:when>
<xsl:otherwise>
На складе осталось: <xsl:value-of select="eitem_count" /><xsl:text> </xsl:text><xsl:value-of select="mesure" />
</xsl:otherwise>
</xsl:choose>
</strong>
</p>
</xsl:if>
<!-- Текст товара -->
<p>
<xsl:value-of disable-output-escaping="yes" select="text"/>
</p>
<div style="clear: both;"></div>
<xsl:if test="count(property) > 0">
<h2>Дополнительные фото</h2>
<!-- Свойства в корневой группе -->
<xsl:if test="count(property[@dir_id = 0])">
<xsl:apply-templates select="property[@dir_id = 0]"/>
</xsl:if>
<!-- Выбираем список групп свойств -->
<xsl:apply-templates select="/shop/properties_items_dir"/>
</xsl:if>
<div style="clear: both;"></div>
</div>
<!-- Тэги для информационного элемента -->
<xsl:if test="count(tags/tag) > 0">
<p>
<img src="/hostcmsfiles/images/tags.gif" align="left" style="margin: 0px 5px -2px 0px"/>
<xsl:apply-templates select="tags/tag"/>
</p>
</xsl:if>
<xsl:if test="count(tying/item) > 0">
<p>
<b>Сопутствующие товары:</b>
</p>
<!-- Отображаем сопутствующие товары -->
<xsl:apply-templates select="tying/item"/>
<div style="clear: both;"></div>
</xsl:if>
<!-- Отзывы о товаре -->
<xsl:if test="count(comments/comment) > 0">
<p class="title">
<a name="comments"></a>Отзывы о товаре</p>
<xsl:apply-templates select="comments/comment" />
</xsl:if>
<div id="ShowAddComment">
<a href="javascript:void(0)" onclick="javascript:cr('AddComment'
">Добавить комментарий</a>
</div>
<div id="AddComment" style="display: none">
<xsl:call-template name="AddCommentForm"></xsl:call-template>
</div>
</xsl:template>
<!-- Шаблон вывода добавления комментария -->
<xsl:template name="AddCommentForm">
<xsl:param name="comment_id" select="0"/>
<div class="comment">
<div class="tl"></div>
<div class="tr"></div>
<div class="bl"></div>
<div class="br"></div>
<!--Отображение формы добавления комментария-->
<form action="{/document/url}" name="comment_form_0{comment_id}" method="post">
<!-- Авторизированным не показываем -->
<xsl:if test="/shop/user_id = 0">
Имя
<br/>
<input type="text" size="70" name="shop_comment_user_name" value="{/shop/shop_comment_user_name}"/>
<p>
E-mail
<br/>
<input id="email{$comment_id}" type="text" size="70" name="shop_comment_user_email" value="{/shop/shop_comment_user_email}" />
<div id="error_email{$comment_id}"></div>
</p>
</xsl:if>
<p>
Тема
<br/>
<input type="text" size="70" name="shop_comment_subject" value="{/shop/shop_comment_subject}"/>
</p>
<p>
Комментарий
<br/>
<textarea name="shop_comment_text" cols="68" rows="5" class="mceEditor"><xsl:value-of select="/shop/shop_comment_text"/></textarea>
</p>
<p>
Оценка
<br/>
<input type="hidden" name="shop_comment_grade" value="0"/>
<xsl:variable name="ul_id">
<xsl:choose>
<xsl:when test="comment_id > 0"><xsl:value-of select="comment_id"/>_stars</xsl:when>
<xsl:otherwise>0_stars</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<ul id="{$ul_id}" class="stars">
<li onclick="set_rate(this.id, this.id)" onmouseover="set_rate(this.id, '-1'
" onmouseout="set_rate(this.id, 0)" id="{comment_id}1_star_1"></li>
<li onclick="set_rate(this.id, this.id)" onmouseover="set_rate(this.id, '-1'
" onmouseout="set_rate(this.id, 0)" id="{comment_id}2_star_2"></li>
<li onclick="set_rate(this.id, this.id)" onmouseover="set_rate(this.id, '-1'
" onmouseout="set_rate(this.id, 0)" id="{comment_id}3_star_3"></li>
<li onclick="set_rate(this.id, this.id)" onmouseover="set_rate(this.id, '-1'
" onmouseout="set_rate(this.id, 0)" id="{comment_id}4_star_4"></li>
<li onclick="set_rate(this.id, this.id)" onmouseover="set_rate(this.id, '-1'
" onmouseout="set_rate(this.id, 0)" id="{comment_id}5_star_5"></li>
</ul>
</p>
<br/>
<!-- Обработка CAPTCHA -->
<xsl:if test="//captcha_key != 0 and /shop/user_id = 0">
<p>Контрольные цифры
<sup>
<font color="red">*</font>
</sup></p>
<div style="float: left">
<img id="comment_{$comment_id}" style="border: 1px solid #000000" src="/captcha.php?get_captcha={captcha_key}{$comment_id}&height=30&width=100" title="Код подтверждения" name="captcha"/>
</div>
<div id="captcha" style="clear:both;">
<img style="border: 0px" src="/hostcmsfiles/images/refresh.gif" /> <a href="javascript:void(0);" onclick="ReNewCaptchaById('comment_{$comment_id}', '{//captcha_key}{$comment_id}', 30); return false;">Показать другое число</a>
</div>
<div style="float: left;margin-top: 5px">
<input type="hidden" name="captcha_key" value="{//captcha_key}{$comment_id}"/>
<input type="text" name="captcha_keystring" size="15"/>
</div>
<div id="captcha" style="clear:both;margin-bottom:10px;">
Введите число, которое указано выше.
</div>
</xsl:if>
<xsl:if test="$comment_id != 0">
<input type="hidden" name="comment_parent_id" value="{comment_id}"/>
</xsl:if>
<p>
<input id="submit_email{$comment_id}" type="submit" name="submit_comment" value="Опубликовать"/>
</p>
</form>
</div>
</xsl:template>
<!-- Вывод раздела для свойств товара -->
<xsl:template match="properties_items_dir">
<xsl:variable name="dir_id" select="@id"/>
<xsl:if test="count(/shop/item/property[@dir_id = $dir_id])">
<!-- Название группы свойств -->
<p><b><xsl:value-of select="shop_properties_items_dir_name"/></b></p>
<table border="0">
<xsl:apply-templates select="/shop/item/property[@dir_id = $dir_id]"/>
</table>
</xsl:if>
<xsl:if test="count(properties_items_dir) > 0">
<blockquote>
<xsl:apply-templates select="properties_items_dir"/>
</blockquote>
</xsl:if>
</xsl:template>
<!-- Вывод строки со значением свойства -->
<xsl:template match="property">
<xsl:if test="value != '' or (type = 1 and file_path != ''
">
<xsl:choose>
<xsl:when test="type = 1">
<div class="gallery" style="float: left; margin: 0px 10px 20px 0px;">
<a href="{file_path}" title="{name}" ><img src="{small_image/file_path}"/></a>
</div>
</xsl:when>
</xsl:choose>
</xsl:if>
</xsl:template>
<!-- /// Метки для информационного элемента /// -->
<xsl:template match="tags/tag">
<a href="{/shop/path}tag/{tag_path_name}/" class="tag">
<xsl:value-of select="tag_name"/>
</a>
<xsl:if test="position() != last()"><xsl:text>, </xsl:text></xsl:if>
</xsl:template>
<!-- Шаблон для модификаций -->
<xsl:template match="modifications/item">
<tr>
<td>
<!-- Название модификации -->
<a href="{/shop/path}{fullpath}{path}/">
<xsl:value-of disable-output-escaping="yes" select="name"/>
</a>
</td>
<td>
<!-- Цена модификации -->
<xsl:value-of disable-output-escaping="yes" select="price_discount"/> 
<!-- Валюта -->
<xsl:value-of disable-output-escaping="yes" select="currency"/>
</td>
</tr>
</xsl:template>
<!-- Вывод рейтинга товара -->
<xsl:template name="show_average_grade">
<xsl:param name="grade" select="0"/>
<xsl:param name="const_grade" select="0"/>
<!-- Чтобы избежать зацикливания -->
<xsl:variable name="current_grade" select="$grade * 1"/>
<xsl:choose>
<!-- Если число целое -->
<xsl:when test="floor($current_grade) = $current_grade and not($const_grade > ceiling($current_grade))">
<xsl:if test="$current_grade - 1 > 0">
<xsl:call-template name="show_average_grade">
<xsl:with-param name="grade" select="$current_grade - 1"/>
<xsl:with-param name="const_grade" select="$const_grade - 1"/>
</xsl:call-template>
</xsl:if>
<xsl:if test="$current_grade != 0">
<img src="/hostcmsfiles/images/stars_single.gif"/>
</xsl:if>
</xsl:when>
<xsl:when test="$current_grade != 0 and not($const_grade > ceiling($current_grade))">
<xsl:if test="$current_grade - 0.5 > 0">
<xsl:call-template name="show_average_grade">
<xsl:with-param name="grade" select="$current_grade - 0.5"/>
<xsl:with-param name="const_grade" select="$const_grade - 1"/>
</xsl:call-template>
</xsl:if>
<img src="/hostcmsfiles/images/stars_half.gif"/>
</xsl:when>
<xsl:otherwise>
<!-- Выводим серые звездочки, пока текущая позиция не дойдет то значения, увеличенного до целого -->
<xsl:call-template name="show_average_grade">
<xsl:with-param name="grade" select="$current_grade"/>
<xsl:with-param name="const_grade" select="$const_grade - 1"/>
</xsl:call-template>
<img src="/hostcmsfiles/images/stars_gray.gif"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- Шаблон для вывода звездочек (оценки) -->
<xsl:template name="for">
<xsl:param name="i" select="0"/>
<xsl:param name="n"/>
<input type="radio" name="shop_comment_grade" value="{$i}" id="id_shop_comment_grade_{$i}">
<xsl:if test="/shop/shop_comment_grade = $i">
<xsl:attribute name="checked">
</xsl:attribute>
</xsl:if>
</input> 
<label for="id_shop_comment_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 > $i and $n > 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="comments/comment">
<a name="comment{@id}"></a>
<div class="comment">
<div class="tl"></div>
<div class="tr"></div>
<div class="bl"></div>
<div class="br"></div>
<xsl:if test="subject != ''">
<div>
<strong>
<xsl:value-of select="subject"/>
</strong>
</div>
</xsl:if>
<xsl:value-of select="text" disable-output-escaping="yes"/>
<!-- Оценка комментария -->
<xsl:if test="grade != 0">
<div>Оценка:
<xsl:call-template name="show_average_grade">
<xsl:with-param name="grade" select="grade"/>
<xsl:with-param name="const_grade" select="5"/>
</xsl:call-template>
</div>
</xsl:if>
</div>
<div class="comment_desc">
<xsl:choose>
<xsl:when test="user_name">
<xsl:value-of select="user_name"/>
</xsl:when>
<xsl:otherwise>
<img src="/hostcmsfiles/images/user.gif" style="margin: 0px 5px -4px 0px" />
<b>
<a href="/users/info/{site_user_login}/" class="c_u_l" ><xsl:value-of select="site_user_login"/></a>
</b>
</xsl:otherwise>
</xsl:choose> · <xsl:value-of select="date_time"/> · <a href="{/shop/path}{/shop/item/fullpath}{/shop/item/path}/#comment{@id}" title="ссылка">#</a>
</div>
</xsl:template>
<!-- Шаблон для скидки -->
<xsl:template match="discount">
<p>
<xsl:value-of disable-output-escaping="yes" select="name"/> <xsl:value-of disable-output-escaping="yes" select="value"/>%
</p>
</xsl:template>
<xsl:template match="tying/item">
<div style="clear: both">
<p>
<a href="{/shop/path}{fullpath}{path}/">
<xsl:value-of select="name"/>
</a>
</p>
<!-- Изображение для товара, если есть -->
<xsl:if test="small_image != ''">
<a href="{/shop/path}{fullpath}{path}/">
<img src="{small_image}" align="left" style="border: 1px solid #000000; margin: 0px 5px 5px 0px"/>
</a>
</xsl:if>
<p>
<xsl:value-of disable-output-escaping="yes" select="description"/>
</p>
<!-- Цена товара -->
<strong>
<xsl:choose>
<xsl:when test="price_discount != 0">
<xsl:value-of disable-output-escaping="yes" select="price_discount"/> 
<!-- Валюта товара -->
<xsl:value-of disable-output-escaping="yes" select="currency"/>
</xsl:when>
<xsl:otherwise>договорная</xsl:otherwise>
</xsl:choose>
</strong>
<!-- Если цена со скидкой - выводим ее -->
<xsl:if test="price_tax != price_discount">
<br/>
<font color="gray">
<strike>
<xsl:value-of disable-output-escaping="yes" select="price_tax"/> <xsl:value-of disable-output-escaping="yes" select="currency"/></strike>
</font>
</xsl:if>
<!-- Если указан вес товара -->
<xsl:if test="weight != 0">
<br/>Вес товара: <xsl:value-of select="weight"/> <xsl:value-of select="weight_mesure"/></xsl:if>
<!-- Показываем скидки -->
<xsl:if test="count(discount) > 0">
<xsl:apply-templates select="discount"/>
</xsl:if>
<!-- Показываем количество на складе, если больше нуля -->
<xsl:if test="rest > 0">
<br/>В наличии: <xsl:value-of disable-output-escaping="yes" select="rest"/></xsl:if>
<xsl:if test="producer/shop_producers_list_name != ''">
<br/>Производитель: <xsl:value-of disable-output-escaping="yes" select="producer/shop_producers_list_name"/></xsl:if>
</div>
</xsl:template>
<!-- Шаблон выводит хлебные крошки -->
<xsl:template match="group" mode="goup_path">
<xsl:variable name="parent_id" select="@parent"/>
<!-- Выбираем рекурсивно вышестоящую группу -->
<xsl:apply-templates select="//group[@id=$parent_id]" mode="goup_path"/>
<xsl:if test="@parent=0">
<a href="{/shop/path}">
<xsl:value-of select="/shop/name"/>
</a>
</xsl:if>
<span class="path_arrow">→</span>
<a href="{/shop/path}{fullpath}">
<xsl:value-of select="name"/>
</a>
</xsl:template>
<!-- для размеров -->
<xsl:template match="modifications/item/property[@xml_name='razmer_obuvi']">
<xsl:variable name="value" select="value" />
<option value="{/shop/properties_for_group/property[@xml_name='razmer_obuvi']/list_items/list_item[list_item_value=$value]/@id}" ><xsl:value-of select="value"/></option>
</xsl:template>
<xsl:template match="modifications/item/property[@xml_name='razm_odez']">
<xsl:variable name="value" select="value" />
<option value="{/shop/properties_for_group/property[@xml_name='razm_odez']/list_items/list_item[list_item_value=$value]/@id}" ><xsl:value-of select="value"/></option>
</xsl:template>
<xsl:template match="modifications/item/property[@xml_name='razm_kolg']">
<xsl:variable name="value" select="value" />
<option value="{/shop/properties_for_group/property[@xml_name='razm_kolg']/list_items/list_item[list_item_value=$value]/@id}" ><xsl:value-of select="value"/></option>
</xsl:template>
<xsl:template match="modifications/item/property[@xml_name='razm_nosk']">
<xsl:variable name="value" select="value" />
<option value="{/shop/properties_for_group/property[@xml_name='razm_nosk']/list_items/list_item[list_item_value=$value]/@id}" ><xsl:value-of select="value"/></option>
</xsl:template>
</xsl:stylesheet>
<!DOCTYPE xsl:stylesheet>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<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
ecimal-format name="my" decimal-separator="," grouping-separator=" "/><xsl:key name="property133" match="/shop/item/modifications/item/property[@xml_name='razmer_obuvi']" use="value"/>
<xsl:key name="property134" match="/shop/item/modifications/item/property[@xml_name='razm_odez']" use="value"/>
<xsl:key name="property135" match="/shop/item/modifications/item/property[@xml_name='razm_kolg']" use="value"/>
<xsl:key name="property136" match="/shop/item/modifications/item/property[@xml_name='razm_nosk']" use="value"/>
<xsl:template match="/shop">
<xsl:apply-templates select="item"/>
</xsl:template>
<xsl:template match="item">
<SCRIPT>
<xsl:comment>
<xsl:text disable-output-escaping="yes">
<![CDATA[
function GetSelectValue(selectName)
{
value=document.getElementById(selectName).value;
return value;
}
function ShowImgWindow(title, src, width, height)
{
obj = window.open("", "", "scrollbars=0,dialog=0,minimizable=1,modal=1,width="+width+",height="+height+",resizable=0"
;obj.document.write("<html>"
;obj.document.write("<head>"
;obj.document.write("<title>"+title+"</title>"
;obj.document.write("</head>"
;obj.document.write("<body topmargin=0 leftmargin=0 marginwidth=0 marginheight=0>"
;obj.document.write("<img src=\""+src+"\" />"
;obj.document.write("</body>"
;obj.document.write("</html>"
;}
// массив для хранения текущих рейтингов звезд
var curr_rate = new Array();
// функция работы со звездами рейтинга
function set_rate(id, new_rate)
{
// устанавливаем атрибуты
curr_star = document.getElementById(id);
parent_id = parseInt(curr_star.parentNode.id);
// при первом пересчете ставим рейтинг для группы звезд в 0
if (!curr_rate[parent_id])
{
curr_rate[parent_id] = 0;
}
// устанавливаем новый рейтинг в массив рейтингов и значение скрытого поля
if (new_rate != curr_rate[parent_id] && parseInt(new_rate) > 0)
{
curr_rate[parent_id] = new_rate;
curr_form = document.getElementById('comment_form_0' + (parent_id != 0 ? parent_id : ''
);curr_form.shop_comment_grade.value = curr_rate[parent_id].charAt(curr_rate[parent_id].length - 1);
}
// пересчет стилей для звезд
for (i = 1; i < 6; i++)
{
if (parent_id != 0)
{
j = parent_id + '' + i + '_star_' + i;
}
else
{
j = i + '_star_' + i;
}
temp_obj = document.getElementById(j);
if (new_rate == 0)
{
id = curr_rate[parent_id];
}
if (parseInt(j) > parseInt(id))
{
temp_obj.className = '';
}
else
{
temp_obj.className = 'curr';
}
}
}
]]>
</xsl:text>
</xsl:comment>
</SCRIPT>
<h1>
<xsl:value-of disable-output-escaping="yes" select="name"/>
</h1>
<!-- Получаем ID родительской группы и записываем в переменную $parent_group_id -->
<xsl:variable name="parent_group_id" select="/shop/@current_group_id"/>
<p style="line-height: 1.5;">
<xsl:if test="$parent_group_id = 0">
<a href="{/shop/path}">
<xsl:value-of disable-output-escaping="yes" select="/shop/name"/>
</a>
</xsl:if>
<!-- Путь к группе -->
<xsl:apply-templates select="//group[@id=$parent_group_id]" mode="goup_path"/>
<!-- Если модификация, выводим в пути родительский товар -->
<xsl:if test="/shop/parent_item/node()">
<span class="path_arrow">→</span>
<a href="{/shop/path}{/shop/parent_item/item/fullpath}{/shop/parent_item/item/path}/">
<xsl:value-of disable-output-escaping="yes" select="/shop/parent_item/item/name"/>
</a>
</xsl:if>
<span class="path_arrow">→</span>
<b>
<a href="{/path}">
<xsl:value-of disable-output-escaping="yes" select="name"/>
</a>
</b>
</p>
<!-- Средняя оценка товара -->
<xsl:if test="comments/average_grade/node()">
<div style="float: left; margin: 20px 0px 0px 20px">
<xsl:call-template name="show_average_grade">
<xsl:with-param name="grade" select="comments/average_grade"/>
<xsl:with-param name="const_grade" select="5"/>
</xsl:call-template>
</div>
<div style="clear: both"></div>
</xsl:if>
<!-- Информация об ошибках -->
<xsl:variable name="error_code" select="/shop/error"/>
<xsl:if test="$error_code != 0">
<div id="error">
<b>Внимание!</b>Неправильно введен код подтвержения!</div>
</xsl:if>
<xsl:if test="not(/shop/error/node()) and /shop/comment_is_active/node()">
<!-- Информация о выполненном действии -->
<div id="message">
<xsl:choose>
<xsl:when test="/shop/comment_is_active = '0'">Комментарий успешно добавлен и будет опубликован после проверки модератором!</xsl:when>
<xsl:otherwise>Комментарий успешно добавлен и опубликован!</xsl:otherwise>
</xsl:choose>
</div>
</xsl:if>
<div style="margin-top: 20px;">
<!-- Изображение для товара, если есть -->
<xsl:if test="small_image != ''">
<div class="gallery" style="float: left; width: 350px; margin: 0px 10px 10px 0px;">
<a href="{image}" target="_blank">
<img src="{image}" class="image" width="350"/>
</a>
</div>
</xsl:if>
<!-- Цена товара -->
<p>Цена:
<span style="font-size: 11pt; font-weight: bold">
<xsl:choose>
<xsl:when test="price_discount != 0">
<xsl:value-of select="format-number(price_discount, '### ##0,00', 'my'
"/> <xsl:value-of select="currency" disable-output-escaping="yes"/></xsl:when>
<xsl:otherwise>договорная</xsl:otherwise>
</xsl:choose>
</span>
<br/>
<!-- Если цена со скидкой - выводим ее -->
<xsl:if test="price_tax != price_discount">
<span style="color: gray; text-decoration: line-through;">
<xsl:variable name="price_tax" select="price_tax"/>
<span style="font-size: 11pt">
<xsl:value-of select="format-number($price_tax, '### ##0,00', 'my'
"/> <xsl:value-of disable-output-escaping="yes" select="currency"/></span></span>
<br/>
</xsl:if>
</p>
<!-- Размер обуви-->
<xsl:if test="modifications/item/property[@xml_name='razmer_obuvi']/node()">
Размер: <select name="property133" id="property133">
<xsl:apply-templates select="modifications/item/property[@xml_name='razmer_obuvi' and generate-id(.)=generate-id(key('property133', value))]"/>
</select>
</xsl:if>
<!-- Размер одежды-->
<xsl:if test="modifications/item/property[@xml_name='razm_odez']/node()">
Размер: <select name="property134" id="property134">
<xsl:apply-templates select="modifications/item/property[@xml_name='razm_odez' and generate-id(.)=generate-id(key('property134', value))]"/>
</select>
</xsl:if>
<!-- Размер колготок-->
<xsl:if test="modifications/item/property[@xml_name='razm_kolg']/node()">
Размер: <select name="property135" id="property135">
<xsl:apply-templates select="modifications/item/property[@xml_name='razm_kolg' and generate-id(.)=generate-id(key('property135', value))]"/>
</select>
</xsl:if>
<!-- Размер носков-->
<xsl:if test="modifications/item/property[@xml_name='razm_nosk']/node()">
Размер: <select name="property136" id="property136">
<xsl:apply-templates select="modifications/item/property[@xml_name='razm_nosk' and generate-id(.)=generate-id(key('property136', value))]"/>
</select>
</xsl:if>
<!-- Ссылку на добавление в корзины выводим, если:
type != 1 - простой тип товара или делимый (0 - простой, 2 - делимый)
type = 1 - электронный товар, при этом остаток на складе больше 0 или -1,
что означает неограниченное количество -->
<xsl:if test="type != 1 or (type = 1 and (eitem_count > 0 or eitem_count = -1))">
<p>
<!--<input type="text" size="3" value="1" id="count_{@id}"/>
<img src="/images/map_intocart.gif" width="12" height="21" border="0" usemap="#mapInToCart{@id}" style="margin: 0 0 -6px 1px;"/>
<map name="mapInToCart{@id}" id="mapInToCart{@id}">
<area shape="rect" coords="0,0,12,10" onclick="set_count_mod('count_{@id}', 1);" nohref="nohref" />
<area shape="rect" coords="0,11,12,21" onclick="set_count_mod('count_{@id}', -1);" nohref="nohref" />
</map>-->
<a href="{/shop/path}cart/?action=add&item_id={@id}" onclick="return AddIntoCart('{/shop/path}', {@id}, document.getElementById('count_{@id}'
.value + '&property133=' + GetSelectValue('property133'
+ '&property134=' + GetSelectValue('property134'
+ '&property135=' + GetSelectValue('property135'
+ '&property136=' + GetSelectValue('property136'
)"><img alt="В корзину" title="В корзину" src="/images/korz.png" style="margin: 0px" /></a></p>
</xsl:if>
<xsl:if test="marking_of_goods != ''">
<p>Артикул: <b><xsl:value-of disable-output-escaping="yes" select="marking_of_goods"/></b></p>
</xsl:if>
<xsl:if test="producer/shop_producers_list_name != ''">
<p>Производитель: <b><xsl:value-of disable-output-escaping="yes" select="producer/shop_producers_list_name"/></b></p>
</xsl:if>
<!-- Если указан вес товара -->
<xsl:if test="weight != 0">
<p>Вес товара: <xsl:value-of select="weight"/> <xsl:value-of select="weight_mesure"/></p>
</xsl:if>
<!-- Показываем скидки -->
<xsl:if test="count(discount) > 0">
<xsl:apply-templates select="discount"/>
</xsl:if>
<!-- Показываем количество на складе, если больше нуля -->
<xsl:if test="rest > 0">
<p>В наличии: <xsl:value-of disable-output-escaping="yes" select="rest"/> <xsl:value-of disable-output-escaping="yes" select="mesure"/></p>
</xsl:if>
<!-- Описание товара -->
<xsl:value-of disable-output-escaping="yes" select="description" />
<!-- Если электронный товар, выведим доступное количество -->
<xsl:if test="type = 1">
<p>
<strong>
<xsl:choose>
<xsl:when test="eitem_count = 0">
Электронный товар закончился.
</xsl:when>
<xsl:when test="eitem_count = -1">
Электронный товар доступен для заказа.
</xsl:when>
<xsl:otherwise>
На складе осталось: <xsl:value-of select="eitem_count" /><xsl:text> </xsl:text><xsl:value-of select="mesure" />
</xsl:otherwise>
</xsl:choose>
</strong>
</p>
</xsl:if>
<!-- Текст товара -->
<p>
<xsl:value-of disable-output-escaping="yes" select="text"/>
</p>
<div style="clear: both;"></div>
<xsl:if test="count(property) > 0">
<h2>Дополнительные фото</h2>
<!-- Свойства в корневой группе -->
<xsl:if test="count(property[@dir_id = 0])">
<xsl:apply-templates select="property[@dir_id = 0]"/>
</xsl:if>
<!-- Выбираем список групп свойств -->
<xsl:apply-templates select="/shop/properties_items_dir"/>
</xsl:if>
<div style="clear: both;"></div>
</div>
<!-- Тэги для информационного элемента -->
<xsl:if test="count(tags/tag) > 0">
<p>
<img src="/hostcmsfiles/images/tags.gif" align="left" style="margin: 0px 5px -2px 0px"/>
<xsl:apply-templates select="tags/tag"/>
</p>
</xsl:if>
<xsl:if test="count(tying/item) > 0">
<p>
<b>Сопутствующие товары:</b>
</p>
<!-- Отображаем сопутствующие товары -->
<xsl:apply-templates select="tying/item"/>
<div style="clear: both;"></div>
</xsl:if>
<!-- Отзывы о товаре -->
<xsl:if test="count(comments/comment) > 0">
<p class="title">
<a name="comments"></a>Отзывы о товаре</p>
<xsl:apply-templates select="comments/comment" />
</xsl:if>
<div id="ShowAddComment">
<a href="javascript:void(0)" onclick="javascript:cr('AddComment'
">Добавить комментарий</a></div>
<div id="AddComment" style="display: none">
<xsl:call-template name="AddCommentForm"></xsl:call-template>
</div>
</xsl:template>
<!-- Шаблон вывода добавления комментария -->
<xsl:template name="AddCommentForm">
<xsl:param name="comment_id" select="0"/>
<div class="comment">
<div class="tl"></div>
<div class="tr"></div>
<div class="bl"></div>
<div class="br"></div>
<!--Отображение формы добавления комментария-->
<form action="{/document/url}" name="comment_form_0{comment_id}" method="post">
<!-- Авторизированным не показываем -->
<xsl:if test="/shop/user_id = 0">
Имя
<br/>
<input type="text" size="70" name="shop_comment_user_name" value="{/shop/shop_comment_user_name}"/>
<p>
<br/>
<input id="email{$comment_id}" type="text" size="70" name="shop_comment_user_email" value="{/shop/shop_comment_user_email}" />
<div id="error_email{$comment_id}"></div>
</p>
</xsl:if>
<p>
Тема
<br/>
<input type="text" size="70" name="shop_comment_subject" value="{/shop/shop_comment_subject}"/>
</p>
<p>
Комментарий
<br/>
<textarea name="shop_comment_text" cols="68" rows="5" class="mceEditor"><xsl:value-of select="/shop/shop_comment_text"/></textarea>
</p>
<p>
Оценка
<br/>
<input type="hidden" name="shop_comment_grade" value="0"/>
<xsl:variable name="ul_id">
<xsl:choose>
<xsl:when test="comment_id > 0"><xsl:value-of select="comment_id"/>_stars</xsl:when>
<xsl:otherwise>0_stars</xsl:otherwise>
</xsl:choose>
</xsl:variable>
<ul id="{$ul_id}" class="stars">
<li onclick="set_rate(this.id, this.id)" onmouseover="set_rate(this.id, '-1'
" onmouseout="set_rate(this.id, 0)" id="{comment_id}1_star_1"></li><li onclick="set_rate(this.id, this.id)" onmouseover="set_rate(this.id, '-1'
" onmouseout="set_rate(this.id, 0)" id="{comment_id}2_star_2"></li><li onclick="set_rate(this.id, this.id)" onmouseover="set_rate(this.id, '-1'
" onmouseout="set_rate(this.id, 0)" id="{comment_id}3_star_3"></li><li onclick="set_rate(this.id, this.id)" onmouseover="set_rate(this.id, '-1'
" onmouseout="set_rate(this.id, 0)" id="{comment_id}4_star_4"></li><li onclick="set_rate(this.id, this.id)" onmouseover="set_rate(this.id, '-1'
" onmouseout="set_rate(this.id, 0)" id="{comment_id}5_star_5"></li></ul>
</p>
<br/>
<!-- Обработка CAPTCHA -->
<xsl:if test="//captcha_key != 0 and /shop/user_id = 0">
<p>Контрольные цифры
<sup>
<font color="red">*</font>
</sup></p>
<div style="float: left">
<img id="comment_{$comment_id}" style="border: 1px solid #000000" src="/captcha.php?get_captcha={captcha_key}{$comment_id}&height=30&width=100" title="Код подтверждения" name="captcha"/>
</div>
<div id="captcha" style="clear:both;">
<img style="border: 0px" src="/hostcmsfiles/images/refresh.gif" /> <a href="javascript:void(0);" onclick="ReNewCaptchaById('comment_{$comment_id}', '{//captcha_key}{$comment_id}', 30); return false;">Показать другое число</a>
</div>
<div style="float: left;margin-top: 5px">
<input type="hidden" name="captcha_key" value="{//captcha_key}{$comment_id}"/>
<input type="text" name="captcha_keystring" size="15"/>
</div>
<div id="captcha" style="clear:both;margin-bottom:10px;">
Введите число, которое указано выше.
</div>
</xsl:if>
<xsl:if test="$comment_id != 0">
<input type="hidden" name="comment_parent_id" value="{comment_id}"/>
</xsl:if>
<p>
<input id="submit_email{$comment_id}" type="submit" name="submit_comment" value="Опубликовать"/>
</p>
</form>
</div>
</xsl:template>
<!-- Вывод раздела для свойств товара -->
<xsl:template match="properties_items_dir">
<xsl:variable name="dir_id" select="@id"/>
<xsl:if test="count(/shop/item/property[@dir_id = $dir_id])">
<!-- Название группы свойств -->
<p><b><xsl:value-of select="shop_properties_items_dir_name"/></b></p>
<table border="0">
<xsl:apply-templates select="/shop/item/property[@dir_id = $dir_id]"/>
</table>
</xsl:if>
<xsl:if test="count(properties_items_dir) > 0">
<blockquote>
<xsl:apply-templates select="properties_items_dir"/>
</blockquote>
</xsl:if>
</xsl:template>
<!-- Вывод строки со значением свойства -->
<xsl:template match="property">
<xsl:if test="value != '' or (type = 1 and file_path != ''
"><xsl:choose>
<xsl:when test="type = 1">
<div class="gallery" style="float: left; margin: 0px 10px 20px 0px;">
<a href="{file_path}" title="{name}" ><img src="{small_image/file_path}"/></a>
</div>
</xsl:when>
</xsl:choose>
</xsl:if>
</xsl:template>
<!-- /// Метки для информационного элемента /// -->
<xsl:template match="tags/tag">
<a href="{/shop/path}tag/{tag_path_name}/" class="tag">
<xsl:value-of select="tag_name"/>
</a>
<xsl:if test="position() != last()"><xsl:text>, </xsl:text></xsl:if>
</xsl:template>
<!-- Шаблон для модификаций -->
<xsl:template match="modifications/item">
<tr>
<td>
<!-- Название модификации -->
<a href="{/shop/path}{fullpath}{path}/">
<xsl:value-of disable-output-escaping="yes" select="name"/>
</a>
</td>
<td>
<!-- Цена модификации -->
<xsl:value-of disable-output-escaping="yes" select="price_discount"/> 
<!-- Валюта -->
<xsl:value-of disable-output-escaping="yes" select="currency"/>
</td>
</tr>
</xsl:template>
<!-- Вывод рейтинга товара -->
<xsl:template name="show_average_grade">
<xsl:param name="grade" select="0"/>
<xsl:param name="const_grade" select="0"/>
<!-- Чтобы избежать зацикливания -->
<xsl:variable name="current_grade" select="$grade * 1"/>
<xsl:choose>
<!-- Если число целое -->
<xsl:when test="floor($current_grade) = $current_grade and not($const_grade > ceiling($current_grade))">
<xsl:if test="$current_grade - 1 > 0">
<xsl:call-template name="show_average_grade">
<xsl:with-param name="grade" select="$current_grade - 1"/>
<xsl:with-param name="const_grade" select="$const_grade - 1"/>
</xsl:call-template>
</xsl:if>
<xsl:if test="$current_grade != 0">
<img src="/hostcmsfiles/images/stars_single.gif"/>
</xsl:if>
</xsl:when>
<xsl:when test="$current_grade != 0 and not($const_grade > ceiling($current_grade))">
<xsl:if test="$current_grade - 0.5 > 0">
<xsl:call-template name="show_average_grade">
<xsl:with-param name="grade" select="$current_grade - 0.5"/>
<xsl:with-param name="const_grade" select="$const_grade - 1"/>
</xsl:call-template>
</xsl:if>
<img src="/hostcmsfiles/images/stars_half.gif"/>
</xsl:when>
<xsl:otherwise>
<!-- Выводим серые звездочки, пока текущая позиция не дойдет то значения, увеличенного до целого -->
<xsl:call-template name="show_average_grade">
<xsl:with-param name="grade" select="$current_grade"/>
<xsl:with-param name="const_grade" select="$const_grade - 1"/>
</xsl:call-template>
<img src="/hostcmsfiles/images/stars_gray.gif"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!-- Шаблон для вывода звездочек (оценки) -->
<xsl:template name="for">
<xsl:param name="i" select="0"/>
<xsl:param name="n"/>
<input type="radio" name="shop_comment_grade" value="{$i}" id="id_shop_comment_grade_{$i}">
<xsl:if test="/shop/shop_comment_grade = $i">
<xsl:attribute name="checked">
</xsl:attribute>
</xsl:if>
</input> 
<label for="id_shop_comment_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 > $i and $n > 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="comments/comment">
<a name="comment{@id}"></a>
<div class="comment">
<div class="tl"></div>
<div class="tr"></div>
<div class="bl"></div>
<div class="br"></div>
<xsl:if test="subject != ''">
<div>
<strong>
<xsl:value-of select="subject"/>
</strong>
</div>
</xsl:if>
<xsl:value-of select="text" disable-output-escaping="yes"/>
<!-- Оценка комментария -->
<xsl:if test="grade != 0">
<div>Оценка:
<xsl:call-template name="show_average_grade">
<xsl:with-param name="grade" select="grade"/>
<xsl:with-param name="const_grade" select="5"/>
</xsl:call-template>
</div>
</xsl:if>
</div>
<div class="comment_desc">
<xsl:choose>
<xsl:when test="user_name">
<xsl:value-of select="user_name"/>
</xsl:when>
<xsl:otherwise>
<img src="/hostcmsfiles/images/user.gif" style="margin: 0px 5px -4px 0px" />
<b>
<a href="/users/info/{site_user_login}/" class="c_u_l" ><xsl:value-of select="site_user_login"/></a>
</b>
</xsl:otherwise>
</xsl:choose> · <xsl:value-of select="date_time"/> · <a href="{/shop/path}{/shop/item/fullpath}{/shop/item/path}/#comment{@id}" title="ссылка">#</a>
</div>
</xsl:template>
<!-- Шаблон для скидки -->
<xsl:template match="discount">
<p>
<xsl:value-of disable-output-escaping="yes" select="name"/> <xsl:value-of disable-output-escaping="yes" select="value"/>%
</p>
</xsl:template>
<xsl:template match="tying/item">
<div style="clear: both">
<p>
<a href="{/shop/path}{fullpath}{path}/">
<xsl:value-of select="name"/>
</a>
</p>
<!-- Изображение для товара, если есть -->
<xsl:if test="small_image != ''">
<a href="{/shop/path}{fullpath}{path}/">
<img src="{small_image}" align="left" style="border: 1px solid #000000; margin: 0px 5px 5px 0px"/>
</a>
</xsl:if>
<p>
<xsl:value-of disable-output-escaping="yes" select="description"/>
</p>
<!-- Цена товара -->
<strong>
<xsl:choose>
<xsl:when test="price_discount != 0">
<xsl:value-of disable-output-escaping="yes" select="price_discount"/> 
<!-- Валюта товара -->
<xsl:value-of disable-output-escaping="yes" select="currency"/>
</xsl:when>
<xsl:otherwise>договорная</xsl:otherwise>
</xsl:choose>
</strong>
<!-- Если цена со скидкой - выводим ее -->
<xsl:if test="price_tax != price_discount">
<br/>
<font color="gray">
<strike>
<xsl:value-of disable-output-escaping="yes" select="price_tax"/> <xsl:value-of disable-output-escaping="yes" select="currency"/></strike>
</font>
</xsl:if>
<!-- Если указан вес товара -->
<xsl:if test="weight != 0">
<br/>Вес товара: <xsl:value-of select="weight"/> <xsl:value-of select="weight_mesure"/></xsl:if>
<!-- Показываем скидки -->
<xsl:if test="count(discount) > 0">
<xsl:apply-templates select="discount"/>
</xsl:if>
<!-- Показываем количество на складе, если больше нуля -->
<xsl:if test="rest > 0">
<br/>В наличии: <xsl:value-of disable-output-escaping="yes" select="rest"/></xsl:if>
<xsl:if test="producer/shop_producers_list_name != ''">
<br/>Производитель: <xsl:value-of disable-output-escaping="yes" select="producer/shop_producers_list_name"/></xsl:if>
</div>
</xsl:template>
<!-- Шаблон выводит хлебные крошки -->
<xsl:template match="group" mode="goup_path">
<xsl:variable name="parent_id" select="@parent"/>
<!-- Выбираем рекурсивно вышестоящую группу -->
<xsl:apply-templates select="//group[@id=$parent_id]" mode="goup_path"/>
<xsl:if test="@parent=0">
<a href="{/shop/path}">
<xsl:value-of select="/shop/name"/>
</a>
</xsl:if>
<span class="path_arrow">→</span>
<a href="{/shop/path}{fullpath}">
<xsl:value-of select="name"/>
</a>
</xsl:template>
<!-- для размеров -->
<xsl:template match="modifications/item/property[@xml_name='razmer_obuvi']">
<xsl:variable name="value" select="value" />
<option value="{/shop/properties_for_group/property[@xml_name='razmer_obuvi']/list_items/list_item[list_item_value=$value]/@id}" ><xsl:value-of select="value"/></option>
</xsl:template>
<xsl:template match="modifications/item/property[@xml_name='razm_odez']">
<xsl:variable name="value" select="value" />
<option value="{/shop/properties_for_group/property[@xml_name='razm_odez']/list_items/list_item[list_item_value=$value]/@id}" ><xsl:value-of select="value"/></option>
</xsl:template>
<xsl:template match="modifications/item/property[@xml_name='razm_kolg']">
<xsl:variable name="value" select="value" />
<option value="{/shop/properties_for_group/property[@xml_name='razm_kolg']/list_items/list_item[list_item_value=$value]/@id}" ><xsl:value-of select="value"/></option>
</xsl:template>
<xsl:template match="modifications/item/property[@xml_name='razm_nosk']">
<xsl:variable name="value" select="value" />
<option value="{/shop/properties_for_group/property[@xml_name='razm_nosk']/list_items/list_item[list_item_value=$value]/@id}" ><xsl:value-of select="value"/></option>
</xsl:template>
</xsl:stylesheet>
natalya писал(а):
http://ёкка.рф/shop/group_601/group_628/item_351/
— на этот вопрос нет возможности дать точный ответ, не видя самой проблемы. Как правило, причина в ошибках JavaScript-а. Сообщите адрес страницы с проблемой.
http://ёкка.рф/shop/group_601/group_628/item_351/
Ошибка в консоли FireBug:
Ругается вот на это:
Что логично, поскольку для ботинок у меня действует только модификация property133, а property134 property135 property136 соот-но пустые.
Получается конструкция
document.getElementById(selectName) is null
Ругается вот на это:
selectName = "property134"
Что логично, поскольку для ботинок у меня действует только модификация property133, а property134 property135 property136 соот-но пустые.
Получается конструкция
onclick=«return AddIntoCart('/shop/', 355, document.getElementById('count_355').value + '&property133=' + GetSelectValue('property133') + '&property134=' + GetSelectValue('property134') + '&property135=' + GetSelectValue('property135') + '&property136=' + GetSelectValue('property136'))
не работает, поскольку если товар не обладает всеми модификациями, то будет проскакивать ошибка?Соверешенно непонятно почему у вас через функцию AddIntoCart передается столько свойств:
Ведь свойство-то у вас всего одно - "Размер"(property133), вот и передавайте только его. Прочитайте информацию со страницы в девятом сообщении сверху.
Также из-за того, что у вас на страницах товаров отсутствует поле ввода количества, то вместо
return AddIntoCart('{/shop/path}', {@id}, document.getElementById('count_{@id}').value + '&property133=' + GetSelectValue('property133') + '&property134=' + GetSelectValue('property134') + '&property135=' + GetSelectValue('property135') + '&property136=' + GetSelectValue('property136'))
?Ведь свойство-то у вас всего одно - "Размер"(property133), вот и передавайте только его. Прочитайте информацию со страницы в девятом сообщении сверху.
Также из-за того, что у вас на страницах товаров отсутствует поле ввода количества, то вместо
document.getElementById('count_{@id}').value
укажите '1'
Так для других видов товаров мне надо передавать другие свойства. Например свойство "размер обуви" непременимо к одежде и наоборот, "размер колгот не годится для обуви", а ссылка для добавления в корзину должна же быть универсальной??
tanich писал(а):
а ссылка для добавления в корзину должна же быть универсальной??
- при использовании предложенной нами реализации формировать универсальную ссылку не получится. Поэтому вам нужно будет дописывать в коде этого XSL-шаблона проверки: если определенные доп. свойства(например "размер обуви", "цвет" и пр.) для модификаций текущего товара заданы, то использовать указание этих свойств в ссылке. Иначе - нет.Наталья, а вы можете помочь хотя бы с одним типовым условием ("если размер такой-то не равен нулю, то..."
?
?Ну хотя бы подскажите откуда начать копать эти проверки? Лучше проверять в джаве в настройках корзины, или в xsl (вызов разных ссылок с передачей параметров на добавление в корзину)? Буду очень благодарен! Да и многим, думаю, пригодится.. Сюда выложу код.
Авторизация