О дополнительных изображениях

#
Re: О дополнительных изображениях
vasilev, путь к атрибутам, содержащим ширину и высоту доп. изображения, задан вами неверно. Посмотрите XML-код; верный код таков:
<a href="JavaScript:void(0)" onclick="ShowImgWindow ('{name}','{file_path}','{file_path/@width}','{file_path/@height}')"><img src="{small_image/file_path}"/></a>
#
Re: О дополнительных изображениях
compaq, попробуйте вместо условия:
<xsl:when test="type = '1'"><a href="{file_path}"
class="highslide" onclick="return hs.expand(this)">...

использовать:
<xsl:when test="type = '1' and file_path != ''"><a href="{file_path}"
class="highslide" onclick="return hs.expand(this)">...

Кроме того, приведите XML-код. Возможно, в тэге file_path содержатся какие-то данные, даже если картинка отсутствует.
#
Re: О дополнительных изображениях
natalya, большое спасибо! Все работает.
#
Re: О дополнительных изображениях
vasilev, пожалуйста.
#
Re: О дополнительных изображениях
natalya писал(а):
Кроме того, приведите XML-код. Возможно, в тэге file_path содержатся какие-то данные, даже если картинка отсутствует.



<?xml version="1.0" encoding="windows-1251"?>
<shop id="1" current_group_id="0">
<user_id>0</user_id>
<name>Надувные лодки WINboat</name>
<description></description>
<path>/product/</path>
<sallers>
<saller id="1">
<sallers_name>ООО &quot;Инфинити&quot;</sallers_name>
<sallers_contact_person>Иванов И. А.</sallers_contact_person>
<sallers_comment></sallers_comment>
<sallers_address></sallers_address>
<sallers_phone></sallers_phone>
<sallers_fax></sallers_fax>
<sallers_http></sallers_http>
<sallers_email></sallers_email>
<sallers_inn></sallers_inn>
</saller>
</sallers>
<item id="203" group="0">
<captcha_key>50436</captcha_key>
<name>WINboat R360</name>
<saller>0</saller>
<marking_of_goods>R360</marking_of_goods>
<description></description>
<date>30.11.1999</date>
<datetime>30.11.1999 00:00:00</datetime>
<time>00:00:00</time>
<putoff_date>00.00.0000 00:00:00</putoff_date>
<putend_date>00.00.0000 00:00:00</putend_date>
<text>&lt;table style=&quot;height: 411px;&quot; border=&quot;0&quot; cellspacing=&quot;0&quot;&gt;
&lt;tbody&gt;
&lt;tr style=&quot;color: #000;&quot;&gt;
&lt;td colspan=&quot;2&quot;&gt;&lt;strong&gt;Характеристики&lt;/strong&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Название&lt;/td&gt;
&lt;td class=&quot;value&quot;&gt;WINboat R280&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Плотность ПВХ, г/кв.м&lt;/td&gt;
&lt;td class=&quot;value&quot;&gt;---&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Длина, мм&lt;/td&gt;
&lt;td class=&quot;value&quot;&gt;---&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Ширина, мм&lt;/td&gt;
&lt;td class=&quot;value&quot;&gt;---&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Количество камер, шт&lt;/td&gt;
&lt;td class=&quot;value&quot;&gt;---&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Пассажировместимость, чел.&lt;/td&gt;
&lt;td class=&quot;value&quot;&gt;---&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Макс. мощность мотора&lt;/td&gt;
&lt;td class=&quot;value&quot;&gt;---&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Грузоподъемность, кг&lt;/td&gt;
&lt;td class=&quot;value&quot;&gt;---&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Вес, кг&lt;/td&gt;
&lt;td class=&quot;value&quot;&gt;---&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Диаметр бортового болона, мм&lt;/td&gt;
&lt;td class=&quot;value&quot;&gt;---&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Вес, кг&lt;/td&gt;
&lt;td class=&quot;value&quot;&gt;---&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Высота транца, мм&lt;/td&gt;
&lt;td class=&quot;value&quot;&gt;---&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;Высота борта на миделе,мм&lt;/td&gt;
&lt;td class=&quot;value&quot;&gt;---&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;</text>
<image width="800" height="600">/upload/shop_1/item_catalog_203/shop_items_catalog_image203.jpg</image>
<small_image width="160" height="105">/upload/shop_1/item_catalog_203/small_shop_items_catalog_image203.jpg</small_image>
<weight>0</weight>
<weight_mesure>кг</weight_mesure>
<rest>1</rest>
<mesure></mesure>
<price>0.00</price>
<price_tax>0.00</price_tax>
<price_discount>0.00</price_discount>
<item_currency>руб.</item_currency>
<currency>руб.</currency>
<is_active>1</is_active>
<order>0</order>
<path>winboat-r360</path>
<fullpath></fullpath><seo_title></seo_title>
<seo_description></seo_description>
<seo_keywords></seo_keywords>
<indexation>1</indexation>
<vendorCode></vendorCode>
<shop_special_prices>
</shop_special_prices>
</item>
</shop>
ку
#
Re: О дополнительных изображениях
compaq, в приведенном XML-коде вообще нет информации о доп. свойствах. Поэтому ни одно из условий(в XSL-шаблоне) не выполняется. Видимо, у этого товара доп. свойств вообще нет.
#
Re: О дополнительных изображениях
natalya писал(а):
compaq, в приведенном XML-коде вообще нет информации о доп. свойствах. Поэтому ни одно из условий (в XSL-шаблоне) не выполняется. Видимо, у этого товара доп. свойств вообще нет.


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

у другого товара если есть то вот результат

<?xml version="1.0" encoding="windows-1251"?>
<shop id="1" current_group_id="0">
<user_id>0</user_id>
<name>РИБы и надувные лодки</name>
<description></description>
<path>/product/</path>
<sallers>
<saller id="1">
<sallers_name>ООО &quot;Инфинити&quot;</sallers_name>
<sallers_contact_person>Иванов И. А.</sallers_contact_person>
<sallers_comment></sallers_comment>
<sallers_address></sallers_address>
<sallers_phone></sallers_phone>
<sallers_fax></sallers_fax>
<sallers_http></sallers_http>
<sallers_email></sallers_email>
<sallers_inn></sallers_inn>
</saller>
</sallers>
<item id="202" group="0">
<captcha_key>95980</captcha_key>
<name>WINboat R280</name>
<saller>0</saller>
<marking_of_goods>R280</marking_of_goods>
<description>Здесь небольшие замечания по данной модели.

О том какая она хорошая,почему стоит именно ее выбрать среди остальных моделей и так далее.

Наверху кликабельные фото после чего можно просмотреть выбранную фотографию в более большом размере а так же не закрывая окно просмотреть и остальные фотографии в сете.</description>
<date>30.11.1999</date>
<datetime>30.11.1999 00:00:00</datetime>
<time>00:00:00</time>
<putoff_date>00.00.0000 00:00:00</putoff_date>
<putend_date>00.00.0000 00:00:00</putend_date>
<text>Характеристики модели
Название   WINboat R280
Плотность ПВХ, г/кв.м   ---
Длина, мм   ---
Ширина, мм   ---
Количество камер, шт   ---
Пассажировместимость, чел.   ---
Макс. мощность мотора   ---
Грузоподъемность, кг   ---
Вес, кг   ---
Диаметр бортового болона, мм   ---
Высота транца, мм   ---
Высота борта на миделе,мм   ---</text>
<image width="800" height="600">/upload/shop_1/item_catalog_202/shop_items_catalog_image202.jpg</image>
<small_image width="305" height="250">/upload/shop_1/item_catalog_202/small_shop_items_catalog_image202.jpg</small_image>
<weight>0</weight>
<weight_mesure>кг</weight_mesure>
<rest>100</rest>
<mesure>шт</mesure>
<price>34000.00</price>
<price_tax>34000.00</price_tax>
<price_discount>34000.00</price_discount>
<item_currency>руб.</item_currency>
<currency>руб.</currency>
<is_active>1</is_active>
<order>0</order>
<path>winboat-r280</path>
<fullpath></fullpath><seo_title></seo_title>
<seo_description></seo_description>
<seo_keywords></seo_keywords>
<indexation>1</indexation>
<vendorCode></vendorCode>
<property id="138" dir_id="0" xml_name="item_photo">
<name>Фотография товара</name>
<xml_name>item_photo</xml_name>
<type>1</type>
<order>0</order>
<prefics></prefics>
<value>WINboat R280.jpg</value>
<file_path width = "604" height = "404">/upload/shop_1/item_catalog_202/shop_property_file_202_138.jpg</file_path>
<small_image>
<file_path width = "305" height = "204">/upload/shop_1/item_catalog_202/small_shop_property_file_202_138.jpg</file_path>
<value></value>
</small_image>
<mesure>шт</mesure></property>
<property id="136" dir_id="0" xml_name="item_photos">
<name>Фотографии товара</name>
<xml_name>item_photos</xml_name>
<type>1</type>
<order>1</order>
<prefics></prefics>
<value>WINboat R280.jpg</value>
<file_path width = "604" height = "404">/upload/shop_1/item_catalog_202/shop_property_file_202_136.jpg</file_path>
<small_image>
<file_path width = "70" height = "46">/upload/shop_1/item_catalog_202/small_shop_property_file_202_136.jpg</file_path>
<value></value>
</small_image>
<mesure>шт</mesure></property>
<property id="135" dir_id="0" xml_name="item_photos">
<name>Фотографии товара</name>
<xml_name>item_photos</xml_name>
<type>1</type>
<order>2</order>
<prefics></prefics>
<value>WINboat R280.jpg</value>
<file_path width = "604" height = "404">/upload/shop_1/item_catalog_202/shop_property_file_202_135.jpg</file_path>
<small_image>
<file_path width = "70" height = "46">/upload/shop_1/item_catalog_202/small_shop_property_file_202_135.jpg</file_path>
<value></value>
</small_image>
<mesure>шт</mesure></property>
<property id="134" dir_id="0" xml_name="item_photos">
<name>Фотографии товара</name>
<xml_name>item_photos</xml_name>
<type>1</type>
<order>3</order>
<prefics>item_photos</prefics>
<value>WINboat R280.jpg</value>
<file_path width = "604" height = "404">/upload/shop_1/item_catalog_202/shop_property_file_202_134.jpg</file_path>
<small_image>
<file_path width = "70" height = "46">/upload/shop_1/item_catalog_202/small_shop_property_file_202_134.jpg</file_path>
<value></value>
</small_image>
<mesure>шт</mesure></property>
<property id="133" dir_id="0" xml_name="item_photos">
<name>Фотографии товара</name>
<xml_name>item_photos</xml_name>
<type>1</type>
<order>4</order>
<prefics>photos</prefics>
<value>WINboat R280.jpg</value>
<file_path width = "604" height = "404">/upload/shop_1/item_catalog_202/shop_property_file_202_133.jpg</file_path>
<small_image>
<file_path width = "70" height = "46">/upload/shop_1/item_catalog_202/small_shop_property_file_202_133.jpg</file_path>
<value></value>
</small_image>
<mesure>шт</mesure></property>
<comments>
<grade_sum>0</grade_sum>
<grade_count>0</grade_count>
<average_grade>0</average_grade>
<comment id="1">
<subject>grg</subject>
<text>grg</text>
<date_time>07.11.2008 13:49:39</date_time>
<user_name>fr</user_name>
<grade>0</grade>
</comment>
</comments>
<shop_special_prices>
</shop_special_prices>
</item>
</shop>
ку
#
Re: О дополнительных изображениях
вот мой весь xls товара

<?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:template match="/shop">
      <xsl:apply-templates select="item"/>
   </xsl:template>

   <xsl:template match="item">

      <!-- Получаем ID родительской группы и записываем в переменную $parent_group_id -->
      <xsl:variable name="parent_group_id" select="/shop/@current_group_id"/>

      <div style="clear: both"></div>

      

      <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="right_item_main">
      

         <!-- Выводим список дополнительных свойств -->
      <div class="right_item_photo">
         <xsl:apply-templates select="property[@xml_name = 'item_photo']"/><br />
         <xsl:apply-templates select="property[@xml_name = 'item_photos']" mode="photos"/>
         </div>
         <div class="right_item_text">
      <xsl:if test="marking_of_goods != ''">
            <p>Артикул:&#160;<b><xsl:value-of disable-output-escaping="yes" select="marking_of_goods"/></b></p><br />
            <p>Текущая цена:&#160;
               <xsl:choose>
                  <xsl:when test="price != 0">
                     <b><xsl:value-of select="format-number(price, '###.##0,00', 'my')"/>&#xA0;<xsl:value-of select="currency" disable-output-escaping="yes"/></b>
                  </xsl:when>
                  <xsl:otherwise><b>договорная</b></xsl:otherwise>
               </xsl:choose></p>
         </xsl:if>
            <xsl:if test="count(modifications/item) &gt; 0">
         <p>Модификации:&#160;<b><xsl:apply-templates select="modifications/item"/></b></p><br /></xsl:if>
           </div>   <div class="clear"></div>
         <div class="desc"> <xsl:value-of disable-output-escaping="yes" select="description" /></div>
         <!-- Текст товара -->
         <div class="har"><xsl:value-of disable-output-escaping="yes" select="text"/></div>


      </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(tying/item) &gt; 0">
         <p>
            <b>Сопутствующие товары:</b>
         </p>
         <!-- Отображаем сопутствующие товары -->
         <xsl:apply-templates select="tying/item"/>
      </xsl:if>
   </xsl:template>

   
   
   <!-- Вывод раздела для свойств товара -->
   <xsl:template match="properties_items_dir">

      <p><b><xsl:value-of select="shop_properties_items_dir_name"/></b></p>

      <xsl:variable name="dir_id" select="@id"/>

      <xsl:if test="count(//properties_for_group[@id = $dir_id])">
         <table border="0">
            <xsl:apply-templates select="//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">
      <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: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">
      
            <!-- Название модификации -->
            <a href="{/shop/path}{fullpath}{path}/">
               <xsl:value-of disable-output-escaping="yes" select="name"/>
            </a>
   </xsl:template>


  <!-- Шаблон вывода дополнительных свойств -->
  
<xsl:template match="property">
<xsl:choose>
<xsl:when test="type = '1' and file_path != ''"><a href="{file_path}"
      class="highslide" onclick="return hs.expand(this)"><img src="{small_image/file_path}" alt="" /></a>
      <div class="highslide-heading">
      <h1>
               <xsl:value-of disable-output-escaping="yes" select="name"/>
            </h1>
</div>
         </xsl:when>
         <xsl:when test="type = '1' and file_path != ''">
тест
</xsl:when>
</xsl:choose>
</xsl:template>


<xsl:template match="property" mode="photos">
<xsl:choose>
<xsl:when test="type = '1'and file_path != ''"><a href="{file_path}" class="highslide"
        onclick="return hs.expand(this)"><img src="{small_image/file_path}" alt="" class="small"/></a>
        <div class="highslide-heading">
<h1>
               <xsl:value-of disable-output-escaping="yes" select="name"/>
            </h1>
</div>
            </xsl:when>

</xsl:choose>
</xsl:template>


   <!-- Шаблон для отзывов -->
   <xsl:template match="comments/comment">
   <div class="comment">
      <div class="tl"></div>
      <div class="tr"></div>
      <div class="bl"></div>
      <div class="br"></div>
      <b>
         <xsl:value-of select="subject"/>
      </b><br/>
      <xsl:value-of disable-output-escaping="yes" select="text"/><br/>
      Оценка:    <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>
      <div style="padding-left: 18px;">
         <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"/>
      </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">

      <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}/" rel="lightbox"  title="{name}">
               <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>
      </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">&#x2192;</span>

      <a href="{/shop/path}{fullpath}">
         <xsl:value-of select="name"/>
      </a>
   </xsl:template>
</xsl:stylesheet>
ку
Модератор
#
Re: О дополнительных изображениях
У Вас в XML для товара присутствуют дополнительные свойства с тегами "item_photo" и "item_photos". При отсутствии дополнительных свойств с какими из этих двух тегов Вы хотите отображать альтернативную информацию?
#
Re: О дополнительных изображениях
Ivanov писал(а):
У Вас в XML для товара присутствуют дополнительные свойства с тегами «item_photo» и «item_photos». При отсутствии дополнительных свойств с какими из этих двух тегов Вы хотите отображать альтернативную информацию?


да 8)

выше я написал что не получается и пока стою на месте

в моем случае надо чтобы если пустое свойство «item_photo» то вывести инфо: нет фотографии
с этим проблема 8(


а с «item_photos» ранее в этом топике разобрались - если пустое то просто не выводит ничего

помогите пожалуйста.
ку
Авторизация