示例#1
1
    }
    ?>
			<a href="<?php 
    echo $arItem['DETAIL_PAGE_URL'];
    ?>
">
				<?php 
    $image = $arItem["PREVIEW_PICTURE"];
    if (!empty($image)) {
        // Пропорциональное уменьшение картинки анонса
        $tmpImage = CFile::ResizeImageGet($image, array("width" => 144, "height" => 202), BX_RESIZE_IMAGE_PROPORTIONAL, false);
        //Ставим каринку анонса из PREVIEW
        $image['src'] = $tmpImage['src'];
    } elseif (CModule::IncludeModule('iblock')) {
        $Id = $arItem["IBLOCK_ID"];
        $fields = CIBlock::getFields($Id);
        //Если картинка анонса из детальной
        if (!empty($arItem['DETAIL_PICTURE']) && $fields['PREVIEW_PICTURE']['DEFAULT_VALUE']['FROM_DETAIL'] == "Y") {
            // Пропорциональное уменьшение картинки анонса
            $tmpImage = CFile::ResizeImageGet($arItem['DETAIL_PICTURE'], array("width" => 144, "height" => 202), BX_RESIZE_IMAGE_PROPORTIONAL, false);
            //Ставим каринку анонса из детальной
            $image['src'] = $tmpImage['src'];
        } else {
            $image['src'] = $templateFolder . '/images/no_image.png';
        }
    }
    ?>

				<div class="product_image">
					<img src="<?php 
    echo $image['src'];
示例#2
0
 /**
  * @param int $iblockId
  * @return array
  */
 public function getIblockFields($iblockId)
 {
     $return = [];
     $cache = $this->getCache();
     $cId = get_class($this) . '_fields';
     if (!$cache || ($return = $cache->get($cId)) === false) {
         $return = [];
         $list = $this->getList();
         foreach ($list as $ib) {
             if (empty($ib['ID'])) {
                 continue;
             }
             $return[$ib['ID']] = \CIBlock::getFields($ib['ID']);
         }
         if ($cache) {
             $cache->set($cId, $return, $this->cacheTime);
         }
     }
     return isset($return[$iblockId]) ? $return[$iblockId] : [];
 }
示例#3
0
文件: Iblock.php 项目: marvin255/bxar
 /**
  * Возвращает описание полей инфоблока
  * @return array
  */
 public static function getFields($iblockId)
 {
     if (!\CModule::IncludeModule('iblock')) {
         return null;
     }
     if (!isset(self::$_fields[$iblockId])) {
         self::$_fields[$iblockId] = \CIBlock::getFields($iblockId);
     }
     return self::$_fields[$iblockId];
 }
示例#4
0
 /**
  * @param string $code
  * @param array $fields
  */
 protected function IblockSetFields($code, array $fields)
 {
     $id = $this->IblockGetIdByCode($code);
     if ($id) {
         $old_fields = \CIBlock::getFields($id);
         $fields = array_merge($old_fields, $fields);
         \CIBlock::setFields($id, $fields);
     } else {
         throw new \Exception("Can't set fields for {$code} iblock");
     }
 }