getConnection();
$result = $connection->query("SELECT * FROM `mylikes` WHERE (`id_basket` = $basketId)");
$arItems = array();
if(count($arItems2 = $result->fetchAll())) {
require_once($_SERVER["DOCUMENT_ROOT"] . '/local/templates/main/phpscripts/mygetsectionsbyid.php');// Подключаем класс для получения $NAME2
$myGetSectionInfoById = new myGetSectionInfoById;
$iii = 0;
foreach ($arItems2 as $oneItem) {
$productPrice = GetCatalogProductPrice($oneItem["id_product"], 1);
// Или можно так было получить цену CPrice::GetByID(5);
$productPrice = $productPrice["PRICE"];
$arSelect = Array("ID", "NAME", "DATE_ACTIVE_FROM","PREVIEW_PICTURE","PROPERTY_DISCOUNT","CODE","DETAIL_PAGE_URL");
$arFilter = Array("IBLOCK_ID"=>1, "ACTIVE_DATE"=>"Y", "ACTIVE"=>"Y","ID"=>$oneItem["id_product"]);
$res = CIBlockElement::GetList(Array(), $arFilter, false, Array(), $arSelect);
$checkProduct = false;
$src = "";
$name = "";
if (($ob = $res->GetNextElement()) !== false) {
$arFields = $ob->GetFields();
$src = CFile::GetPath($arFields["PREVIEW_PICTURE"]);
// Обрезаем картинки до нужного размера
// $PREVIEW_PICTURE = CFile::GetPath($arFields["PREVIEW_PICTURE"]);
if ($src2 = CFile::ResizeImageGet(
$arFields["PREVIEW_PICTURE"],
array("width"=>285,"height"=>285),
BX_RESIZE_IMAGE_PROPORTIONAL,
false,
false,
false,
false
)) {
if (isset($src2["src"]) and $src2["src"]) {
$src = $src2["src"];
}
}unset($src2);
$name = $arFields["NAME"];
$checkProduct = true;
$discount = "";
if (isset($arFields["PROPERTY_DISCOUNT_VALUE"]) and $arFields["PROPERTY_DISCOUNT_VALUE"]) {
$discount = $arFields["PROPERTY_DISCOUNT_VALUE"];
}
}
if ($checkProduct) {
// Формируем массив значений для шаблона
$arItem[] = array("ID"=>$oneItem["id_product"],"NAME"=>$name,"SRC"=>$src,"PRICE"=>$productPrice,"PROPERTY_DISCOUNT_VALUE"=>$discount,"CODE"=>$arFields["CODE"],"DETAIL_PAGE_URL"=>$arFields["DETAIL_PAGE_URL"],"SECTION"=>$arFields["IBLOCK_SECTION_ID"]);
}
$iii++;
}
if (count($arItem)) {
foreach ($arItem as $item) {
$name2 = $myGetSectionInfoById->get(1,$item["SECTION"],"UF_NAME2","");
?>
Ваш список избранных товаров пуст!";
}
} else {
echo "
Ваш список избранных товаров пуст!
";
}
?>