Модификации товаров

#
Re: Модификации товаров
denisov999 писал(а):
А что там должно быть
- идентификатор значения элемента списка.
Редакция системы какая? В ней модуль "Списки" присутствует? Если да, то сообщите адрес сайта, данные доступа к разделу администрирования и ссылку на эту тему на адрес службы тех. поддержки.
#
Re: Модификации товаров
Редакция - Халява! Модуля списки - нет!

Вот реализация выбора и вывода любых доп свойств по модификациям на примере размеров в ХАЛЯВЕ!

1. Если хотите сделать вывод этих доп свойств в каталоге в XSL КаталогТоваров добавляем:

Вывод:

<!-- Размер одежды  -->
<xsl:if test="count(modifications/item) &gt; 0">
Размеры:&#xA0;<b><xsl:apply-templates select="modifications/item"/>
</b>
</xsl:if><br/>


В конце добавляем шаблон:

<!-- Шаблон для размеров -->
   <xsl:template match="modifications/item">
<xsl:value-of select="property[@xml_name='razm_odez']/value"/>&#xA0;  
   </xsl:template>



В шаблоне 'razm_odez' меняем на XML Вашего доп свойства!!!



2. Вывод Радио-буттонов в XSL  шаблоне по доп свойству в модификации и добавление выбранного в корзину:

Правим Макет, вставляем в head:


<script language="javascript">         
function checkIt() {
theGroup = document.theForm.size999;
for (i=0; i< theGroup.length; i++) {
     if (theGroup[i].checked) {
document.location.href = "/shop/cart/?action=add&item_id=" +    theGroup[i].value;
break;
    }
     }
}</script>


Далее идем в XSL МагазинТовар:

В конец добавляем шаблон для вывода:

<!-- Шаблон для размеров -->
         <xsl:template match="modifications/item">
   <xsl:choose><xsl:when test="position() = 1">
<input name="size999" size="20" type="radio" value="{@id}" checked=""/><xsl:value-of select="property[@xml_name='razm_odez']/value"/>&#xA0;
               </xsl:when><xsl:otherwise>
<input name="size999" size="20" type="radio" value="{@id}"/><xsl:value-of select="property[@xml_name='razm_odez']/value"/>&#xA0;
</xsl:otherwise>
            </xsl:choose>         

</xsl:template>


Далее сам вывод:

<!-- Все доступные размеры одежды  -->
<xsl:if test="count(modifications/item) &gt; 0">
<form name='theForm'><xsl:apply-templates select="modifications/item"/></form>
</xsl:if>


Теперь правим ссылку на корзинке, все убираем и вставляем:

<a href="#" onclick="checkIt();">


Единственный минус после нажатия переходит в корзину ну это и по дефолту так. А вообще можно и в яваскрипте который в макет залили это переделать.
#
Re: Модификации товаров
делала все как описано выше:

1.на странице каталога товаров выдается список модификаций товара -ужасно некрасиво
вот так: http://www.missbaby.ru/shop/group_600/group_609/
как сделать чтобы анпример просто перечислялись размеры такие-то, цвета такие то
через запятую, просто как инфа
2. сначала сделала вариант радиокнопками, в корзину клались нужные модфикации
потом переделала на списки выпадающие и почему то в коризину модфикация не записывается, а только пустой товар
как исправить?

Email: golden-puma@yandex.ru; Skype: golden_puma; Telegram: @GoldenPuma; Сайт: https://goldenpuma.ru
#
Re: Модификации товаров
1. Вывод размеров через запятую

Добавляем там где выводиться товар в шаблоне магазинкаталогтоваров.
<xsl:if test="count(modifications/item) &gt; 0">
&#xA0;Размеры:<xsl:apply-templates select="modifications/item"/></xsl:if>


Удаляем фрагмент где написано вывод модификаций.

   <!-- Шаблон для модификаций -->   
<xsl:template match="modifications/item">               <xsl:value-of select="property[@xml_name='razm_odez']/value"/>&#xA0;               </xsl:template>   


Это ставим вместо шаблона модификаций там же только ниже.
#
Re: Модификации товаров
По поводу второго вопроса скинте кусок кода где выводиться список. Я поправлю
#
Re: Модификации товаров
по первому вопросу получилось теперь так:
http://missbaby.ru/shop/group_600/group_609/
Email: golden-puma@yandex.ru; Skype: golden_puma; Telegram: @GoldenPuma; Сайт: https://goldenpuma.ru
#
Re: Модификации товаров
я вам лучше все пришлю:
<?xml version="1.0" encoding="windows-1251"?>
<!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="Windows-1251" 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:key name="property133" match="/shop/item/modifications/item/property[@xml_name='razmer']" use="value"/>
   <xsl:key name="property134" match="/shop/item/modifications/item/property[@xml_name='color']" 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>
         
         <div>
            <h1>
               <xsl:value-of disable-output-escaping="yes" select="name"/>
            </h1>
         </div>
         <!-- Получаем ID родительской группы и записываем в переменную $parent_group_id -->
         <xsl:variable name="parent_group_id" select="/shop/@current_group_id"/>
         
         <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"/>
         
         <span class="path_arrow">&#x2192;</span>
         <b>
            <a href="{/path}">
               <xsl:value-of disable-output-escaping="yes" select="name"/>
            </a>
         </b>
         
         <div style="float: left; margin: 20px 0px 0px 20px">
            <!-- Средняя оценка товара -->
            <xsl:if test="comments/average_grade/node()">
               <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>
            </xsl:if>
         </div>
         
         
         
         <!-- Информация об ошибках -->
         <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 style="border: 1px solid #dadada; padding: 10px; width: 400px">
               <b>
                  <xsl:choose>
                     <xsl:when test="/shop/comment_is_active = '0'">Комментарий успешно добавлен и будет опубликован после проверки модератором!</xsl:when>
                     <xsl:otherwise>Комментарий успешно добавлен и опубликован!</xsl:otherwise>
                  </xsl:choose>
               </b>
            </div>
         </xsl:if>
         
         <div class="product-outer">
            <!-- Изображение для товара, если есть -->
            <xsl:if test="small_image != ''">
               <div style="float: left; width: {small_image/@width}px; margin: 0px 25px 10px 0px; color: #aaaaaa;">
                  <a href="{image}" target="blank_" onclick="ShowImgWindow('{name}','{image}', {image/@width}, {image/@height}); return false;">
                     <img src="{small_image}" style="border: 1px solid #DADADA; margin: 0px 15px 5px 0px"/>
                  </a>
                  <br/>
                  <a href="{image}" target="blank_" onclick="ShowImgWindow('{name}','{image}', {image/@width}, {image/@height}); return false;">
                     <img src="/hostcmsfiles/images/zoom.gif" alt="Увеличить" />
                  </a>
               </div>
            </xsl:if>
            
            <!-- Цена товара -->
            <p>Цена:
               <span style="font-size: 11pt; font-weight: bold">
                  <xsl:choose>
                     <xsl:when test="price != 0">
                        <xsl:value-of select="format-number(price, '### ###,00', 'my')"/>&#xA0;<xsl:value-of select="currency" disable-output-escaping="yes"/>
                     </xsl:when>
                     <xsl:otherwise>договорная</xsl:otherwise>
                  </xsl:choose>
               </span>
               <br/>
               
               <!-- Если цена со скидкой - выводим ее -->
               <xsl:if test="price!=price_tax">
                  <span style="color: gray; text-decoration: line-through;">
                     <xsl:variable name="pric_tax" select="price_tax"/>
                     <span style="font-size: 11pt">
                        <xsl:value-of select="format-number($pric_tax, '### ###,00', 'my')"/>&#xA0;<xsl:value-of disable-output-escaping="yes" select="currency"/></span>
                  </span>
                  <br/>
               </xsl:if>
            </p>
            
            <div>
               <xsl:choose>
                  <xsl:when test="modifications/item/property[@xml_name='razmer']/node() or modifications/item/property[@xml_name='color']/node()">
                     
                     <!-- Ссылку на добавление в корзины выводим, если:
                     type = 0 - простой тип товара
                     type = 1 - электронный товар, при этом остаток на складе больше 0 или -1,
                     что означает неограниченное количество -->
                     <xsl:if test="type = 0 or (type = 1 and (eitem_count > 0 or eitem_count = -1))">
                        <p>
                           <input type="text" size="3" value="1" id="count_{@id}"/>
                           <a href="{/shop/path}cart/?action=add&amp;item_id={@id}" onclick="return AddIntoCart('{/shop/path}', {@id}, document.getElementById('count_{@id}').value + '&amp;property133=' + GetRadioValueModif('property133') + '&amp;property134=' + GetRadioValueModif('property134'))" style="text-decoration: none;"><img alt="В корзину" title="В корзину" src="/hostcmsfiles/images/cart.gif" style="margin: 0px 0px -4px 10px" />В корзину
                           </a>
                        </p>
                     </xsl:if>
                     
                     <!-- Размер одежды-->
                     <xsl:if test="modifications/item/property[@xml_name='razmer']/node()">
                        <div style="width: 60px; float: left; padding:0 15px;">
                           <h4>Размеры</h4>
                           <select name="property133" id="property133">
                              
                              <xsl:apply-templates select="modifications/item/property[@xml_name='razmer' and
                                 generate-id(.)=generate-id(key('property133', value))]"/>
                        </select>                           </div>
                     </xsl:if>
                     
                     <!-- цвет -->
                     <xsl:if test="modifications/item/property[@xml_name='color']/node()">
                        <div style="width: 60px; float: left; padding:0 15px;">
                           <h4>Цвет</h4>
                           <select name="property134" id="property134">
                              
                              <xsl:apply-templates select="modifications/item/property[@xml_name='color' and
                                 generate-id(.)=generate-id(key('property134', value))]"/>
                           </select>
                        </div>
                     </xsl:if>
                  </xsl:when>
                  <xsl:otherwise>
                     <p>
                        <input type="text" size="3" value="1" id="count_{@id}"/>
                        <a href="{/shop/path}cart/?action=add&amp;item_id={@id}" onclick="return AddIntoCart('{/shop/path}', {@id}, document.getElementById('count_{@id}').value)" style="text-decoration: none;">
                           <img alt="В корзину" title="В корзину" src="/hostcmsfiles/images/cart.gif" style="margin: 0px 0px -4px 10px" />В корзину
                        </a>
                     </p>
                  </xsl:otherwise>
               </xsl:choose>
            </div>
            
            <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/name != ''">
            <p>Производитель: <b><xsl:value-of disable-output-escaping="yes" select="producer/name"/></b></p>
            </xsl:if>
            
            <!-- Если указан вес товара -->
            <xsl:if test="weight != 0">
               <p>Вес товара: <xsl:value-of select="weight"/>&#xA0;<xsl:value-of select="weight_mesure"/></p>
            </xsl:if>
            
            <!-- Показываем скидки -->
            <xsl:if test="count(discount) &gt; 0">
               <xsl:apply-templates select="discount"/>
            </xsl:if>
            
            <!-- Показываем количество на складе, если больше нуля -->
            <xsl:if test="rest &gt; 0">
               <p>В наличии: <xsl:value-of disable-output-escaping="yes" select="rest"/>&#xA0;<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>
            
            
            
            <xsl:if test="count(property) > 0">
               <h2>Атрибуты товара</h2>
               
               <!-- Свойства в корневой группе -->
               <xsl:if test="count(property[@dir_id = 0])">
                  <table border="0">
                     <xsl:apply-templates select="property[@dir_id = 0]"/>
                  </table>
               </xsl:if>
               
               <!-- Выбираем список групп свойств -->
               <xsl:apply-templates select="/shop/properties_items_dir"/>
            </xsl:if>
         </div>
         
         <!-- Тэги для информационного элемента -->
         <xsl:if test="count(tags/tag) &gt; 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(modifications/item[not(property[@id=133]/node()) and not(property[@id=134]/node())]) &gt; 0">
            <div>
               <h2>Модификации:</h2>
               <table cellspacing="3" cellpadding="3" style="margin-left: -6px;">
                  <tr>
                     <td style="border-bottom: 1px solid #dadada;">Название</td>
                     <td style="border-bottom: 1px solid #dadada;">Цена</td>
                  </tr>
                  <xsl:apply-templates select="modifications/item[not(property[@id=133]/node()) and not(property[@id=134]/node())]"/>
               </table>
            </div>
         </xsl:if>
         
         <xsl:if test="count(tying/item) &gt; 0">
            <p>
               <b>Сопутствующие товары:</b>
            </p>
            <!-- Отображаем сопутствующие товары -->
            <xsl:apply-templates select="tying/item"/>
            <div style="clear: both;"></div>
         </xsl:if>
         
         <!-- Отзывы о товаре -->
         <xsl:if test="count(comments/comment) &gt; 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"/>
         
         <!-- Заполняем форму -->
         <xsl:variable name="subject">
            <xsl:if test="/document/form_parent_id/node() and /document/form_parent_id/node() and /document/form_parent_id= $comment_id">
               <xsl:value-of select="/document/form_subject"/>
            </xsl:if>
         </xsl:variable>
         <xsl:variable name="email">
            <xsl:if test="/document/form_user_email/node() and /document/form_parent_id/node() and /document/form_parent_id= $comment_id">
               <xsl:value-of select="/document/form_user_email"/>
            </xsl:if>
         </xsl:variable>
         <xsl:variable name="text">
            <xsl:if test="/document/form_text/node() and /document/form_parent_id/node() and /document/form_parent_id= $comment_id">
               <xsl:value-of disable-output-escaping="yes" select="/document/form_text"/>
            </xsl:if>
         </xsl:variable>
         <xsl:variable name="name">
            <xsl:if test="/document/form_user_name/node() and /document/form_parent_id/node() and /document/form_parent_id= $comment_id">
               <xsl:value-of select="/document/form_user_name"/>
            </xsl:if>
         </xsl:variable>
         
         <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}"
                        onblur="FieldCheckEmail(this.id)"
                        onkeyup="FieldCheckEmail(this.id)"
                        onkeydown="FieldCheckEmail(this.id)" />
                     <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">
                  
                  Контрольные цифры
                  <sup>
                     <font color="red">*</font>
                  </sup>
                  
                  <div style="float: left">
                     <img id="comment_{$comment_id}" style="border: 1px solid #000000" src="/captcha.php?get_captcha={captcha_key}{$comment_id}&amp;height=30&amp;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 != '')">
            <tr>
               <td style="padding: 5px" bgcolor="#E5DFDA">
                  <b><xsl:value-of select="name"/></b>
               </td>
               <td style="padding: 5px" bgcolor="#E5DFDA">
                  <xsl:choose>
                     <xsl:when test="type = 1">
                        <a href="{file_path}">Скачать файл</a>
                     </xsl:when>
                     <xsl:when test="type = 7">
                        <xsl:choose>
                           <xsl:when test="value = 1">
                              <input type="checkbox" checked="" disabled="" />
                           </xsl:when>
                           <xsl:otherwise>
                              <input type="checkbox" disabled="" />
                           </xsl:otherwise>
                        </xsl:choose>
                     </xsl:when>
                     <xsl:otherwise>
                        <xsl:value-of disable-output-escaping="yes" select="value"/>
                     </xsl:otherwise>
                  </xsl:choose>
               </td>
            </tr>
         </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:if>&#xA0;
      </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"/>&#xA0;
               <!-- Валюта -->
               <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 &gt; ceiling($current_grade))">
               
               <xsl:if test="$current_grade - 1 &gt; 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 &gt; ceiling($current_grade))">
               
               <xsl:if test="$current_grade - 0.5 &gt; 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>&#xA0;
         <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 &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="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>&#xA0;·&#xA0;<xsl:value-of select="date_time"/>&#xA0;·&#xA0;<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"/>&#xA0;<xsl:value-of disable-output-escaping="yes" select="value"/>%
         </p>
      </xsl:template>
      
      <xsl:template match="tying/item">
         
         
         <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 != 0">
                  <xsl:value-of disable-output-escaping="yes" select="price"/>&#xA0;
                  <!-- Валюта товара -->
                  <xsl:value-of disable-output-escaping="yes" select="currency"/>
               </xsl:when>
               <xsl:otherwise>договорная</xsl:otherwise>
            </xsl:choose>
         </strong>
         
         <!-- Если цена со скидкой - выводим ее -->
         <xsl:if test="price!=price_tax">
            <br/>
            <font color="gray">
               <strike>
                  <xsl:value-of disable-output-escaping="yes" select="price_tax"/>&#xA0;<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) &gt; 0">
            <xsl:apply-templates select="discount"/>
         </xsl:if>
         
         <!-- Показываем количество на складе, если больше нуля -->
         <xsl:if test="rest &gt; 0">
            <br/>В наличии: <xsl:value-of disable-output-escaping="yes" select="rest"/></xsl:if>
         
         <xsl:if test="producer/name != ''">
            <br/>Производитель: <xsl:value-of disable-output-escaping="yes" select="producer/name"/></xsl:if>
         
      </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">&#x2192;</span>
         
         <a href="{/shop/path}{fullpath}">
            <xsl:value-of select="name"/>
         </a>
      </xsl:template>
      
      <!-- для размеров -->
      <xsl:template match="modifications/item/property[@xml_name='razmer']">
         <xsl:variable name="value" select="value" />
         <option value="{/shop/properties_for_group/property[@xml_name='razmer']/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='color']">
         <xsl:variable name="value" select="value" />
         <option value="{/shop/properties_for_group/property[@xml_name='color']/list_items/list_item[list_item_value=$value]/@id}" ><xsl:value-of select="value"/></option>
      </xsl:template>
      
   </xsl:stylesheet>
Email: golden-puma@yandex.ru; Skype: golden_puma; Telegram: @GoldenPuma; Сайт: https://goldenpuma.ru
#
Re: Модификации товаров
denisov999,
вы обещали помочь..
Email: golden-puma@yandex.ru; Skype: golden_puma; Telegram: @GoldenPuma; Сайт: https://goldenpuma.ru
#
Re: Модификации товаров
natalya писал(а):
Для реализации функционала необходимо вносить изменения в код XSL-шаблона товара. Пример кода этого XSL-шаблона для вывода значений двух доп. свойств всех модификаций товара(например, для задания роста и размера одежды) в виде радио-групп:


Сделал все, как указано. Не понял только одного - модификации товара создаются, но назначаются только три варианта - красный, синий и зеленый (они же в дополнительных свойствах товара) Подскажите, как их можно заменить на произвольные?. Заранее благодарю.
#
Re: Модификации товаров
Не очень понял, способ, предложенный Натальей, работает без модуля "Списки"?
Авторизация