{ CIBlockPriceTools::setRatioMinPrice($arResult, true); } if (!empty($arResult['DISPLAY_PROPERTIES'])) { foreach ($arResult['DISPLAY_PROPERTIES'] as $propKey => $arDispProp) { if ('F' == $arDispProp['PROPERTY_TYPE']) unset($arResult['DISPLAY_PROPERTIES'][$propKey]); } } $arResult['SKU_PROPS'] = $arSKUPropList; $arResult['DEFAULT_PICTURE'] = $arEmptyPreview; $arResult['wish']['isWished'] = CIBlockElement::GetList(false, array( 'IBLOCK_ID' => 23, 'ACTIVE' => 'Y', 'PROPERTY_OBJECT' => $arResult['ID'] ), false, false, array('ID'))->SelectedRowsCount(); CBitrixComponent::includeComponentClass("component.model:likes"); $objElement = new CIBlockElement; $likes = new Likes(1); $arResult['likes']['already_liked'] = $likes->isLikedByCurrent($arResult['ID']); $arResult['likes']['value'] = $likes->count($arResult['ID']); ?>
<?php require $_SERVER["DOCUMENT_ROOT"] . "/bitrix/modules/main/include/prolog_before.php"; CModule::IncludeModule('iblock'); CBitrixComponent::includeComponentClass("component.model:likes"); $objElement = new CIBlockElement(); $likes = new Likes($_POST['ib']); $like = $likes->isLikedByCurrent($_POST['element']); if (false === $like) { $result['plus'] = true; $hash = md5($_SERVER['REMOTE_ADDR']); $x = $objElement->Add(array('IBLOCK_ID' => 17, 'NAME' => 'Like', 'ACTIVE' => 'Y', 'PROPERTY_VALUES' => array('IP' => $_SERVER['REMOTE_ADDR'], 'HASH' => $hash, 'OBJECT_ID' => $_POST['element'], 'IBLOCK_ID' => $_POST['ib'], 'USER' => $USER->GetId()))); \setcookie('muchmore-blog-like', $hash); } else { $result['plus'] = false; $objElement->Delete($like); unset($_COOKIE['muchmore-blog-like']); } $result['val'] = $likes->count($_POST['element']); echo json_encode($result);