Здравствуйте!
В стандартном шаблоне Битрикс, в карте товара слайдер с большими изображениями формируется при помощи .js скрипта.
drawImages: function(images) {
if (!this.node.imageContainer)
return;
var i, img, entities = this.getEntities(this.node.imageContainer, 'image');
for (i in entities)
{
if (entities.hasOwnProperty(i) && BX.type.isDomNode(entities[i]))
{
BX.remove(entities[i]);
}
}
for (i = 0; i < images.length; i++)
{
img = BX.create('IMG', {
props: {
src: images[i].SRC,
alt: this.config.alt,
title: this.config.title
}
});
if (i == 0)
{
img.setAttribute('itemprop', 'image');
}
this.node.imageContainer.appendChild(
BX.create('DIV', {
attrs: {
'data-entity': 'image',
'data-id': images[i].ID
},
props: {
className: 'product-item-detail-slider-image' + (i == 0 ? ' active' : '')
},
children: [img]
})
);
}
Так вот вопрос, кто знает, как заставить скрипт выводить изображения с учетом ресайза?
Изображения выводятся из дополнительного свойства MORE_PHOTO - торговые предложения.
Для ресайза миниатюр использую такой способ
if ($haveOffers)
{
foreach ($arResult['OFFERS'] as $keyOffer => $offer)
{
if (!isset($offer['MORE_PHOTO_COUNT']) || $offer['MORE_PHOTO_COUNT'] <= 0)
continue;
$strVisible = $arResult['OFFERS_SELECTED'] == $keyOffer ? '' : 'none';
?>
<div class="product-item-detail-slider-controls-block" id="<?=$itemIds['SLIDER_CONT_OF_ID'].$offer['ID']?>" st yle="display: <?=$strVisible?>;">
<?
foreach ($offer['MORE_PHOTO'] as $keyPhoto => $photo)
{
?>
<div class="product-item-detail-slider-controls-image<?=($keyPhoto == 0 ? ' active' : '')?>"
data-entity="slider-control" data-value="<?=$offer['ID'].'_'.$photo['ID']?>">
<?
$renderImage = CFile::ResizeImageGet($photo['ID'], Array("width" => 65, "height" => 57), BX_RESIZE_IMAGE_EXACT, false);
echo '<img alt="" src="'.$renderImage["src"].'" />';
?>
</div>
<?
}
?>
</div>
<?
}
}
Заранее спасибо за любые подсказки
В стандартном шаблоне Битрикс, в карте товара слайдер с большими изображениями формируется при помощи .js скрипта.
drawImages: function(images) {
if (!this.node.imageContainer)
return;
var i, img, entities = this.getEntities(this.node.imageContainer, 'image');
for (i in entities)
{
if (entities.hasOwnProperty(i) && BX.type.isDomNode(entities[i]))
{
BX.remove(entities[i]);
}
}
for (i = 0; i < images.length; i++)
{
img = BX.create('IMG', {
props: {
src: images[i].SRC,
alt: this.config.alt,
title: this.config.title
}
});
if (i == 0)
{
img.setAttribute('itemprop', 'image');
}
this.node.imageContainer.appendChild(
BX.create('DIV', {
attrs: {
'data-entity': 'image',
'data-id': images[i].ID
},
props: {
className: 'product-item-detail-slider-image' + (i == 0 ? ' active' : '')
},
children: [img]
})
);
}
Так вот вопрос, кто знает, как заставить скрипт выводить изображения с учетом ресайза?
Изображения выводятся из дополнительного свойства MORE_PHOTO - торговые предложения.
Для ресайза миниатюр использую такой способ
if ($haveOffers)
{
foreach ($arResult['OFFERS'] as $keyOffer => $offer)
{
if (!isset($offer['MORE_PHOTO_COUNT']) || $offer['MORE_PHOTO_COUNT'] <= 0)
continue;
$strVisible = $arResult['OFFERS_SELECTED'] == $keyOffer ? '' : 'none';
?>
<div class="product-item-detail-slider-controls-block" id="<?=$itemIds['SLIDER_CONT_OF_ID'].$offer['ID']?>" st yle="display: <?=$strVisible?>;">
<?
foreach ($offer['MORE_PHOTO'] as $keyPhoto => $photo)
{
?>
<div class="product-item-detail-slider-controls-image<?=($keyPhoto == 0 ? ' active' : '')?>"
data-entity="slider-control" data-value="<?=$offer['ID'].'_'.$photo['ID']?>">
<?
$renderImage = CFile::ResizeImageGet($photo['ID'], Array("width" => 65, "height" => 57), BX_RESIZE_IMAGE_EXACT, false);
echo '<img alt="" src="'.$renderImage["src"].'" />';
?>
</div>
<?
}
?>
</div>
<?
}
}
Заранее спасибо за любые подсказки