403Webshell
Server IP : 80.87.202.40  /  Your IP : 216.73.216.169
Web Server : Apache
System : Linux rospirotorg.ru 5.14.0-539.el9.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Dec 5 22:26:13 UTC 2024 x86_64
User : bitrix ( 600)
PHP Version : 8.2.27
Disable Function : NONE
MySQL : OFF |  cURL : ON |  WGET : ON |  Perl : ON |  Python : OFF |  Sudo : ON |  Pkexec : ON
Directory :  /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/iblock/lib/component/

Upload File :
current_dir [ Writeable] document_root [ Writeable]

 

Command :


[ Back ]     

Current File : /home/bitrix/ext_www/rospirotorg.ru/bitrix/modules/iblock/lib/component/filters.php
<?php
namespace Bitrix\Iblock\Component;

use Bitrix\Catalog;
/**
 * Class Filters
 * Provides various useful methods for sorted offers.
 *
 * @package Bitrix\Iblock\Component
 */
class Filters
{
	/**
	 * Return offers id by filter.
	 *
	 * @param array $filter				CIBlockElement::getList filter.
	 * @return array
	 */
	public static function getFilteredOffersId(array $filter)
	{
		$result = array();
		if (empty($filter) || !is_array($filter))
			return $result;

		$itemsIterator = \CIBlockElement::getList(array(), $filter, false, false, array('ID'));
		while ($item = $itemsIterator->fetch())
		{
			$item['ID'] = (int)$item['ID'];
			$result[$item['ID']] = $item['ID'];
		}
		unset($item, $itemsIterator);

		return $result;
	}

	/**
	 * Return offer id by filter group by product id.
	 *
	 * @param int $iblockId				Offers iblock id.
	 * @param int $propertyId			Sku property id.
	 * @param array $filter				CIBlockElement::getList filter.
	 * @return array
	 */
	public static function getFilteredOffersByProduct($iblockId, $propertyId, array $filter)
	{
		$result = array();
		$iblockId = (int)$iblockId;
		$propertyId = (int)$propertyId;
		if ($iblockId <= 0 || $propertyId <= 0)
			return $result;
		if (empty($filter) || !is_array($filter))
			return $result;

		$valuesIterator = \CIBlockElement::getPropertyValues($iblockId, $filter, false, array('ID' => $propertyId));
		while ($value = $valuesIterator->fetch())
		{
			$productId = (int)$value[$propertyId];
			$offerId = (int)$value['IBLOCK_ELEMENT_ID'];
			if (!isset($result[$productId]))
				$result[$productId] = array();
			$result[$productId][$offerId] = $offerId;
		}
		unset($value, $valuesIterator);

		return $result;
	}
}

Youez - 2016 - github.com/yon3zu
LinuXploit