3namespace Bitrix\Catalog\v2\Section;
5use Bitrix\Catalog\v2\BaseCollection;
6use Bitrix\Catalog\v2\BaseEntity;
7use Bitrix\Catalog\v2\Product\BaseProduct;
33 throw new \OutOfRangeException($id);
42 return reset($entities) ?:
null;
67 foreach ($entities as $section)
69 if ($parentEntity && $parentEntity !== $section->getParent())
71 $result->addError(
new Error(
'Saving should only be done with sections of a common parent.'));
74 if ($parentEntity ===
null)
76 $parentEntity = $section->getParent();
79 $sections[] = $section->getValue();
84 $result->addError(
new Error(
'Parent entity not found while saving sections.'));
87 if (!($parentEntity instanceof BaseProduct))
89 $result->addError(
new Error(sprintf(
90 'Parent entity of section must be an instance of {%s}.',
95 if (!empty($sections) &&
$result->isSuccess())
97 \CIBlockElement::setElementSection(
98 $parentEntity->getId(),
100 $parentEntity->isNew(),
116 if ($product->
isNew())
130 $sectionIdsIterator = \CIBlockElement::getElementGroups(
135 while ($section = $sectionIdsIterator->fetch())
138 'VALUE' => (int)$section[
'ID'],
153 $entity = $this->factory->createEntity();
162 $collection = $this->factory->createCollection();
164 foreach ($entityFields as
$fields)
167 $collection->add($section);
createEntity(array $fields)
getListByProductId(int $productId)
getCollectionByProduct(BaseProduct $product)
__construct(SectionFactory $factory)
createCollection(array $entityFields=[])
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
save(BaseEntity ... $entities)
if($inWords) echo htmlspecialcharsbx(Number2Word_Rus(roundEx($totalVatSum $params['CURRENCY']