• Модуль: catalog
  • Путь к файлу: ~/bitrix/modules/catalog/lib/controller/price.php
  • Класс: BitrixCatalogControllerPrice
  • Вызов: Price::modifyBefore
protected function modifyBefore($fields)
{
	$productId = $fields['PRODUCT']['ID'];

	$ids = [];
	$prices = $fields['PRODUCT']['PRICES'];
	foreach ($prices as $price)
	{
		$ids[]=$price['ID'];
	}

	$entityTable = $this->getEntityTable();

	$res = $entityTable::getList(['filter'=>['PRODUCT_ID'=>$productId]]);
	while ($item = $res->fetch())
	{
		if(in_array($item['ID'], $ids) == false)
		{
			$entityTable::delete($item['ID']);
		}
	}

	return new Result();
}