Untitled

mail@pastecode.io avatar
unknown
php
2 years ago
513 B
1
Indexable
Never
<?php

require($_SERVER['DOCUMENT_ROOT'] . '/bitrix/modules/main/include/prolog_before.php');

\Bitrix\Main\Loader::includeModule('catalog');
\Bitrix\Main\Loader::includeModule('iblock');

echo '<pre>';

$skuId = 29;

$sku =\Bitrix\Catalog\v2\IoC\ServiceContainer::getRepositoryFacade()->loadVariation($skuId);
if (!$sku)
{
	exit('SKU not found');
}

$sku->getParent()->getSectionCollection()->setValues([]);

$r = $sku->save();
if (!$r->isSuccess())
{
	print_r($r->getErrorMessages());
}