• Модуль: sale
  • Путь к файлу: ~/bitrix/modules/sale/lib/controller/property.php
  • Класс: BitrixSaleControllerProperty
  • Вызов: Property::validateVariants
protected function validateVariants()
{
	if (!empty($this->property))
	{
		$index = 0;
		$variantSettings = $this->getVariantSettings();

		foreach ($this->property['VARIANTS'] as $row)
		{
			++$index;

			if (isset($row['DELETE']) && $row['DELETE'] === 'Y')
			{
				unset($this->propertySettings['DEFAULT_VALUE']['OPTIONS'][$row['VALUE']]);
			}
			else
			{
				$hasError = false;

				foreach ($variantSettings as $name => $input)
				{
					if ($error = Manager::getError($input, $row[$name]))
					{
						$this->errors[] = Loc::getMessage('INPUT_ENUM')." $index: ".$input['LABEL'].': '.implode(', ', $error);
						$hasError = true;
					}
				}

				if ($hasError)
				{
					unset($this->propertySettings['DEFAULT_VALUE']['OPTIONS'][$row['VALUE']]);
				}
			}
		}
	}
}